CustomerRequest
public class CustomerRequest : MoltinRequest
An entry point to make API calls relating to Customer and related items
-
The API endpoint for this resource.
Declaration
Swift
public var endpoint: String -
A typealias which allows automatic casting of a collection to
[Customer].Declaration
Swift
public typealias DefaultCollectionRequestHandler = CollectionRequestHandler<[Customer]> -
A typealias which allows automatic casting of an object to
Customer.Declaration
Swift
public typealias DefaultObjectRequestHandler = ObjectRequestHandler<Customer> -
A typealias which allows automatic casting of a collection to
[Address].Declaration
Swift
public typealias DefaultAddressCollectionRequestHandler = CollectionRequestHandler<[Address]> -
A typealias which allows automatic casting of an object to
Address.Declaration
Swift
public typealias DefaultAddressObjectRequestHandler = ObjectRequestHandler<Address> -
Get a token for a
Customer- withEmail: The email for the customer
- withPassword: The password for the customer
- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func getToken(withEmail email: String, withPassword password: String, completionHandler: @escaping ObjectRequestHandler<CustomerToken>) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. -
Return all instances of type
Customer- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func all(completionHandler: @escaping DefaultCollectionRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. -
Return all instances of type
Customerbyid- forID: The ID of the object
- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func get(forID id: String, completionHandler: @escaping DefaultObjectRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. -
Update a
Customer- customer: The
UpdateCustomerdata object to update thisCustomerwith.- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func update(_ customer: UpdateCustomer, completionHandler: @escaping DefaultObjectRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. - customer: The
-
Return all instances of
Addressfor aCustomer- forCustomer: The customer ID
- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func addresses(forCustomer customer: String, completionHandler: @escaping DefaultAddressCollectionRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. -
Get a specific
Addressfor aCustomer- withID: The
AddressID- forCustomer: The
CustomerID- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func getAddress(withID id: String, forCustomer customer: String, completionHandler: @escaping DefaultAddressObjectRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. - withID: The
-
Create an
Addressfor aCustomer- address: The
Addressobject to create- forCustomer: The
CustomerID to associate this address with- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func createAddress(_ address: Address, forCustomer customer: String, completionHandler: @escaping DefaultAddressObjectRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. - address: The
-
Update an
Addressfor aCustomer- address: The
Addressobject to create- forCustomer: The
CustomerID to associate this address with- completionHandler: The handler to be called on success or failure
Ensure the
Addresscontains the ID for theAddressthat you wish to create, and then fill in any variables you want to update in the request.Declaration
Swift
@discardableResult public func updateAddress(_ address: Address, forCustomer customer: String, completionHandler: @escaping DefaultAddressObjectRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request. - address: The
-
Delete an
Addressfor aCustomer- withID: The address ID
- forCustomer: The
CustomerID to associate this address with- completionHandler: The handler to be called on success or failure
Ensure the
Addresscontains the ID for theAddressthat you wish to create, and then fill in any variables you want to update in the request.Declaration
Swift
@discardableResult public func deleteAddress(withID id: String, forCustomer customer: String, completionHandler: @escaping DefaultAddressObjectRequestHandler) -> MoltinRequestReturn Value
A instance of
MoltinRequestwhich encapsulates the request.
View on GitHub
CustomerRequest Class Reference