31 lines
832 B
Swift
31 lines
832 B
Swift
//
|
|
// Service.swift
|
|
// APIService
|
|
//
|
|
// Created by Javier Cicchelli on 04/12/2022.
|
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public protocol Service {
|
|
func getUser(credentials: Credentials) async throws -> Me
|
|
func getItems(id: String, credentials: Credentials) async throws -> [Item]
|
|
func getData(id: String, credentials: Credentials) async throws -> Data
|
|
func createFolder(id: String, name: String, credentials: Credentials) async throws -> Item
|
|
func uploadFile(id: String, file: File, credentials: Credentials) async throws -> Item
|
|
func deleteItem(id: String, credentials: Credentials) async throws
|
|
}
|
|
|
|
// MARK: - Structs
|
|
|
|
public struct Credentials {
|
|
let username: String
|
|
let password: String
|
|
}
|
|
|
|
public struct File {
|
|
let name: String
|
|
let data: Data
|
|
}
|