43 lines
877 B
Swift
Raw Normal View History

//
// GetDataEndpoint.swift
// APIService
//
// Created by Javier Cicchelli on 04/12/2022.
// Copyright © 2022 Röck+Cöde. All rights reserved.
//
import Foundation
struct GetDataEndpoint: Endpoint {
let path: String
let method: RequestMethod
let credentials: BasicCredentials
let headers: [String : String]
let body: Data?
}
// 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.Formats {
static let itemsDataWithId = "/items/%@/data"
}