@maxim_mazurok/gapi.client.blogger-v3 0.0.20220810
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 +1558 -0
- package/package.json +20 -0
- package/readme.md +236 -0
- package/tests.ts +557 -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.blogger-v3",
|
|
3
|
+
"version": "0.0.20220810",
|
|
4
|
+
"description": "TypeScript typings for Blogger API v3",
|
|
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,236 @@
|
|
|
1
|
+
# TypeScript typings for Blogger API v3
|
|
2
|
+
|
|
3
|
+
The Blogger API provides access to posts, comments and pages of a Blogger blog.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/blogger/docs/3.0/getting_started).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Blogger API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.blogger-v3 --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://blogger.googleapis.com/$discovery/rest?version=v3', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.blogger
|
|
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('blogger', 'v3', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.blogger
|
|
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 your Blogger account
|
|
49
|
+
'https://www.googleapis.com/auth/blogger',
|
|
50
|
+
|
|
51
|
+
// View your Blogger account
|
|
52
|
+
'https://www.googleapis.com/auth/blogger.readonly',
|
|
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
|
+
After that you can use Blogger API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
Gets a blog by id.
|
|
74
|
+
*/
|
|
75
|
+
await gapi.client.blogger.blogs.get({ blogId: "blogId", });
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
Gets a blog by url.
|
|
79
|
+
*/
|
|
80
|
+
await gapi.client.blogger.blogs.getByUrl({ url: "url", });
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
Lists blogs by user.
|
|
84
|
+
*/
|
|
85
|
+
await gapi.client.blogger.blogs.listByUser({ userId: "userId", });
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
Gets one blog and user info pair by blog id and user id.
|
|
89
|
+
*/
|
|
90
|
+
await gapi.client.blogger.blogUserInfos.get({ blogId: "blogId", userId: "userId", });
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
Marks a comment as not spam by blog id, post id and comment id.
|
|
94
|
+
*/
|
|
95
|
+
await gapi.client.blogger.comments.approve({ blogId: "blogId", commentId: "commentId", postId: "postId", });
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
Deletes a comment by blog id, post id and comment id.
|
|
99
|
+
*/
|
|
100
|
+
await gapi.client.blogger.comments.delete({ blogId: "blogId", commentId: "commentId", postId: "postId", });
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
Gets a comment by id.
|
|
104
|
+
*/
|
|
105
|
+
await gapi.client.blogger.comments.get({ blogId: "blogId", commentId: "commentId", postId: "postId", });
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
Lists comments.
|
|
109
|
+
*/
|
|
110
|
+
await gapi.client.blogger.comments.list({ blogId: "blogId", postId: "postId", });
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
Lists comments by blog.
|
|
114
|
+
*/
|
|
115
|
+
await gapi.client.blogger.comments.listByBlog({ blogId: "blogId", });
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
Marks a comment as spam by blog id, post id and comment id.
|
|
119
|
+
*/
|
|
120
|
+
await gapi.client.blogger.comments.markAsSpam({ blogId: "blogId", commentId: "commentId", postId: "postId", });
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
Removes the content of a comment by blog id, post id and comment id.
|
|
124
|
+
*/
|
|
125
|
+
await gapi.client.blogger.comments.removeContent({ blogId: "blogId", commentId: "commentId", postId: "postId", });
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
Deletes a page by blog id and page id.
|
|
129
|
+
*/
|
|
130
|
+
await gapi.client.blogger.pages.delete({ blogId: "blogId", pageId: "pageId", });
|
|
131
|
+
|
|
132
|
+
/*
|
|
133
|
+
Gets a page by blog id and page id.
|
|
134
|
+
*/
|
|
135
|
+
await gapi.client.blogger.pages.get({ blogId: "blogId", pageId: "pageId", });
|
|
136
|
+
|
|
137
|
+
/*
|
|
138
|
+
Inserts a page.
|
|
139
|
+
*/
|
|
140
|
+
await gapi.client.blogger.pages.insert({ blogId: "blogId", });
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
Lists pages.
|
|
144
|
+
*/
|
|
145
|
+
await gapi.client.blogger.pages.list({ blogId: "blogId", });
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
Patches a page.
|
|
149
|
+
*/
|
|
150
|
+
await gapi.client.blogger.pages.patch({ blogId: "blogId", pageId: "pageId", });
|
|
151
|
+
|
|
152
|
+
/*
|
|
153
|
+
Publishes a page.
|
|
154
|
+
*/
|
|
155
|
+
await gapi.client.blogger.pages.publish({ blogId: "blogId", pageId: "pageId", });
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
Reverts a published or scheduled page to draft state.
|
|
159
|
+
*/
|
|
160
|
+
await gapi.client.blogger.pages.revert({ blogId: "blogId", pageId: "pageId", });
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
Updates a page by blog id and page id.
|
|
164
|
+
*/
|
|
165
|
+
await gapi.client.blogger.pages.update({ blogId: "blogId", pageId: "pageId", });
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
Gets page views by blog id.
|
|
169
|
+
*/
|
|
170
|
+
await gapi.client.blogger.pageViews.get({ blogId: "blogId", });
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
Deletes a post by blog id and post id.
|
|
174
|
+
*/
|
|
175
|
+
await gapi.client.blogger.posts.delete({ blogId: "blogId", postId: "postId", });
|
|
176
|
+
|
|
177
|
+
/*
|
|
178
|
+
Gets a post by blog id and post id
|
|
179
|
+
*/
|
|
180
|
+
await gapi.client.blogger.posts.get({ blogId: "blogId", postId: "postId", });
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
Gets a post by path.
|
|
184
|
+
*/
|
|
185
|
+
await gapi.client.blogger.posts.getByPath({ blogId: "blogId", path: "path", });
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
Inserts a post.
|
|
189
|
+
*/
|
|
190
|
+
await gapi.client.blogger.posts.insert({ blogId: "blogId", });
|
|
191
|
+
|
|
192
|
+
/*
|
|
193
|
+
Lists posts.
|
|
194
|
+
*/
|
|
195
|
+
await gapi.client.blogger.posts.list({ blogId: "blogId", });
|
|
196
|
+
|
|
197
|
+
/*
|
|
198
|
+
Patches a post.
|
|
199
|
+
*/
|
|
200
|
+
await gapi.client.blogger.posts.patch({ blogId: "blogId", postId: "postId", });
|
|
201
|
+
|
|
202
|
+
/*
|
|
203
|
+
Publishes a post.
|
|
204
|
+
*/
|
|
205
|
+
await gapi.client.blogger.posts.publish({ blogId: "blogId", postId: "postId", });
|
|
206
|
+
|
|
207
|
+
/*
|
|
208
|
+
Reverts a published or scheduled post to draft state.
|
|
209
|
+
*/
|
|
210
|
+
await gapi.client.blogger.posts.revert({ blogId: "blogId", postId: "postId", });
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
Searches for posts matching given query terms in the specified blog.
|
|
214
|
+
*/
|
|
215
|
+
await gapi.client.blogger.posts.search({ blogId: "blogId", q: "q", });
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
Updates a post by blog id and post id.
|
|
219
|
+
*/
|
|
220
|
+
await gapi.client.blogger.posts.update({ blogId: "blogId", postId: "postId", });
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
Gets one post and user info pair, by post_id and user_id.
|
|
224
|
+
*/
|
|
225
|
+
await gapi.client.blogger.postUserInfos.get({ blogId: "blogId", postId: "postId", userId: "userId", });
|
|
226
|
+
|
|
227
|
+
/*
|
|
228
|
+
Lists post and user info pairs.
|
|
229
|
+
*/
|
|
230
|
+
await gapi.client.blogger.postUserInfos.list({ blogId: "blogId", userId: "userId", });
|
|
231
|
+
|
|
232
|
+
/*
|
|
233
|
+
Gets one user by user_id.
|
|
234
|
+
*/
|
|
235
|
+
await gapi.client.blogger.users.get({ userId: "userId", });
|
|
236
|
+
```
|