43 lines
892 B
Swift

//
// GetDataEndpoint.swift
// APIService
//
// Created by Javier Cicchelli on 04/12/2022.
// Copyright © 2022 Röck+Cöde. All rights reserved.
//
struct GetDataEndpoint: Endpoint {
let path: String
let method: RequestMethod
let credentials: BasicCredentials
let headers: [String : String]
let body: [String : String]?
}
// MARK: - Initialisers
extension GetDataEndpoint {
init(
itemId: String,
username: String,
password: String
) {
self.path = .init(format: .Formats.itemsDataWithId, itemId)
self.method = .get
self.credentials = .init(
username: username,
password: password
)
self.headers = [:]
self.body = nil
}
}
// MARK: - String+Formats
private extension String {
enum Formats {
static let itemsDataWithId = "/items/%@/data"
}
}