ProductsAPI
public enum ProductsAPI
Caseless enumeration with static methods to send Product Requests
-
Sends a request to retrieve all products under a specified category.
Declaration
Swift
public static func getProducts(category: String, with parameters: Parameters? = nil, completion: ResponseCompletion<[Product]> = nil)
Parameters
category
Specified category.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get all product categories.
Declaration
Swift
public static func getCategories(completion: ResponseCompletion<[Product.Category]> = nil)
Parameters
completion
The closure to be executed once the request has finished.
-
Sends a request to get a the whole product object.
Declaration
Swift
public static func loadProductComponents(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Product> = nil)
Parameters
id
ID of the product.
completion
The closure to be executed once the request has finished.
-
Sends a request to get prepare client’s token.
Declaration
Swift
public static func prepareClientToken(completion: ResponseCompletion<String> = nil)
Parameters
completion
The closure to be executed once the request has finished.
-
Sends a request to get orders.
Declaration
Swift
public static func getOrders(with parameters: Parameters? = nil, completion: ResponseCompletion<[Order]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Declaration
Swift
public static func getOrder(with id: Int, parameters: Parameters? = nil, completion: ResponseCompletion<Order> = nil)
Parameters
id
ID of the order.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.