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>) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Return all instances of type
Customer
byid
- 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Update a
Customer
- customer: The
UpdateCustomer
data object to update thisCustomer
with.- completionHandler: The handler to be called on success or failure
Declaration
Swift
@discardableResult public func update(_ customer: UpdateCustomer, completionHandler: @escaping DefaultObjectRequestHandler) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. - customer: The
-
Return all instances of
Address
for 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Get a specific
Address
for aCustomer
- withID: The
Address
ID- forCustomer: The
Customer
ID- 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. - withID: The
-
Create an
Address
for aCustomer
- address: The
Address
object to create- forCustomer: The
Customer
ID 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. - address: The
-
Update an
Address
for aCustomer
- address: The
Address
object to create- forCustomer: The
Customer
ID to associate this address with- completionHandler: The handler to be called on success or failure
Ensure the
Address
contains the ID for theAddress
that 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request. - address: The
-
Delete an
Address
for aCustomer
- withID: The address ID
- forCustomer: The
Customer
ID to associate this address with- completionHandler: The handler to be called on success or failure
Ensure the
Address
contains the ID for theAddress
that 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) -> MoltinRequest
Return Value
A instance of
MoltinRequest
which encapsulates the request.