MSClient Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in MSClient.h

Overview

The MSClient class is the starting point for working with a Microsoft Azure Mobile Service on a client device. An instance of the MSClient class is created with a URL pointing to a Microsoft Azure Mobile Service. The MSClient allows the developer to get MSTable instances, which are used to work with the data of the Microsoft Azure Mobile Service, as well as login and logout an end user.

Properties

  applicationURL

The URL of the Microsoft Azure Mobile App

@property (nonatomic, strong, readonly, nonnull) NSURL *applicationURL

Discussion

The URL of the Microsoft Azure Mobile App

Declared In

MSClient.h

  gatewayURL

The URL of the gateway associated with the mobile app

@property (nonatomic, strong, readonly, nullable) NSURL *gatewayURL

Discussion

The URL of the gateway associated with the mobile app

Declared In

MSClient.h

  applicationKey

The application key for the Microsoft Azure Mobile Service associated with the client if one was provided in the creation of the client and nil otherwise. If non-nil, the application key will be included in all requests made to the Microsoft Azure Mobile Service, allowing the client to perform all actions on the Microsoft Azure Mobile Service that require application-key level permissions.

@property (nonatomic, copy, readonly, nullable) NSString *applicationKey

Discussion

The application key for the Microsoft Azure Mobile Service associated with the client if one was provided in the creation of the client and nil otherwise. If non-nil, the application key will be included in all requests made to the Microsoft Azure Mobile Service, allowing the client to perform all actions on the Microsoft Azure Mobile Service that require application-key level permissions.

Declared In

MSClient.h

  filters

A collection of MSFilter instances to apply to use with the requests and responses sent and received by the client. The property is readonly and the array is not-mutable. To apply a filter to a client, use the withFilter: method.

@property (nonatomic, strong, readonly, nullable) NSArray *filters

Discussion

A collection of MSFilter instances to apply to use with the requests and responses sent and received by the client. The property is readonly and the array is not-mutable. To apply a filter to a client, use the withFilter: method.

Declared In

MSClient.h

  syncContext

A sync context that defines how offline data is synced and allows for manually syncing data on demand

@property (nonatomic, strong, nullable) MSSyncContext *syncContext

Discussion

A sync context that defines how offline data is synced and allows for manually syncing data on demand

Declared In

MSClient.h

Registering and unregistering for push notifications

  push

The property to use for registering and unregistering for notifications via MSPush.

@property (nonatomic, strong, readonly, nullable) MSPush *push

Discussion

The property to use for registering and unregistering for notifications via MSPush.

Declared In

MSClient.h

  currentUser

The currently logged in user. While the currentUser property can be set directly, the login* and logout methods are more convenient and recommended for non-testing use.

@property (nonatomic, strong, nullable) MSUser *currentUser

Discussion

The currently logged in user. While the currentUser property can be set directly, the login* and logout methods are more convenient and recommended for non-testing use.

Declared In

MSClient.h

Initializing the MSClient Object

+ clientWithApplicationURLString:

Creates a client with the given URL for the Microsoft Azure Mobile Service.

+ (nonnull MSClient *)clientWithApplicationURLString:(nonnull NSString *)urlString

Discussion

Creates a client with the given URL for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURLString:applicationKey:

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

+ (nonnull MSClient *)clientWithApplicationURLString:(nonnull NSString *)urlString applicationKey:(nullable NSString *)key

Discussion

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURLString:gatewayURLString:applicationKey:

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

+ (nonnull MSClient *)clientWithApplicationURLString:(nonnull NSString *)applicationUrlString gatewayURLString:(nullable NSString *)gatewayUrlString applicationKey:(nullable NSString *)key

Discussion

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURL:

Creates a client with the given URL for the Microsoft Azure Mobile Service.

+ (nonnull MSClient *)clientWithApplicationURL:(nonnull NSURL *)url

Discussion

Creates a client with the given URL for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURL:applicationKey:

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

+ (nonnull MSClient *)clientWithApplicationURL:(nonnull NSURL *)url applicationKey:(nullable NSString *)key

Discussion

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURL:gatewayURL:applicationKey:

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

+ (nonnull MSClient *)clientWithApplicationURL:(nonnull NSURL *)applicationUrl gatewayURL:(nullable NSURL *)gatewayUrl applicationKey:(nullable NSString *)key

Discussion

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

– initWithApplicationURL:

Initializes a client with the given URL for the Microsoft Azure Mobile Service.

- (nonnull instancetype)initWithApplicationURL:(nonnull NSURL *)url

Discussion

