Step 1: Add MojioSDK as a pod to your Podfile
pod 'MojioSDK'
Step 2: Install or update your Pods
pod install or pod update
import MojioSDK
self.authClient = MojioSDK.AuthClient.init(clientId: <CLIENT_ID>, clientSecretKey: <CLIENT_SECRET>, clientRedirectURI: <CLIENT_REDIRECT_URI>)
self.restClient : RestClient = RestClient.init(clientEnvironment: ClientEnvironment.SharedInstance)
import "MojioSDK-Swift.h"
self.authClient = [[AuthClient alloc] initWithClientId:<CLIENT_ID> clientSecretKey:<CLIENT_SECRET> clientRedirectURI:<CLIENT_REDIRECT_URI>];
self.restClient = [[RestClient alloc] initWithClientEnvironment:[ClientEnvironment SharedInstance]];1
self.authClient.login({
// Callback is executed once the user is logged in
}]);
self.authClient.logout()
[self.authClient login:^{
// Block is executed once the user is logged in
}];
[self.authClient logout];
self.restClient.get().vehicles().query(top: <TOP_OFFSET>, skip: <SKIP_COUNT>, filter: <FILTER>, select: <SELECT>, orderby: <ORDER-BY>).run(
{
response in
// Executed when the data is successfully fetched
}, failure:
{
error in
// Executed if there was an error in trying to retrieve data
}
)
[[restClient get] vehicles:nil] query:<TOP_OFFSET> skip:<SKIP_COUNT> filter:<FILTER> select:<SELECT> orderby:<ORDER-BY>] run:^(id response) {
// Executed when the data is successfully fetched
} failure:^(NSString * error) {
// Executed if there was an error in trying to retrieve data
}];
self.restClient.get().vehicles(<VEHICLE_ID>).run(
{
response in
// Executed when the data is successfully fetched
}, failure:
{
error in
// Executed if there was an error in trying to retrieve data
}
)
[[restClient get] vehicles:<VEHICLE_ID>] run:^(id response) {
// Executed when the data is successfully fetched
} failure:^(NSString * error) {
// Executed if there was an error in trying to retrieve data
}];
self.restClient.put().vehicles(<VEHICLE_ID>).run(vehicle.json(), completion:
{
response in
// Executed when the data is successfully fetched
}, failure:
{
error in
// Executed if there was an error in trying to retrieve data
}
)
[[restClient put] vehicles:<VEHICLE_ID>] run:vehicle.json(), completion:^(id response) {
// Executed when the data is successfully fetched
} failure:^(NSString * error) {
// Executed if there was an error in trying to retrieve data
}];
self.restClient.delete().vehicles(<VEHICLE_ID>).run(
{
response in
// Executed when the data is successfully fetched
}, failure:
{
error in
// Executed if there was an error in trying to retrieve data
}
)
[[restClient delete] vehicles:<VEHICLE_ID>] run:^(id response) {
// Executed when the data is successfully fetched
} failure:^(NSString * error) {
// Executed if there was an error in trying to retrieve data
}];