@maxim_mazurok/gapi.client.appsmarket-v2 0.0.20251217
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 +134 -0
- package/package.json +20 -0
- package/readme.md +89 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Google Workspace Marketplace API v2 0.0 */
|
|
2
|
+
// Project: https://developers.google.com/workspace/marketplace
|
|
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
|
+
|
|
8
|
+
// IMPORTANT
|
|
9
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
10
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
11
|
+
// Generated from: https://appsmarket.googleapis.com/$discovery/rest?version=v2
|
|
12
|
+
// Revision: 20251217
|
|
13
|
+
|
|
14
|
+
/// <reference types="gapi.client" />
|
|
15
|
+
|
|
16
|
+
declare namespace gapi.client {
|
|
17
|
+
/** Load Google Workspace Marketplace API v2 */
|
|
18
|
+
function load(
|
|
19
|
+
urlOrObject: 'https://appsmarket.googleapis.com/$discovery/rest?version=v2',
|
|
20
|
+
): Promise<void>;
|
|
21
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
22
|
+
function load(name: 'appsmarket', version: 'v2'): Promise<void>;
|
|
23
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
24
|
+
function load(name: 'appsmarket', version: 'v2', callback: () => any): void;
|
|
25
|
+
|
|
26
|
+
namespace appsmarket {
|
|
27
|
+
interface CustomerLicense {
|
|
28
|
+
/** The ID of the application corresponding to this license query. */
|
|
29
|
+
applicationId?: string;
|
|
30
|
+
/** The domain name of the customer. */
|
|
31
|
+
customerId?: string;
|
|
32
|
+
/** (Deprecated) */
|
|
33
|
+
editions?: Editions[];
|
|
34
|
+
/** The ID of the customer license. */
|
|
35
|
+
id?: string;
|
|
36
|
+
/** The type of API resource. This is always appsmarket#customerLicense. */
|
|
37
|
+
kind?: string;
|
|
38
|
+
/** The customer's license status. One of: - `ACTIVE`: The customer has a valid license. - `UNLICENSED`: There is no license: either this customer has never installed your application, or else has deleted it. */
|
|
39
|
+
state?: string;
|
|
40
|
+
}
|
|
41
|
+
interface Editions {
|
|
42
|
+
/** (Deprecated) */
|
|
43
|
+
assignedSeats?: number;
|
|
44
|
+
/** (Deprecated) */
|
|
45
|
+
editionId?: string;
|
|
46
|
+
/** (Deprecated) */
|
|
47
|
+
seatCount?: number;
|
|
48
|
+
}
|
|
49
|
+
interface UserLicense {
|
|
50
|
+
/** The ID of the application corresponding to the license query. */
|
|
51
|
+
applicationId?: string;
|
|
52
|
+
/** The domain name of the user. */
|
|
53
|
+
customerId?: string;
|
|
54
|
+
/** (Deprecated) */
|
|
55
|
+
editionId?: string;
|
|
56
|
+
/** The domain administrator has activated the application for this domain. */
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
/** The ID of user license. */
|
|
59
|
+
id?: string;
|
|
60
|
+
/** The type of API resource. This is always appsmarket#userLicense. */
|
|
61
|
+
kind?: string;
|
|
62
|
+
/** The user's licensing status. One of: - `ACTIVE`: The user has a valid license and should be permitted to use the application. - `UNLICENSED`: The administrator of this user's domain never assigned a seat for the application to this user. - `EXPIRED`: The administrator assigned a seat to this user, but the license is expired. */
|
|
63
|
+
state?: string;
|
|
64
|
+
/** The email address of the user. */
|
|
65
|
+
userId?: string;
|
|
66
|
+
}
|
|
67
|
+
interface CustomerLicenseResource {
|
|
68
|
+
/** Gets the status of a license for a customer to determine if they have access for a given app. */
|
|
69
|
+
get(request?: {
|
|
70
|
+
/** V1 error format. */
|
|
71
|
+
'$.xgafv'?: string;
|
|
72
|
+
/** OAuth access token. */
|
|
73
|
+
access_token?: string;
|
|
74
|
+
/** Data format for response. */
|
|
75
|
+
alt?: string;
|
|
76
|
+
/** Application Id */
|
|
77
|
+
applicationId: string;
|
|
78
|
+
/** JSONP */
|
|
79
|
+
callback?: string;
|
|
80
|
+
/** Customer Id */
|
|
81
|
+
customerId: string;
|
|
82
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
83
|
+
fields?: string;
|
|
84
|
+
/** 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. */
|
|
85
|
+
key?: string;
|
|
86
|
+
/** OAuth 2.0 token for the current user. */
|
|
87
|
+
oauth_token?: string;
|
|
88
|
+
/** Returns response with indentations and line breaks. */
|
|
89
|
+
prettyPrint?: boolean;
|
|
90
|
+
/** 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. */
|
|
91
|
+
quotaUser?: string;
|
|
92
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
93
|
+
upload_protocol?: string;
|
|
94
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
95
|
+
uploadType?: string;
|
|
96
|
+
}): Request<CustomerLicense>;
|
|
97
|
+
}
|
|
98
|
+
interface UserLicenseResource {
|
|
99
|
+
/** Gets the user's licensing status for their permission to use a given app. */
|
|
100
|
+
get(request?: {
|
|
101
|
+
/** V1 error format. */
|
|
102
|
+
'$.xgafv'?: string;
|
|
103
|
+
/** OAuth access token. */
|
|
104
|
+
access_token?: string;
|
|
105
|
+
/** Data format for response. */
|
|
106
|
+
alt?: string;
|
|
107
|
+
/** Application Id */
|
|
108
|
+
applicationId: string;
|
|
109
|
+
/** JSONP */
|
|
110
|
+
callback?: string;
|
|
111
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
112
|
+
fields?: string;
|
|
113
|
+
/** 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. */
|
|
114
|
+
key?: string;
|
|
115
|
+
/** OAuth 2.0 token for the current user. */
|
|
116
|
+
oauth_token?: string;
|
|
117
|
+
/** Returns response with indentations and line breaks. */
|
|
118
|
+
prettyPrint?: boolean;
|
|
119
|
+
/** 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. */
|
|
120
|
+
quotaUser?: string;
|
|
121
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
122
|
+
upload_protocol?: string;
|
|
123
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
124
|
+
uploadType?: string;
|
|
125
|
+
/** User Id */
|
|
126
|
+
userId: string;
|
|
127
|
+
}): Request<UserLicense>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const customerLicense: CustomerLicenseResource;
|
|
131
|
+
|
|
132
|
+
const userLicense: UserLicenseResource;
|
|
133
|
+
}
|
|
134
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.appsmarket-v2",
|
|
3
|
+
"version": "0.0.20251217",
|
|
4
|
+
"description": "TypeScript typings for Google Workspace Marketplace API v2",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Maxim Mazurok",
|
|
12
|
+
"email": "maxim@mazurok.com",
|
|
13
|
+
"url": "https://maxim.mazurok.com"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery-v1": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# TypeScript typings for Google Workspace Marketplace API v2
|
|
2
|
+
|
|
3
|
+
Lets your Google Workspace Marketplace applications integrate with Google's installtion and licensing services.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/workspace/marketplace).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Google Workspace Marketplace API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.appsmarket-v2 --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(
|
|
29
|
+
'https://appsmarket.googleapis.com/$discovery/rest?version=v2',
|
|
30
|
+
() => {
|
|
31
|
+
// now we can use:
|
|
32
|
+
// gapi.client.appsmarket
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
39
|
+
gapi.client.load('appsmarket', 'v2', () => {
|
|
40
|
+
// now we can use:
|
|
41
|
+
// gapi.client.appsmarket
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Don't forget to authenticate your client before sending any request to resources:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// declare client_id registered in Google Developers Console
|
|
49
|
+
var client_id = '',
|
|
50
|
+
scope = [
|
|
51
|
+
// View your installed application's licensing information
|
|
52
|
+
'https://www.googleapis.com/auth/appsmarketplace.license',
|
|
53
|
+
],
|
|
54
|
+
immediate = true;
|
|
55
|
+
// ...
|
|
56
|
+
|
|
57
|
+
gapi.auth.authorize(
|
|
58
|
+
{client_id: client_id, scope: scope, immediate: immediate},
|
|
59
|
+
authResult => {
|
|
60
|
+
if (authResult && !authResult.error) {
|
|
61
|
+
/* handle successful authorization */
|
|
62
|
+
} else {
|
|
63
|
+
/* handle authorization error */
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
After that you can use Google Workspace Marketplace API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
/*
|
|
73
|
+
Gets the status of a license for a customer to determine if they have access for a given app.
|
|
74
|
+
*/
|
|
75
|
+
await gapi.client.appsmarket.customerLicense.get({
|
|
76
|
+
applicationId: 'applicationId',
|
|
77
|
+
customerId: 'customerId',
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
Gets the user's licensing status for their permission to use a given app.
|
|
82
|
+
*/
|
|
83
|
+
await gapi.client.appsmarket.userLicense.get({
|
|
84
|
+
applicationId: 'applicationId',
|
|
85
|
+
userId: 'userId',
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For provenance information see [Provenance section on NPM](https://www.npmjs.com/package/@maxim_mazurok/gapi.client.appsmarket-v2#Provenance:~:text=none-,Provenance,-Built%20and%20signed)
|