Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 81523a9
Showing
89 changed files
with
7,283 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
178 changes: 178 additions & 0 deletions
178
WindowsAzureMobileServices.framework/Headers/MSClient.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
// ---------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
#import "MSError.h" | ||
#import "MSFilter.h" | ||
#import "MSLoginController.h" | ||
|
||
@class MSTable; | ||
@class MSUser; | ||
|
||
|
||
#pragma mark * Block Type Definitions | ||
|
||
// Callback for invokeAPI method that expects a JSON result. | ||
typedef void (^MSAPIBlock)(id result, NSHTTPURLResponse *response, NSError *error); | ||
|
||
// Callback for the invokeAPI method that can return any media type. | ||
typedef void (^MSAPIDataBlock)(NSData *result, | ||
NSHTTPURLResponse *response, | ||
NSError *error); | ||
|
||
|
||
#pragma mark * MSClient Public Interface | ||
|
||
|
||
// The |MSClient| class is the starting point for working with a Windows Azure | ||
// Mobile Service on a client device. An instance of the |MSClient| class is | ||
// created with a URL pointing to a Windows Azure Mobile Service. The |MSClient| | ||
// allows the developer to get |MSTable| instances, which are used to work with | ||
// the data of the Windows Azure Mobile Service, as well as login and logout an | ||
// end user. | ||
@interface MSClient : NSObject <NSCopying> | ||
|
||
|
||
#pragma mark * Public Readonly Properties | ||
|
||
|
||
// The URL of the Windows Azure Mobile Service associated with the client. | ||
@property (nonatomic, strong, readonly) NSURL *applicationURL; | ||
|
||
// The application key for the Windows 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 Windows Azure Mobile Service, allowing the client to perform | ||
// all actions on the windows Azure Mobile Service that require application-key | ||
// level permissions. | ||
@property (nonatomic, copy, readonly) NSString *applicationKey; | ||
|
||
// 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) NSArray *filters; | ||
|
||
#pragma mark * Public ReadWrite Properties | ||
|
||
|
||
// 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) MSUser *currentUser; | ||
|
||
|
||
#pragma mark * Public Static Constructor Methods | ||
|
||
|
||
// Creates a client with the given URL for the Windows Azure Mobile Service. | ||
+(MSClient *)clientWithApplicationURLString:(NSString *)urlString; | ||
|
||
// Creates a client with the given URL and application key for the Windows Azure | ||
// Mobile Service. | ||
+(MSClient *)clientWithApplicationURLString:(NSString *)urlString | ||
applicationKey:(NSString *)key; | ||
|
||
// Old method to create a client with the given URL and application key for the | ||
// Windows Azure Mobile Service. This has been deprecated. Use | ||
// clientWithApplicationURLString:applicationKey: | ||
+(MSClient *)clientWithApplicationURLString:(NSString *)urlString | ||
withApplicationKey:(NSString *)key __deprecated; | ||
|
||
// Creates a client with the given URL for the Windows Azure Mobile Service. | ||
+(MSClient *)clientWithApplicationURL:(NSURL *)url; | ||
|
||
// Creates a client with the given URL and application key for the Windows Azure | ||
// Mobile Service. | ||
+(MSClient *)clientWithApplicationURL:(NSURL *)url | ||
applicationKey:(NSString *)key; | ||
|
||
|
||
#pragma mark * Public Initializer Methods | ||
|
||
|
||
// Intiliazes a client with the given URL for the Windows Azure Mobile Service. | ||
-(id)initWithApplicationURL:(NSURL *)url; | ||
|
||
// Intiliazes a client with the given URL and application key for the Windows | ||
// Azure Mobile Service. | ||
-(id)initWithApplicationURL:(NSURL *)url applicationKey:(NSString *)key; | ||
|
||
|
||
#pragma mark * Public Filter Methods | ||
|
||
|
||
// Creates a clone of the client with the given filter applied to the new client. | ||
-(MSClient *)clientWithFilter:(id<MSFilter>)filter; | ||
|
||
|
||
#pragma mark * Public Login and Logout Methods | ||
|
||
// Logs in the current end user with the given provider by presenting the | ||
// MSLoginController with the given |controller|. | ||
-(void)loginWithProvider:(NSString *)provider | ||
controller:(UIViewController *)controller | ||
animated:(BOOL)animated | ||
completion:(MSClientLoginBlock)completion; | ||
|
||
// Returns an |MSLoginController| that can be used to log in the current | ||
// end user with the given provider. | ||
-(MSLoginController *)loginViewControllerWithProvider:(NSString *)provider | ||
completion:(MSClientLoginBlock)completion; | ||
|
||
// Logs in the current end user with the given provider and the given token for | ||
// the provider. | ||
-(void)loginWithProvider:(NSString *)provider | ||
token:(NSDictionary *)token | ||
completion:(MSClientLoginBlock)completion; | ||
|
||
// Logs out the current end user. | ||
-(void)logout; | ||
|
||
|
||
#pragma mark * Public Table Methods | ||
|
||
|
||
// Returns an |MSTable| instance for a table with the given name. | ||
-(MSTable *)tableWithName:(NSString *)tableName; | ||
|
||
// Old method to return an |MSTable| instance for a table with the given name. | ||
// This has been deprecated. Use tableWithName: | ||
-(MSTable *)getTable:(NSString *)tableName __deprecated; | ||
|
||
|
||
#pragma mark * Public invokeAPI Methods | ||
|
||
// Invokes a user-defined API of the Mobile Service. The HTTP request and | ||
// response content will be treated as JSON. | ||
-(void)invokeAPI:(NSString *)APIName | ||
body:(id)body | ||
HTTPMethod:(NSString *)method | ||
parameters:(NSDictionary *)parameters | ||
headers:(NSDictionary *)headers | ||
completion:(MSAPIBlock)completion; | ||
|
||
// Invokes a user-defined API of the Mobile Service. The HTTP request and | ||
// response content can be of any media type. | ||
-(void)invokeAPI:(NSString *)APIName | ||
data:(NSData *)data | ||
HTTPMethod:(NSString *)method | ||
parameters:(NSDictionary *)parameters | ||
headers:(NSDictionary *)headers | ||
completion:(MSAPIDataBlock)completion; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// ---------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#ifndef WindowsAzureMobileServices_MSError_h | ||
#define WindowsAzureMobileServices_MSError_h | ||
|
||
|
||
#pragma mark * MSErrorDomain | ||
|
||
|
||
// The error domain for the Windows Azure Mobile Service client framework | ||
extern NSString *const MSErrorDomain; | ||
|
||
|
||
#pragma mark * UserInfo Request and Response Keys | ||
|
||
|
||
// The key to use with the |NSError| userInfo dictionary to retrieve the request | ||
// that was sent to the Windows Azure Mobile Service related to the error. Not | ||
// all errors will include the request so the userInfo dicitionary may return | ||
// nil. | ||
extern NSString *const MSErrorRequestKey; | ||
|
||
// The key to use with the |NSError| userInfo dictionary to retrieve the | ||
// response that was returned from the Windows Azure Mobile Service related to | ||
// the error. Not all errors will include the response so the userInfo | ||
// dicitionary may return nil. | ||
extern NSString *const MSErrorResponseKey; | ||
|
||
|
||
#pragma mark * MSErrorCodes | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// a nil item was used. | ||
#define MSExpectedItemWithRequest -1101 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// an item without an id was used | ||
#define MSMissingItemIdWithRequest -1102 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// an invalid item was used. | ||
#define MSInvalidItemWithRequest -1103 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// a nil itemId was used. | ||
#define MSExpectedItemIdWithRequest -1104 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// an invalid itemId was used. | ||
#define MSInvalidItemIdWithRequest -1105 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// an invalid user-parameter in the query string. | ||
#define MSInvalidUserParameterWithRequest -1106 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed because | ||
// an item with an id was used with an insert operation. | ||
#define MSExistingItemIdWithRequest -1107 | ||
|
||
// Indicates that the response from the Windows Azure Mobile Service did not | ||
// inlcude an item as expected. | ||
#define MSExpectedItemWithResponse -1201 | ||
|
||
// Indicates that the response from the Windows Azure Mobile Service did not | ||
// include an array of items as expected. | ||
#define MSExpectedItemsWithResponse -1202 | ||
|
||
// Indicates that the response from the Windows Azure Mobile Service did not | ||
// include a total count as expected. | ||
#define MSExpectedTotalCountWithResponse -1203 | ||
|
||
// Indicates that the response from the Windows Azure Mobile Service did not | ||
// have body content as expected. | ||
#define MSExpectedBodyWithResponse -1204 | ||
|
||
// Indicates that the response from the Windows Azure Mobile Service indicated | ||
// there was an error but that an error message was not provided. | ||
#define MSErrorNoMessageErrorCode -1301 | ||
|
||
// Indicates that the response from the Windows Azure Mobile Service indicated | ||
// there was an error and an error message was provided. | ||
#define MSErrorMessageErrorCode -1302 | ||
|
||
// Indicates that a request to the Windows Azure Mobile Service failed becaus | ||
// the |NSPredicate| used in the query could not be translated into a query | ||
// string supported by the Windows Azure Mobile Service. | ||
#define MSPredicateNotSupported -1400 | ||
|
||
// Indicates that the login operation has failed. | ||
#define MSLoginFailed -1501 | ||
|
||
// Indicates that the Windows Azure Mobile Service returned a login response | ||
// with invalid syntax. | ||
#define MSLoginInvalidResponseSyntax -1502 | ||
|
||
// Indicates that the login operation was canceled. | ||
#define MSLoginCanceled -1503 | ||
|
||
// Indicates that the login operation failed because a nil token was used. | ||
#define MSLoginExpectedToken -1504 | ||
|
||
// Indicates that the login operation failed because an invalid token was used. | ||
#define MSLoginInvalidToken -1505 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// ---------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "MSError.h" | ||
|
||
|
||
#pragma mark * Block Type Definitions | ||
|
||
|
||
// Callback that the filter should invoke once an HTTP response (with or | ||
// without data) or an error has been received by the filter. | ||
typedef void (^MSFilterResponseBlock)(NSHTTPURLResponse *response, NSData *data, NSError *error); | ||
|
||
// Callback that the filter should invoke to allow the next filter to handle | ||
// the given request. | ||
typedef void (^MSFilterNextBlock)(NSURLRequest *request, | ||
MSFilterResponseBlock onResponse); | ||
|
||
|
||
#pragma mark * MSFilter Public Protocol | ||
|
||
|
||
// The |MSFilter| protocol allows developers to implement a class that can | ||
// inspect and/or replace HTTP request and HTTP response messages being sent | ||
// and received by an |MSClient| instance. | ||
@protocol MSFilter <NSObject> | ||
|
||
-(void)handleRequest:(NSURLRequest *)request | ||
next:(MSFilterNextBlock)next | ||
response:(MSFilterResponseBlock)response; | ||
@end |
Oops, something went wrong.