Initializes a client with the given URL for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

– initWithApplicationURL:applicationKey:

Initializes a client with the given URL and application key for the Windows Azure Mobile Service.

- (nonnull instancetype)initWithApplicationURL:(nonnull NSURL *)url applicationKey:(nullable NSString *)key

Discussion

Initializes a client with the given URL and application key for the Windows Azure Mobile Service.

Declared In

MSClient.h

– initWithApplicationURL:gatewayURL:applicationKey:

Initializes a client with the given URL and application key for the Windows Azure Mobile Service.

- (nonnull instancetype)initWithApplicationURL:(nonnull NSURL *)applicationUrl gatewayURL:(nullable NSURL *)gatewayUrl applicationKey:(nullable NSString *)key

Discussion

Initializes a client with the given URL and application key for the Windows Azure Mobile Service.

Declared In

MSClient.h

– clientWithFilter:

Creates a clone of the client with the given filter applied to the new client.

- (nonnull MSClient *)clientWithFilter:(nonnull id<MSFilter>)filter

Discussion

Creates a clone of the client with the given filter applied to the new client.

Declared In

MSClient.h

– loginWithProvider:controller:animated:completion:

Logs in the current end user with the given provider by presenting the MSLoginController with the given controller.

- (void)loginWithProvider:(nonnull NSString *)provider controller:(nonnull UIViewController *)controller animated:(BOOL)animated completion:(nullable MSClientLoginBlock)completion

Discussion

Logs in the current end user with the given provider by presenting the MSLoginController with the given controller.

Declared In

MSClient.h

– loginViewControllerWithProvider:completion:

Returns an MSLoginController that can be used to log in the current end user with the given provider.

- (nonnull MSLoginController *)loginViewControllerWithProvider:(nonnull NSString *)provider completion:(nullable MSClientLoginBlock)completion

Discussion

Returns an MSLoginController that can be used to log in the current end user with the given provider.

Declared In

MSClient.h

– loginWithProvider:token:completion:

Logs in the current end user with the given provider and the given token for the provider.

- (void)loginWithProvider:(nonnull NSString *)provider token:(nonnull NSDictionary *)token completion:(nullable MSClientLoginBlock)completion

Discussion

Logs in the current end user with the given provider and the given token for the provider.

Declared In

MSClient.h

– logout

Logs out the current end user.

- (void)logout

Discussion

Logs out the current end user.

Declared In

MSClient.h

Querying Tables

– tableWithName:

Returns an MSTable instance for a table with the given name.

- (nonnull MSTable *)tableWithName:(nonnull NSString *)tableName

Discussion

Returns an MSTable instance for a table with the given name.

Declared In

MSClient.h

– syncTableWithName:

Returns an MSSyncTable instance for a table with the given name.

- (nonnull MSSyncTable *)syncTableWithName:(nonnull NSString *)tableName

Discussion

Returns an MSSyncTable instance for a table with the given name.

Declared In

MSClient.h

Invoking Custom APIs

– invokeAPI:body:HTTPMethod:parameters:headers:completion:

Invokes a user-defined API of the Mobile Service. The HTTP request and response content will be treated as JSON.

- (void)invokeAPI:(nonnull NSString *)APIName body:(nullable id)body HTTPMethod:(nullable NSString *)method parameters:(nullable NSDictionary *)parameters headers:(nullable NSDictionary *)headers completion:(nullable MSAPIBlock)completion

Discussion

Invokes a user-defined API of the Mobile Service. The HTTP request and response content will be treated as JSON.

Declared In

MSClient.h

– invokeAPI:data:HTTPMethod:parameters:headers:completion:

Invokes a user-defined API of the Mobile Service. The HTTP request and response content can be of any media type.

- (void)invokeAPI:(nonnull NSString *)APIName data:(nullable NSData *)data HTTPMethod:(nullable NSString *)method parameters:(nullable NSDictionary *)parameters headers:(nullable NSDictionary *)headers completion:(nullable MSAPIDataBlock)completion

Discussion

Invokes a user-defined API of the Mobile Service. The HTTP request and response content can be of any media type.

Declared In

MSClient.h

Controlling connections to the server

  connectionDelegateQueue

Determines where connections made to the mobile service are run. If set, connection related logic will occur on this queue. Otherwise, the thread that made the call will be used.

@property (nonatomic, strong, nullable) NSOperationQueue *connectionDelegateQueue

Discussion

Determines where connections made to the mobile service are run. If set, connection related logic will occur on this queue. Otherwise, the thread that made the call will be used.

Declared In

MSClient.h