@maxim_mazurok/gapi.client.androidmanagement-v1 0.0.20220801
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 +2867 -0
- package/package.json +20 -0
- package/readme.md +98 -0
- package/tests.ts +960 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.androidmanagement-v1",
|
|
3
|
+
"version": "0.0.20220801",
|
|
4
|
+
"description": "TypeScript typings for Android Management 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,98 @@
|
|
|
1
|
+
# TypeScript typings for Android Management API v1
|
|
2
|
+
|
|
3
|
+
The Android Management API provides remote enterprise management of Android devices and apps.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/android/management).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Android Management API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.androidmanagement-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://androidmanagement.googleapis.com/$discovery/rest?version=v1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.androidmanagement
|
|
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('androidmanagement', 'v1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.androidmanagement
|
|
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
|
+
// Manage Android devices and apps for your customers
|
|
49
|
+
'https://www.googleapis.com/auth/androidmanagement',
|
|
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 Android Management API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
Creates an enterprise. This is the last step in the enterprise signup flow.
|
|
71
|
+
*/
|
|
72
|
+
await gapi.client.androidmanagement.enterprises.create({ });
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
Deletes an enterprise. Only available for EMM-managed enterprises.
|
|
76
|
+
*/
|
|
77
|
+
await gapi.client.androidmanagement.enterprises.delete({ name: "name", });
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
Gets an enterprise.
|
|
81
|
+
*/
|
|
82
|
+
await gapi.client.androidmanagement.enterprises.get({ name: "name", });
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
Lists EMM-managed enterprises. Only BASIC fields are returned.
|
|
86
|
+
*/
|
|
87
|
+
await gapi.client.androidmanagement.enterprises.list({ });
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
Updates an enterprise.
|
|
91
|
+
*/
|
|
92
|
+
await gapi.client.androidmanagement.enterprises.patch({ name: "name", });
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
Creates an enterprise signup URL.
|
|
96
|
+
*/
|
|
97
|
+
await gapi.client.androidmanagement.signupUrls.create({ });
|
|
98
|
+
```
|