@maxim_mazurok/gapi.client.playcustomapp-v1 0.0.20220811

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,110 @@
1
+ /* Type definitions for non-npm package Google Play Custom App Publishing API v1 0.0 */
2
+ // Project: https://developers.google.com/android/work/play/custom-app-api/
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://playcustomapp.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220811
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Google Play Custom App Publishing API v1 */
19
+ function load(urlOrObject: "https://playcustomapp.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "playcustomapp", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "playcustomapp", version: "v1", callback: () => any): void;
24
+
25
+ namespace playcustomapp {
26
+ interface CustomApp {
27
+ /** Default listing language in BCP 47 format. */
28
+ languageCode?: string;
29
+ /**
30
+ * Organizations to which the custom app should be made available. If the request contains any organizations, then the app will be restricted to only these organizations. To support
31
+ * the organization linked to the developer account, the organization ID should be provided explicitly together with other organizations. If no organizations are provided, then the app
32
+ * is only available to the organization linked to the developer account.
33
+ */
34
+ organizations?: Organization[];
35
+ /** Output only. Package name of the created Android app. Only present in the API response. */
36
+ packageName?: string;
37
+ /** Title for the Android app. */
38
+ title?: string;
39
+ }
40
+ interface Organization {
41
+ /** Required. ID of the organization. */
42
+ organizationId?: string;
43
+ /** Optional. A human-readable name of the organization, to help recognize the organization. */
44
+ organizationName?: string;
45
+ }
46
+ interface CustomAppsResource {
47
+ /** Creates a new custom app. */
48
+ create(request: {
49
+ /** V1 error format. */
50
+ "$.xgafv"?: string;
51
+ /** OAuth access token. */
52
+ access_token?: string;
53
+ /** Developer account ID. */
54
+ account: string;
55
+ /** Data format for response. */
56
+ alt?: string;
57
+ /** JSONP */
58
+ callback?: string;
59
+ /** Selector specifying which fields to include in a partial response. */
60
+ fields?: string;
61
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
62
+ key?: string;
63
+ /** OAuth 2.0 token for the current user. */
64
+ oauth_token?: string;
65
+ /** Returns response with indentations and line breaks. */
66
+ prettyPrint?: boolean;
67
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
68
+ quotaUser?: string;
69
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
70
+ upload_protocol?: string;
71
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
72
+ uploadType?: string;
73
+ /** Request body */
74
+ resource: CustomApp;
75
+ }): Request<CustomApp>;
76
+ create(request: {
77
+ /** V1 error format. */
78
+ "$.xgafv"?: string;
79
+ /** OAuth access token. */
80
+ access_token?: string;
81
+ /** Developer account ID. */
82
+ account: string;
83
+ /** Data format for response. */
84
+ alt?: string;
85
+ /** JSONP */
86
+ callback?: string;
87
+ /** Selector specifying which fields to include in a partial response. */
88
+ fields?: string;
89
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
90
+ key?: string;
91
+ /** OAuth 2.0 token for the current user. */
92
+ oauth_token?: string;
93
+ /** Returns response with indentations and line breaks. */
94
+ prettyPrint?: boolean;
95
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
96
+ quotaUser?: string;
97
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
98
+ upload_protocol?: string;
99
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
100
+ uploadType?: string;
101
+ },
102
+ body: CustomApp): Request<CustomApp>;
103
+ }
104
+ interface AccountsResource {
105
+ customApps: CustomAppsResource;
106
+ }
107
+
108
+ const accounts: AccountsResource;
109
+ }
110
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.playcustomapp-v1",
3
+ "version": "0.0.20220811",
4
+ "description": "TypeScript typings for Google Play Custom App Publishing API v1",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,68 @@
1
+ # TypeScript typings for Google Play Custom App Publishing API v1
2
+
3
+ API to create and publish custom Android apps
4
+ For detailed description please check [documentation](https://developers.google.com/android/work/play/custom-app-api/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Google Play Custom App Publishing API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.playcustomapp-v1 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://playcustomapp.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.playcustomapp
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('playcustomapp', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.playcustomapp
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // View and manage your Google Play Developer account
49
+ 'https://www.googleapis.com/auth/androidpublisher',
50
+ ],
51
+ immediate = true;
52
+ // ...
53
+
54
+ gapi.auth.authorize(
55
+ { client_id: client_id, scope: scope, immediate: immediate },
56
+ authResult => {
57
+ if (authResult && !authResult.error) {
58
+ /* handle successful authorization */
59
+ } else {
60
+ /* handle authorization error */
61
+ }
62
+ });
63
+ ```
64
+
65
+ After that you can use Google Play Custom App Publishing API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,47 @@
1
+ /* This is stub file for gapi.client.playcustomapp-v1 definition tests */
2
+ // IMPORTANT
3
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
+
6
+ // Revision: 20220811
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://playcustomapp.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.playcustomapp */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** View and manage your Google Play Developer account */
19
+ 'https://www.googleapis.com/auth/androidpublisher',
20
+ ];
21
+ const immediate = false;
22
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
23
+ if (authResult && !authResult.error) {
24
+ /** handle successful authorization */
25
+ run();
26
+ } else {
27
+ /** handle authorization error */
28
+ }
29
+ });
30
+
31
+ async function run() {
32
+ /** Creates a new custom app. */
33
+ await gapi.client.playcustomapp.accounts.customApps.create({
34
+ account: "Test string",
35
+ }, {
36
+ languageCode: "Test string",
37
+ organizations: [
38
+ {
39
+ organizationId: "Test string",
40
+ organizationName: "Test string",
41
+ }
42
+ ],
43
+ packageName: "Test string",
44
+ title: "Test string",
45
+ });
46
+ }
47
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6", "dom"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictNullChecks": true,
8
+ "baseUrl": "../",
9
+ "typeRoots": [
10
+ "../"
11
+ ],
12
+ "types": [],
13
+ "noEmit": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strictFunctionTypes": true
16
+ },
17
+ "files": ["index.d.ts", "tests.ts"]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }