WIP - Complete App refactoring

This commit is contained in:
VincentMeilinger
2025-05-26 15:52:24 +02:00
parent 29fd3c668b
commit 5acf3b9c4f
49 changed files with 1996 additions and 543 deletions

View File

@@ -32,7 +32,7 @@ protocol CookbookApi {
static func importRecipe(
auth: String,
data: Data
) async -> (RecipeDetail?, NetworkError?)
) async -> (Recipe?, NetworkError?)
/// Get either the full image or a thumbnail sized version.
/// - Parameters:
@@ -42,7 +42,7 @@ protocol CookbookApi {
/// - Returns: The image of the recipe with the specified id. A NetworkError if the request fails, otherwise nil.
static func getImage(
auth: String,
id: Int,
id: String,
size: RecipeImage.RecipeImageSize
) async -> (UIImage?, NetworkError?)
@@ -52,7 +52,7 @@ protocol CookbookApi {
/// - Returns: A list of all recipes.
static func getRecipes(
auth: String
) async -> ([Recipe]?, NetworkError?)
) async -> ([RecipeStub]?, NetworkError?)
/// Create a new recipe.
/// - Parameters:
@@ -60,7 +60,7 @@ protocol CookbookApi {
/// - Returns: A NetworkError if the request fails. Nil otherwise.
static func createRecipe(
auth: String,
recipe: RecipeDetail
recipe: Recipe
) async -> (NetworkError?)
/// Get the recipe with the specified id.
@@ -69,8 +69,9 @@ protocol CookbookApi {
/// - id: The recipe id.
/// - Returns: The recipe if it exists. A NetworkError if the request fails.
static func getRecipe(
auth: String, id: Int
) async -> (RecipeDetail?, NetworkError?)
auth: String,
id: String
) async -> (Recipe?, NetworkError?)
/// Update an existing recipe with new entries.
/// - Parameters:
@@ -79,7 +80,7 @@ protocol CookbookApi {
/// - Returns: A NetworkError if the request fails. Nil otherwise.
static func updateRecipe(
auth: String,
recipe: RecipeDetail
recipe: Recipe
) async -> (NetworkError?)
/// Delete the recipe with the specified id.
@@ -89,7 +90,7 @@ protocol CookbookApi {
/// - Returns: A NetworkError if the request fails. Nil otherwise.
static func deleteRecipe(
auth: String,
id: Int
id: String
) async -> (NetworkError?)
/// Get all categories.
@@ -108,7 +109,7 @@ protocol CookbookApi {
static func getCategory(
auth: String,
named categoryName: String
) async -> ([Recipe]?, NetworkError?)
) async -> ([RecipeStub]?, NetworkError?)
/// Rename an existing category.
/// - Parameters:
@@ -138,7 +139,7 @@ protocol CookbookApi {
static func getRecipesTagged(
auth: String,
keyword: String
) async -> ([Recipe]?, NetworkError?)
) async -> ([RecipeStub]?, NetworkError?)
/// Get the servers api version.
/// - Parameters:
@@ -176,3 +177,4 @@ protocol CookbookApi {