pub struct DummyJsonClient {
pub client: Client,
}Fields§
§client: ClientImplementations§
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn login(
&self,
username: &str,
password: &str,
expires_in_mins: Option<u32>,
) -> Result<LoginResponse, Error>
pub async fn login( &self, username: &str, password: &str, expires_in_mins: Option<u32>, ) -> Result<LoginResponse, Error>
Login to the dummyjson API
Sourcepub async fn refresh_auth_session(
&self,
refresh_token: &str,
expires_in_mins: u32,
) -> Result<RefreshResponse, Error>
pub async fn refresh_auth_session( &self, refresh_token: &str, expires_in_mins: u32, ) -> Result<RefreshResponse, Error>
Refresh the auth session
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_carts(&self) -> Result<GetAllCartsResponse, Error>
pub async fn get_all_carts(&self) -> Result<GetAllCartsResponse, Error>
Get all carts
Sourcepub async fn get_carts_of_user(
&self,
user_id: u32,
) -> Result<GetAllCartsResponse, Error>
pub async fn get_carts_of_user( &self, user_id: u32, ) -> Result<GetAllCartsResponse, Error>
Get carts of user
Sourcepub async fn update_cart(
&self,
id: u32,
payload: UpdateCartPayload,
) -> Result<Cart, Error>
pub async fn update_cart( &self, id: u32, payload: UpdateCartPayload, ) -> Result<Cart, Error>
Update cart
Sourcepub async fn delete_cart(
&self,
cart_id: u32,
) -> Result<DeleteCartResponse, Error>
pub async fn delete_cart( &self, cart_id: u32, ) -> Result<DeleteCartResponse, Error>
Delete cart
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_comments(&self) -> Result<GetAllComments, Error>
pub async fn get_all_comments(&self) -> Result<GetAllComments, Error>
Get all comments
Sourcepub async fn limit_and_skip_comments(
&self,
limit: u32,
skip: u32,
select: &str,
) -> Result<GetAllComments, Error>
pub async fn limit_and_skip_comments( &self, limit: u32, skip: u32, select: &str, ) -> Result<GetAllComments, Error>
Limit and skip comments
Sourcepub async fn get_comments_by_post_id(
&self,
post_id: u32,
) -> Result<GetAllComments, Error>
pub async fn get_comments_by_post_id( &self, post_id: u32, ) -> Result<GetAllComments, Error>
Get comments by post id
Sourcepub async fn add_comment(&self, comment: &AddComment) -> Result<Comment, Error>
pub async fn add_comment(&self, comment: &AddComment) -> Result<Comment, Error>
Add comment
Sourcepub async fn update_comment(
&self,
id: u32,
body: &str,
) -> Result<Comment, Error>
pub async fn update_comment( &self, id: u32, body: &str, ) -> Result<Comment, Error>
Update comment
Sourcepub async fn delete_comment(
&self,
id: u32,
) -> Result<DeleteCommentResponse, Error>
pub async fn delete_comment( &self, id: u32, ) -> Result<DeleteCommentResponse, Error>
Delete comment
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_posts(&self) -> Result<GetAllPosts, Error>
pub async fn get_all_posts(&self) -> Result<GetAllPosts, Error>
Get all posts
Sourcepub async fn search_posts(&self, query: &str) -> Result<GetAllPosts, Error>
pub async fn search_posts(&self, query: &str) -> Result<GetAllPosts, Error>
Search posts
Sourcepub async fn limit_and_skip_posts(
&self,
limit: u32,
skip: u32,
selects: &str,
) -> Result<GetAllPosts, Error>
pub async fn limit_and_skip_posts( &self, limit: u32, skip: u32, selects: &str, ) -> Result<GetAllPosts, Error>
Limit and skip posts
Sourcepub async fn sort_posts(
&self,
sort_by: &str,
order: &str,
) -> Result<GetAllPosts, Error>
pub async fn sort_posts( &self, sort_by: &str, order: &str, ) -> Result<GetAllPosts, Error>
Sort posts
Get all posts tags
Get posts by tags
Sourcepub async fn get_posts_by_user_id(
&self,
user_id: u32,
) -> Result<GetAllPosts, Error>
pub async fn get_posts_by_user_id( &self, user_id: u32, ) -> Result<GetAllPosts, Error>
Get posts by user id
Sourcepub async fn get_post_comments(
&self,
id: u32,
) -> Result<PostCommentsResponse, Error>
pub async fn get_post_comments( &self, id: u32, ) -> Result<PostCommentsResponse, Error>
Get post comments
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_products(&self) -> Result<GetAllProductsResponse, Error>
pub async fn get_all_products(&self) -> Result<GetAllProductsResponse, Error>
Get all products
Sourcepub async fn search_products(
&self,
query: &str,
) -> Result<GetAllProductsResponse, Error>
pub async fn search_products( &self, query: &str, ) -> Result<GetAllProductsResponse, Error>
Search products
Sourcepub async fn limit_and_skip_products(
&self,
limit: u32,
skip: u32,
selects: &str,
) -> Result<GetAllProductsResponse, Error>
pub async fn limit_and_skip_products( &self, limit: u32, skip: u32, selects: &str, ) -> Result<GetAllProductsResponse, Error>
Limit and skip products
Sourcepub async fn sort_products_by(
&self,
field: &str,
order: &str,
) -> Result<GetAllProductsResponse, Error>
pub async fn sort_products_by( &self, field: &str, order: &str, ) -> Result<GetAllProductsResponse, Error>
Sort products by field
Sourcepub async fn get_product_categories(
&self,
) -> Result<Vec<ProductCategory>, Error>
pub async fn get_product_categories( &self, ) -> Result<Vec<ProductCategory>, Error>
Get product categories
Sourcepub async fn get_product_categories_list(&self) -> Result<Vec<String>, Error>
pub async fn get_product_categories_list(&self) -> Result<Vec<String>, Error>
Get product categories list
Sourcepub async fn get_products_by_category(
&self,
category: &str,
) -> Result<GetAllProductsResponse, Error>
pub async fn get_products_by_category( &self, category: &str, ) -> Result<GetAllProductsResponse, Error>
Get products by category
Sourcepub async fn add_product(&self, product: &AddProduct) -> Result<Product, Error>
pub async fn add_product(&self, product: &AddProduct) -> Result<Product, Error>
Add product
Sourcepub async fn update_product(
&self,
id: u32,
product: &AddProduct,
) -> Result<Product, Error>
pub async fn update_product( &self, id: u32, product: &AddProduct, ) -> Result<Product, Error>
Update product
Sourcepub async fn delete_product(
&self,
id: u32,
) -> Result<DeleteProductResponse, Error>
pub async fn delete_product( &self, id: u32, ) -> Result<DeleteProductResponse, Error>
Delete product
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_quotes(&self) -> Result<GetAllQuotes, Error>
pub async fn get_all_quotes(&self) -> Result<GetAllQuotes, Error>
Get all quotes
Sourcepub async fn get_random_quote(&self) -> Result<Quote, Error>
pub async fn get_random_quote(&self) -> Result<Quote, Error>
Get random quote
Sourcepub async fn get_random_quotes(&self, count: u32) -> Result<Vec<Quote>, Error>
pub async fn get_random_quotes(&self, count: u32) -> Result<Vec<Quote>, Error>
Get random quotes
Sourcepub async fn limit_skip_quotes(
&self,
limit: u32,
skip: u32,
) -> Result<GetAllQuotes, Error>
pub async fn limit_skip_quotes( &self, limit: u32, skip: u32, ) -> Result<GetAllQuotes, Error>
Limit and skip quotes
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_recipes(&self) -> Result<GetAllRecipesResponse, Error>
pub async fn get_all_recipes(&self) -> Result<GetAllRecipesResponse, Error>
Get all recipes
Sourcepub async fn search_recipes(
&self,
query: &str,
) -> Result<GetAllRecipesResponse, Error>
pub async fn search_recipes( &self, query: &str, ) -> Result<GetAllRecipesResponse, Error>
Search recipes
Sourcepub async fn limit_and_skip_recipes(
&self,
limit: u32,
skip: u32,
selects: &str,
) -> Result<GetAllRecipesResponse, Error>
pub async fn limit_and_skip_recipes( &self, limit: u32, skip: u32, selects: &str, ) -> Result<GetAllRecipesResponse, Error>
Limit and skip recipes
Sourcepub async fn sort_recipes(
&self,
sort_by: &str,
order: &str,
) -> Result<GetAllRecipesResponse, Error>
pub async fn sort_recipes( &self, sort_by: &str, order: &str, ) -> Result<GetAllRecipesResponse, Error>
Sort recipes
Get recipes tags
Get recipes by tags
Sourcepub async fn get_recipes_by_meal_type(
&self,
meal_type: &str,
) -> Result<GetAllRecipesResponse, Error>
pub async fn get_recipes_by_meal_type( &self, meal_type: &str, ) -> Result<GetAllRecipesResponse, Error>
Get recipes by meal type
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_todos(&self) -> Result<AllTodos, Error>
pub async fn get_all_todos(&self) -> Result<AllTodos, Error>
Get all todos
Sourcepub async fn get_random_todo(&self) -> Result<Todo, Error>
pub async fn get_random_todo(&self) -> Result<Todo, Error>
Get random todo
Sourcepub async fn limit_skip_todos(
&self,
limit: u32,
skip: u32,
) -> Result<AllTodos, Error>
pub async fn limit_skip_todos( &self, limit: u32, skip: u32, ) -> Result<AllTodos, Error>
Limit and skip todos
Sourcepub async fn get_all_todos_of_user(
&self,
user_id: u32,
) -> Result<AllTodos, Error>
pub async fn get_all_todos_of_user( &self, user_id: u32, ) -> Result<AllTodos, Error>
Get all todos of user
Sourcepub async fn add_todo(
&self,
todo: &str,
completed: bool,
user_id: u32,
) -> Result<Todo, Error>
pub async fn add_todo( &self, todo: &str, completed: bool, user_id: u32, ) -> Result<Todo, Error>
Add todo
Sourcepub async fn delete_todo(&self, id: u32) -> Result<DeleteTodoResponse, Error>
pub async fn delete_todo(&self, id: u32) -> Result<DeleteTodoResponse, Error>
Delete todo
Source§impl DummyJsonClient
impl DummyJsonClient
Sourcepub async fn get_all_users(&self) -> Result<GetAllUsersResponse, Error>
pub async fn get_all_users(&self) -> Result<GetAllUsersResponse, Error>
Get all users
Sourcepub async fn login_user(
&self,
username: &str,
password: &str,
expires_in_mins: Option<u32>,
) -> Result<LoginResponse, Error>
pub async fn login_user( &self, username: &str, password: &str, expires_in_mins: Option<u32>, ) -> Result<LoginResponse, Error>
Login User and get tokens
Sourcepub async fn get_current_authenticated_user(
&self,
access_token: &str,
) -> Result<User, Error>
pub async fn get_current_authenticated_user( &self, access_token: &str, ) -> Result<User, Error>
Get current authenticated user
Sourcepub async fn search_users(
&self,
query: &str,
) -> Result<GetAllUsersResponse, Error>
pub async fn search_users( &self, query: &str, ) -> Result<GetAllUsersResponse, Error>
Search users with name
Sourcepub async fn filter_users(
&self,
key: &str,
value: &str,
) -> Result<GetAllUsersResponse, Error>
pub async fn filter_users( &self, key: &str, value: &str, ) -> Result<GetAllUsersResponse, Error>
Filter users by key and value
Sourcepub async fn limit_skip_select_users(
&self,
limit: u32,
skip: u32,
selects: &str,
) -> Result<GetAllUsersResponse, Error>
pub async fn limit_skip_select_users( &self, limit: u32, skip: u32, selects: &str, ) -> Result<GetAllUsersResponse, Error>
Limit, skip and select users
Sourcepub async fn sort_users(
&self,
key: &str,
order: &str,
) -> Result<GetAllUsersResponse, Error>
pub async fn sort_users( &self, key: &str, order: &str, ) -> Result<GetAllUsersResponse, Error>
Sort users by key and order
Sourcepub async fn get_user_carts_by_user_id(
&self,
user_id: u32,
) -> Result<GetAllCartsResponse, Error>
pub async fn get_user_carts_by_user_id( &self, user_id: u32, ) -> Result<GetAllCartsResponse, Error>
Get user carts by user id
Sourcepub async fn get_user_posts_by_user_id(
&self,
user_id: u32,
) -> Result<GetAllPosts, Error>
pub async fn get_user_posts_by_user_id( &self, user_id: u32, ) -> Result<GetAllPosts, Error>
Get user posts by user id
Sourcepub async fn get_user_todos_by_user_id(
&self,
user_id: u32,
) -> Result<AllTodos, Error>
pub async fn get_user_todos_by_user_id( &self, user_id: u32, ) -> Result<AllTodos, Error>
Get user todos by user id
Sourcepub async fn update_user(
&self,
id: u32,
user: &AddUserPayload,
) -> Result<User, Error>
pub async fn update_user( &self, id: u32, user: &AddUserPayload, ) -> Result<User, Error>
Update user
Sourcepub async fn delete_user(&self, id: u32) -> Result<DeleteUserResponse, Error>
pub async fn delete_user(&self, id: u32) -> Result<DeleteUserResponse, Error>
Delete user