Release Candidate Version 1.6

This commit is contained in:
Vicnet
2023-12-15 13:43:56 +01:00
parent 222685e05d
commit bb68b29bdf
16 changed files with 1020 additions and 275 deletions

View File

@@ -10,8 +10,18 @@ import UIKit
class CookbookApiV1: CookbookApi {
static func importRecipe(from serverAdress: String, auth: String, data: Data) async -> (NetworkError?) {
return .unknownError
static func importRecipe(from serverAdress: String, auth: String, data: Data) async -> (RecipeDetail?, NetworkError?) {
let request = ApiRequest(
serverAdress: serverAdress,
path: "/api/v1/import",
method: .POST,
authString: auth,
headerFields: [HeaderField.ocsRequest(value: true), HeaderField.accept(value: .JSON), HeaderField.contentType(value: .JSON)]
)
let (data, error) = await request.send()
guard let data = data else { return (nil, error) }
return (JSONDecoder.safeDecode(data), nil)
}
static func getImage(from serverAdress: String, auth: String, id: Int, size: RecipeImage.RecipeImageSize) async -> (UIImage?, NetworkError?) {