Files
eatvio_app/lib/features/recipes/services/recipe_service.dart
2024-10-24 16:59:51 +03:00

41 lines
1.2 KiB
Dart

import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
import 'package:eatvio_app/features/recipes/models/recipe_tag_model.dart';
import 'package:retrofit/retrofit.dart';
import 'package:eatvio_app/features/recipes/models/product.dart';
part 'recipe_service.g.dart';
@RestApi()
abstract class RecipeService {
factory RecipeService(Dio dio, {String baseUrl}) = _RecipeService;
@GET('/api/recipes/show/{id}')
Future<RecipeModel> getRecipe(@Path() String id);
@GET('/api/diary/product_nutritional_values/filter')
Future<Map<String, List<Product>>> getInputProduct(@Query('name') String name);
@POST('/api/recipes/create')
Future<RecipeModel> publishRecipe(
@Part() String? type,
@Part() String? state,
@Part() String? title,
@Part() String? description,
@Part() String? video_url,
@Part() List<Map<String, Object>> ingredients,
@Part() List<Map<String, Object>> steps,
@Part() int? cooking_time,
@Part() File image,
);
@POST('/api/recipes/update/{id}')
Future<RecipeModel> editRecipe(@Part() Map<String, Object?> recipe, String id);
@GET('/api/recipes/tags')
Future<RecipeTagModel> getTags();
}