From a188319382a5d3cbb4a47b2496254a8103eb5e83 Mon Sep 17 00:00:00 2001 From: Jasper Siegmund Date: Tue, 21 Jun 2016 15:55:57 +0200 Subject: [PATCH 1/4] Added missing mobileServiceAuthenticationToken for User, Push interface with methods and changed the signature of invokeApi. --- .../AzureMobileServicesClient.d.ts | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index b9749002c9..63c9ee454b 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -1,3 +1,5 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/azure-mobile-services-client/AzureMobileServicesClient.d.ts // Type definitions for Microsoft Windows AzureMobile Service 1.0.0 // Project: http://www.windowsazure.com/en-us/develop/mobile/ // Definitions by: Morosinotto Daniele @@ -7,10 +9,12 @@ declare namespace Microsoft.WindowsAzure { // MobileServiceClient object based on Microsoft Azure documentation: http://msdn.microsoft.com/en-us/library/windowsazure/jj554219.aspx interface MobileServiceClient { + new (applicationUrl: string): MobileServiceClient; new (applicationUrl: string, applicationKey: string): MobileServiceClient; applicationUrl: string; applicationKey: string; currentUser: User; + push: Push; //for provider:string use one of ProviderEnum: 'microsoftaccount', 'facebook', 'twitter', 'google' login(provider: string, token: string, callback: (error: any, user: User) => void ): void; login(provider: string, token: string): asyncPromise; @@ -18,8 +22,40 @@ declare namespace Microsoft.WindowsAzure { login(provider: string): asyncPromise; logout(): void; getTable(tableName: string): MobileServiceTable; - withFilter(serviceFilter: (request: any, next: (request: any, callback: (error:any, response: any) => void ) => void, callback: (error: any, response: any) => void ) => void ) : MobileServiceClient; - invokeApi(apiName: string, options?:InvokeApiOptions): asyncPromise; + withFilter(serviceFilter: (request: any, next: (request: any, callback: (error: any, response: any) => void) => void, callback: (error: any, response: any) => void) => void): MobileServiceClient; + /** + * Invokes the specified custom api and returns a response object. + * + * @param apiName The custom api to invoke. + * @param options Contains additional parameter information, valid values are: + * body: The body of the HTTP request. + * method: The HTTP method to use in the request, with the default being POST, + * parameters: Any additional query string parameters, + * headers: HTTP request headers, specified as an object. + * @param callback Optional callback accepting (error, results) parameters. + */ + invokeApi(apiName: string, options: InvokeApiOptions, callback: (error: any, results: any) => void): asyncPromise; + } + + interface Push + { + /** + * Register a push channel with the Mobile Apps backend to start receiving notifications. + * + * @param platform The device platform being used - wns, gcm or apns. + * @param pushChannel The push channel identifier or URI. + * @param templates An object containing template definitions. Template objects should contain body, headers and tags properties. + * @param secondaryTiles An object containing template definitions to be used with secondary tiles when using WNS. + * @param callback Optional callback accepting (error, results) parameters. + */ + register(platform: string, pushChannel: string, templates: any, secondaryTiles: any, callback: (error: any, results: any) => void); + /** + * Invokes the specified custom api and returns a response object. + * + * @param pushChannel The push channel identifier or URI. + * @param callback Optional callback accepting (error, results) parameters. + */ + unregister(pushChannel: string, callback: (error: any, results: any) => void); } interface InvokeApiOptions @@ -36,6 +72,7 @@ declare namespace Microsoft.WindowsAzure { accessTokens: any; // { [providerName: string]: string; } level: string; //for level:string use one of LevelEnum: 'admin','anonymous','authenticated' userId: string; + mobileServiceAuthenticationToken: string; } @@ -104,4 +141,4 @@ declare module "azure-mobile-apps-client" { export = WindowsAzure; } -declare var WindowsAzure: Microsoft.WindowsAzure.WindowsAzureStatic; +declare var WindowsAzure: Microsoft.WindowsAzure.WindowsAzureStatic; \ No newline at end of file From 242eb155fc2681692952269fa71b89f5a4aab116 Mon Sep 17 00:00:00 2001 From: Jasper Siegmund Date: Tue, 21 Jun 2016 16:12:27 +0200 Subject: [PATCH 2/4] Added return types to avoid implicit any --- azure-mobile-services-client/AzureMobileServicesClient.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index 63c9ee454b..d401b4d1bc 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -48,14 +48,14 @@ declare namespace Microsoft.WindowsAzure { * @param secondaryTiles An object containing template definitions to be used with secondary tiles when using WNS. * @param callback Optional callback accepting (error, results) parameters. */ - register(platform: string, pushChannel: string, templates: any, secondaryTiles: any, callback: (error: any, results: any) => void); + register(platform: string, pushChannel: string, templates: any, secondaryTiles: any, callback: (error: any, results: any) => void): void; /** * Invokes the specified custom api and returns a response object. * * @param pushChannel The push channel identifier or URI. * @param callback Optional callback accepting (error, results) parameters. */ - unregister(pushChannel: string, callback: (error: any, results: any) => void); + unregister(pushChannel: string, callback: (error: any, results: any) => void): void; } interface InvokeApiOptions From 3d765c8f812d6863a310df186665f4086bb6ee9d Mon Sep 17 00:00:00 2001 From: Jasper Siegmund Date: Wed, 22 Jun 2016 08:39:33 +0200 Subject: [PATCH 3/4] Changed some of the parameters to optional As per comment / instructions, I've changed the parameters to optionals. --- .../AzureMobileServicesClient.d.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index d401b4d1bc..707e7222d8 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -9,8 +9,7 @@ declare namespace Microsoft.WindowsAzure { // MobileServiceClient object based on Microsoft Azure documentation: http://msdn.microsoft.com/en-us/library/windowsazure/jj554219.aspx interface MobileServiceClient { - new (applicationUrl: string): MobileServiceClient; - new (applicationUrl: string, applicationKey: string): MobileServiceClient; + new (applicationUrl: string, applicationKey?: string): MobileServiceClient; applicationUrl: string; applicationKey: string; currentUser: User; @@ -34,7 +33,7 @@ declare namespace Microsoft.WindowsAzure { * headers: HTTP request headers, specified as an object. * @param callback Optional callback accepting (error, results) parameters. */ - invokeApi(apiName: string, options: InvokeApiOptions, callback: (error: any, results: any) => void): asyncPromise; + invokeApi(apiName: string, options?: InvokeApiOptions, callback?: (error: any, results: any) => void): asyncPromise; } interface Push @@ -48,14 +47,14 @@ declare namespace Microsoft.WindowsAzure { * @param secondaryTiles An object containing template definitions to be used with secondary tiles when using WNS. * @param callback Optional callback accepting (error, results) parameters. */ - register(platform: string, pushChannel: string, templates: any, secondaryTiles: any, callback: (error: any, results: any) => void): void; + register(platform: string, pushChannel: string, templates?: any, secondaryTiles?: any, callback?: (error: any, results: any) => void): void; /** * Invokes the specified custom api and returns a response object. * * @param pushChannel The push channel identifier or URI. * @param callback Optional callback accepting (error, results) parameters. */ - unregister(pushChannel: string, callback: (error: any, results: any) => void): void; + unregister(pushChannel: string, callback?: (error: any, results: any) => void): void; } interface InvokeApiOptions @@ -141,4 +140,4 @@ declare module "azure-mobile-apps-client" { export = WindowsAzure; } -declare var WindowsAzure: Microsoft.WindowsAzure.WindowsAzureStatic; \ No newline at end of file +declare var WindowsAzure: Microsoft.WindowsAzure.WindowsAzureStatic; From c17014144b0b6449e54a035f6c17377f46178c81 Mon Sep 17 00:00:00 2001 From: Jasper Siegmund Date: Thu, 23 Jun 2016 08:59:30 +0200 Subject: [PATCH 4/4] Removed comments added by typings --- azure-mobile-services-client/AzureMobileServicesClient.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index 707e7222d8..afd6014598 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -1,5 +1,3 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/azure-mobile-services-client/AzureMobileServicesClient.d.ts // Type definitions for Microsoft Windows AzureMobile Service 1.0.0 // Project: http://www.windowsazure.com/en-us/develop/mobile/ // Definitions by: Morosinotto Daniele