@maxim_mazurok/gapi.client.chat-v1 0.0.20220805

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/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.chat-v1",
3
+ "version": "0.0.20220805",
4
+ "description": "TypeScript typings for Google Chat 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,87 @@
1
+ # TypeScript typings for Google Chat API v1
2
+
3
+ Enables apps to fetch information and perform actions in Google Chat. Authentication is a prerequisite for using the Google Chat REST API.
4
+ For detailed description please check [documentation](https://developers.google.com/hangouts/chat).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Google Chat API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.chat-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://chat.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.chat
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('chat', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.chat
39
+ });
40
+ ```
41
+
42
+
43
+
44
+ After that you can use Google Chat API resources: <!-- TODO: make this work for multiple namespaces -->
45
+
46
+ ```typescript
47
+
48
+ /*
49
+ Legacy path for creating message. Calling these will result in a BadRequest response.
50
+ */
51
+ await gapi.client.chat.dms.messages({ parent: "parent", });
52
+
53
+ /*
54
+ Legacy path for creating message. Calling these will result in a BadRequest response.
55
+ */
56
+ await gapi.client.chat.dms.webhooks({ parent: "parent", });
57
+
58
+ /*
59
+ Downloads media. Download is supported on the URI `/v1/media/{+name}?alt=media`.
60
+ */
61
+ await gapi.client.chat.media.download({ resourceName: "resourceName", });
62
+
63
+ /*
64
+ Legacy path for creating message. Calling these will result in a BadRequest response.
65
+ */
66
+ await gapi.client.chat.rooms.messages({ parent: "parent", });
67
+
68
+ /*
69
+ Legacy path for creating message. Calling these will result in a BadRequest response.
70
+ */
71
+ await gapi.client.chat.rooms.webhooks({ parent: "parent", });
72
+
73
+ /*
74
+ Returns a space. Requires [service account authentication](https://developers.google.com/chat/api/guides/auth/service-accounts).
75
+ */
76
+ await gapi.client.chat.spaces.get({ name: "name", });
77
+
78
+ /*
79
+ Lists spaces the caller is a member of. Requires [service account authentication](https://developers.google.com/chat/api/guides/auth/service-accounts).
80
+ */
81
+ await gapi.client.chat.spaces.list({ });
82
+
83
+ /*
84
+ Legacy path for creating message. Calling these will result in a BadRequest response.
85
+ */
86
+ await gapi.client.chat.spaces.webhooks({ parent: "parent", });
87
+ ```