@maxim_mazurok/gapi.client.merchantapi-datasources_v1beta 0.0.20240611

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.
Files changed (3) hide show
  1. package/index.d.ts +433 -0
  2. package/package.json +20 -0
  3. package/readme.md +73 -0
package/index.d.ts ADDED
@@ -0,0 +1,433 @@
1
+ /* Type definitions for non-npm package Merchant API datasources_v1beta 0.0 */
2
+ // Project: https://developers.devsite.corp.google.com/merchant/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
+
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://merchantapi.googleapis.com/$discovery/rest?version=datasources_v1beta
12
+ // Revision: 20240611
13
+
14
+ /// <reference types="gapi.client" />
15
+
16
+ declare namespace gapi.client {
17
+ /** Load Merchant API datasources_v1beta */
18
+ function load(
19
+ urlOrObject: 'https://merchantapi.googleapis.com/$discovery/rest?version=datasources_v1beta'
20
+ ): Promise<void>;
21
+ /** @deprecated Please load APIs with discovery documents. */
22
+ function load(
23
+ name: 'merchantapi',
24
+ version: 'datasources_v1beta'
25
+ ): Promise<void>;
26
+ /** @deprecated Please load APIs with discovery documents. */
27
+ function load(
28
+ name: 'merchantapi',
29
+ version: 'datasources_v1beta',
30
+ callback: () => any
31
+ ): void;
32
+
33
+ namespace merchantapi {
34
+ interface DataSource {
35
+ /** Output only. The data source id. */
36
+ dataSourceId?: string;
37
+ /** Required. The displayed data source name in the Merchant Center UI. */
38
+ displayName?: string;
39
+ /** Optional. The field is used only when data is managed through a file. */
40
+ fileInput?: FileInput;
41
+ /** Output only. Determines the type of input to the data source. Based on the input some settings might not work. Only generic data sources can be created through the API. */
42
+ input?: string;
43
+ /** Required. The [local inventory](https://support.google.com/merchants/answer/7023001) data source. */
44
+ localInventoryDataSource?: LocalInventoryDataSource;
45
+ /** Identifier. The name of the data source. Format: `{datasource.name=accounts/{account}/dataSources/{datasource}}` */
46
+ name?: string;
47
+ /** Required. The [primary data source](https://support.google.com/merchants/answer/7439058) for local and online products. */
48
+ primaryProductDataSource?: PrimaryProductDataSource;
49
+ /** Required. The [promotion](https://support.google.com/merchants/answer/2906014) data source. */
50
+ promotionDataSource?: PromotionDataSource;
51
+ /** Required. The [regional inventory](https://support.google.com/merchants/answer/7439058) data source. */
52
+ regionalInventoryDataSource?: RegionalInventoryDataSource;
53
+ /** Required. The [supplemental data source](https://support.google.com/merchants/answer/7439058) for local and online products. */
54
+ supplementalProductDataSource?: SupplementalProductDataSource;
55
+ }
56
+ interface Empty {}
57
+ interface FetchDataSourceRequest {}
58
+ interface FetchSettings {
59
+ /** Optional. The day of the month when the data source file should be fetched (1-31). This field can only be set for monthly frequency. */
60
+ dayOfMonth?: number;
61
+ /** Optional. The day of the week when the data source file should be fetched. This field can only be set for weekly frequency. */
62
+ dayOfWeek?: string;
63
+ /** Optional. Enables or pauses the fetch schedule. */
64
+ enabled?: boolean;
65
+ /** Optional. The URL where the data source file can be fetched. Google Merchant Center supports automatic scheduled uploads using the HTTP, HTTPS or SFTP protocols, so the value will need to be a valid link using one of those three protocols. Immutable for Google Sheets files. */
66
+ fetchUri?: string;
67
+ /** Required. The frequency describing fetch schedule. */
68
+ frequency?: string;
69
+ /** Optional. An optional password for fetch url. Used for [submitting data sources through SFTP](https://support.google.com/merchants/answer/13813117). */
70
+ password?: string;
71
+ /** Optional. The hour of the day when the data source file should be fetched. Minutes and seconds are not supported and will be ignored. */
72
+ timeOfDay?: TimeOfDay;
73
+ /** Optional. [Time zone](https://cldr.unicode.org) used for schedule. UTC by default. For example, "America/Los_Angeles". */
74
+ timeZone?: string;
75
+ /** Optional. An optional user name for fetch url. Used for [submitting data sources through SFTP](https://support.google.com/merchants/answer/13813117). */
76
+ username?: string;
77
+ }
78
+ interface FileInput {
79
+ /** Optional. Fetch details to deliver the data source. It contains settings for `FETCH` and `GOOGLE_SHEETS` file input types. The required fields vary based on the frequency of fetching. */
80
+ fetchSettings?: FetchSettings;
81
+ /** Output only. The type of file input. */
82
+ fileInputType?: string;
83
+ /** Optional. The file name of the data source. Required for `UPLOAD` file input type. */
84
+ fileName?: string;
85
+ }
86
+ interface ListDataSourcesResponse {
87
+ /** The data sources from the specified account. */
88
+ dataSources?: DataSource[];
89
+ /** A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. */
90
+ nextPageToken?: string;
91
+ }
92
+ interface LocalInventoryDataSource {
93
+ /** Required. Immutable. The two-letter ISO 639-1 language of the items to which the local inventory is provided. */
94
+ contentLanguage?: string;
95
+ /** Required. Immutable. The feed label of the offers to which the local inventory is provided. Must be less than or equal to 20 uppercase letters (A-Z), numbers (0-9), and dashes (-). See also [migration to feed labels](https://developers.google.com/shopping-content/guides/products/feed-labels). */
96
+ feedLabel?: string;
97
+ }
98
+ interface PrimaryProductDataSource {
99
+ /** Required. Immutable. Specifies the type of data source channel. */
100
+ channel?: string;
101
+ /** Optional. Immutable. The two-letter ISO 639-1 language of the items in the data source. `feedLabel` and `contentLanguage` must be either both set or unset. The fields can only be unset for data sources without file input. If set, the data source will only accept products matching this combination. If unset, the data source will accept products without that restriction. */
102
+ contentLanguage?: string;
103
+ /** Optional. The countries where the items may be displayed. Represented as a [CLDR territory code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml). */
104
+ countries?: string[];
105
+ /** Optional. Immutable. The feed label that is specified on the data source level. Must be less than or equal to 20 uppercase letters (A-Z), numbers (0-9), and dashes (-). See also [migration to feed labels](https://developers.google.com/shopping-content/guides/products/feed-labels). `feedLabel` and `contentLanguage` must be either both set or unset for data sources with product content type. They must be set for data sources with a file input. If set, the data source will only accept products matching this combination. If unset, the data source will accept products without that restriction. */
106
+ feedLabel?: string;
107
+ }
108
+ interface ProductChange {
109
+ /** The new value of the changed resource or attribute. */
110
+ newValue?: string;
111
+ /** The old value of the changed resource or attribute. */
112
+ oldValue?: string;
113
+ /** Countries that have the change (if applicable) */
114
+ regionCode?: string;
115
+ /** Reporting contexts that have the change (if applicable) */
116
+ reportingContext?: string;
117
+ }
118
+ interface ProductStatusChangeMessage {
119
+ /** The target account that owns the entity that changed. Format : `accounts/{merchant_id}` */
120
+ account?: string;
121
+ /** The attribute in the resource that changed, in this case it will be always `Status`. */
122
+ attribute?: string;
123
+ /** A message to describe the change that happened to the product */
124
+ changes?: ProductChange[];
125
+ /** The account that manages the merchant's account. can be the same as merchant id if it is standalone account. Format : `accounts/{service_provider_id}` */
126
+ managingAccount?: string;
127
+ /** The product name. Format: `{product.name=accounts/{account}/products/{product}}` */
128
+ resource?: string;
129
+ /** The product id. */
130
+ resourceId?: string;
131
+ /** The resource that changed, in this case it will always be `Product`. */
132
+ resourceType?: string;
133
+ }
134
+ interface PromotionDataSource {
135
+ /** Required. Immutable. The two-letter ISO 639-1 language of the items in the data source. */
136
+ contentLanguage?: string;
137
+ /** Required. Immutable. The target country used as part of the unique identifier. Represented as a [CLDR territory code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml). Promotions are only available in selected [countries](https://support.google.com/merchants/answer/4588460). */
138
+ targetCountry?: string;
139
+ }
140
+ interface RegionalInventoryDataSource {
141
+ /** Required. Immutable. The two-letter ISO 639-1 language of the items to which the regional inventory is provided. */
142
+ contentLanguage?: string;
143
+ /** Required. Immutable. The feed label of the offers to which the regional inventory is provided. Must be less than or equal to 20 uppercase letters (A-Z), numbers (0-9), and dashes (-). See also [migration to feed labels](https://developers.google.com/shopping-content/guides/products/feed-labels). */
144
+ feedLabel?: string;
145
+ }
146
+ interface SupplementalProductDataSource {
147
+ /** Optional. Immutable. The two-letter ISO 639-1 language of the items in the data source. `feedLabel` and `contentLanguage` must be either both set or unset. The fields can only be unset for data sources without file input. If set, the data source will only accept products matching this combination. If unset, the data source will accept produts without that restriction. */
148
+ contentLanguage?: string;
149
+ /** Optional. Immutable. The feed label that is specified on the data source level. Must be less than or equal to 20 uppercase letters (A-Z), numbers (0-9), and dashes (-). See also [migration to feed labels](https://developers.google.com/shopping-content/guides/products/feed-labels). `feedLabel` and `contentLanguage` must be either both set or unset for data sources with product content type. They must be set for data sources with a file input. If set, the data source will only accept products matching this combination. If unset, the data source will accept produts without that restriction. */
150
+ feedLabel?: string;
151
+ }
152
+ interface TimeOfDay {
153
+ /** Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time. */
154
+ hours?: number;
155
+ /** Minutes of hour of day. Must be from 0 to 59. */
156
+ minutes?: number;
157
+ /** Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. */
158
+ nanos?: number;
159
+ /** Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows leap-seconds. */
160
+ seconds?: number;
161
+ }
162
+ interface DataSourcesResource {
163
+ /** Creates the new data source configuration for the given account. */
164
+ create(request: {
165
+ /** V1 error format. */
166
+ '$.xgafv'?: string;
167
+ /** OAuth access token. */
168
+ access_token?: string;
169
+ /** Data format for response. */
170
+ alt?: string;
171
+ /** JSONP */
172
+ callback?: string;
173
+ /** Selector specifying which fields to include in a partial response. */
174
+ fields?: string;
175
+ /** 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. */
176
+ key?: string;
177
+ /** OAuth 2.0 token for the current user. */
178
+ oauth_token?: string;
179
+ /** Required. The account where this data source will be created. Format: `accounts/{account}` */
180
+ parent: string;
181
+ /** Returns response with indentations and line breaks. */
182
+ prettyPrint?: boolean;
183
+ /** 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. */
184
+ quotaUser?: string;
185
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
186
+ upload_protocol?: string;
187
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
188
+ uploadType?: string;
189
+ /** Request body */
190
+ resource: DataSource;
191
+ }): Request<DataSource>;
192
+ create(
193
+ request: {
194
+ /** V1 error format. */
195
+ '$.xgafv'?: string;
196
+ /** OAuth access token. */
197
+ access_token?: string;
198
+ /** Data format for response. */
199
+ alt?: string;
200
+ /** JSONP */
201
+ callback?: string;
202
+ /** Selector specifying which fields to include in a partial response. */
203
+ fields?: string;
204
+ /** 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. */
205
+ key?: string;
206
+ /** OAuth 2.0 token for the current user. */
207
+ oauth_token?: string;
208
+ /** Required. The account where this data source will be created. Format: `accounts/{account}` */
209
+ parent: string;
210
+ /** Returns response with indentations and line breaks. */
211
+ prettyPrint?: boolean;
212
+ /** 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. */
213
+ quotaUser?: string;
214
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
215
+ upload_protocol?: string;
216
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
217
+ uploadType?: string;
218
+ },
219
+ body: DataSource
220
+ ): Request<DataSource>;
221
+ /** Deletes a data source from your Merchant Center account. */
222
+ delete(request?: {
223
+ /** V1 error format. */
224
+ '$.xgafv'?: string;
225
+ /** OAuth access token. */
226
+ access_token?: string;
227
+ /** Data format for response. */
228
+ alt?: string;
229
+ /** JSONP */
230
+ callback?: string;
231
+ /** Selector specifying which fields to include in a partial response. */
232
+ fields?: string;
233
+ /** 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. */
234
+ key?: string;
235
+ /** Required. The name of the data source to delete. Format: `accounts/{account}/dataSources/{datasource}` */
236
+ name: string;
237
+ /** OAuth 2.0 token for the current user. */
238
+ oauth_token?: string;
239
+ /** Returns response with indentations and line breaks. */
240
+ prettyPrint?: boolean;
241
+ /** 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. */
242
+ quotaUser?: string;
243
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
244
+ upload_protocol?: string;
245
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
246
+ uploadType?: string;
247
+ }): Request<{}>;
248
+ /** Performs the data fetch immediately (even outside fetch schedule) on a data source from your Merchant Center Account. If you need to call this method more than once per day, you should use the Products service to update your product data instead. This method only works on data sources with a file input set. */
249
+ fetch(request: {
250
+ /** V1 error format. */
251
+ '$.xgafv'?: string;
252
+ /** OAuth access token. */
253
+ access_token?: string;
254
+ /** Data format for response. */
255
+ alt?: string;
256
+ /** JSONP */
257
+ callback?: string;
258
+ /** Selector specifying which fields to include in a partial response. */
259
+ fields?: string;
260
+ /** 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. */
261
+ key?: string;
262
+ /** Required. The name of the data source resource to fetch. Format: `accounts/{account}/dataSources/{datasource}` */
263
+ name: string;
264
+ /** OAuth 2.0 token for the current user. */
265
+ oauth_token?: string;
266
+ /** Returns response with indentations and line breaks. */
267
+ prettyPrint?: boolean;
268
+ /** 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. */
269
+ quotaUser?: string;
270
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
271
+ upload_protocol?: string;
272
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
273
+ uploadType?: string;
274
+ /** Request body */
275
+ resource: FetchDataSourceRequest;
276
+ }): Request<{}>;
277
+ fetch(
278
+ request: {
279
+ /** V1 error format. */
280
+ '$.xgafv'?: string;
281
+ /** OAuth access token. */
282
+ access_token?: string;
283
+ /** Data format for response. */
284
+ alt?: string;
285
+ /** JSONP */
286
+ callback?: string;
287
+ /** Selector specifying which fields to include in a partial response. */
288
+ fields?: string;
289
+ /** 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. */
290
+ key?: string;
291
+ /** Required. The name of the data source resource to fetch. Format: `accounts/{account}/dataSources/{datasource}` */
292
+ name: string;
293
+ /** OAuth 2.0 token for the current user. */
294
+ oauth_token?: string;
295
+ /** Returns response with indentations and line breaks. */
296
+ prettyPrint?: boolean;
297
+ /** 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. */
298
+ quotaUser?: string;
299
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
300
+ upload_protocol?: string;
301
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
302
+ uploadType?: string;
303
+ },
304
+ body: FetchDataSourceRequest
305
+ ): Request<{}>;
306
+ /** Retrieves the data source configuration for the given account. */
307
+ get(request?: {
308
+ /** V1 error format. */
309
+ '$.xgafv'?: string;
310
+ /** OAuth access token. */
311
+ access_token?: string;
312
+ /** Data format for response. */
313
+ alt?: string;
314
+ /** JSONP */
315
+ callback?: string;
316
+ /** Selector specifying which fields to include in a partial response. */
317
+ fields?: string;
318
+ /** 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. */
319
+ key?: string;
320
+ /** Required. The name of the data source to retrieve. Format: `accounts/{account}/dataSources/{datasource}` */
321
+ name: string;
322
+ /** OAuth 2.0 token for the current user. */
323
+ oauth_token?: string;
324
+ /** Returns response with indentations and line breaks. */
325
+ prettyPrint?: boolean;
326
+ /** 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. */
327
+ quotaUser?: string;
328
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
329
+ upload_protocol?: string;
330
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
331
+ uploadType?: string;
332
+ }): Request<DataSource>;
333
+ /** Lists the configurations for data sources for the given account. */
334
+ list(request?: {
335
+ /** V1 error format. */
336
+ '$.xgafv'?: string;
337
+ /** OAuth access token. */
338
+ access_token?: string;
339
+ /** Data format for response. */
340
+ alt?: string;
341
+ /** JSONP */
342
+ callback?: string;
343
+ /** Selector specifying which fields to include in a partial response. */
344
+ fields?: string;
345
+ /** 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. */
346
+ key?: string;
347
+ /** OAuth 2.0 token for the current user. */
348
+ oauth_token?: string;
349
+ /** Optional. The maximum number of data sources to return. The service may return fewer than this value. The maximum value is 1000; values above 1000 will be coerced to 1000. If unspecified, the maximum number of data sources will be returned. */
350
+ pageSize?: number;
351
+ /** Optional. A page token, received from a previous `ListDataSources` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDataSources` must match the call that provided the page token. */
352
+ pageToken?: string;
353
+ /** Required. The account to list data sources for. Format: `accounts/{account}` */
354
+ parent: string;
355
+ /** Returns response with indentations and line breaks. */
356
+ prettyPrint?: boolean;
357
+ /** 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. */
358
+ quotaUser?: string;
359
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
360
+ upload_protocol?: string;
361
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
362
+ uploadType?: string;
363
+ }): Request<ListDataSourcesResponse>;
364
+ /** Updates the existing data source configuration. The fields that are set in the update mask but not provided in the resource will be deleted. */
365
+ patch(request: {
366
+ /** V1 error format. */
367
+ '$.xgafv'?: string;
368
+ /** OAuth access token. */
369
+ access_token?: string;
370
+ /** Data format for response. */
371
+ alt?: string;
372
+ /** JSONP */
373
+ callback?: string;
374
+ /** Selector specifying which fields to include in a partial response. */
375
+ fields?: string;
376
+ /** 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. */
377
+ key?: string;
378
+ /** Identifier. The name of the data source. Format: `{datasource.name=accounts/{account}/dataSources/{datasource}}` */
379
+ name: string;
380
+ /** OAuth 2.0 token for the current user. */
381
+ oauth_token?: string;
382
+ /** Returns response with indentations and line breaks. */
383
+ prettyPrint?: boolean;
384
+ /** 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. */
385
+ quotaUser?: string;
386
+ /** Required. The list of data source fields to be updated. Fields specified in the update mask without a value specified in the body will be deleted from the data source. Providing special "*" value for full data source replacement is not supported. */
387
+ updateMask?: string;
388
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
389
+ upload_protocol?: string;
390
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
391
+ uploadType?: string;
392
+ /** Request body */
393
+ resource: DataSource;
394
+ }): Request<DataSource>;
395
+ patch(
396
+ request: {
397
+ /** V1 error format. */
398
+ '$.xgafv'?: string;
399
+ /** OAuth access token. */
400
+ access_token?: string;
401
+ /** Data format for response. */
402
+ alt?: string;
403
+ /** JSONP */
404
+ callback?: string;
405
+ /** Selector specifying which fields to include in a partial response. */
406
+ fields?: string;
407
+ /** 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. */
408
+ key?: string;
409
+ /** Identifier. The name of the data source. Format: `{datasource.name=accounts/{account}/dataSources/{datasource}}` */
410
+ name: string;
411
+ /** OAuth 2.0 token for the current user. */
412
+ oauth_token?: string;
413
+ /** Returns response with indentations and line breaks. */
414
+ prettyPrint?: boolean;
415
+ /** 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. */
416
+ quotaUser?: string;
417
+ /** Required. The list of data source fields to be updated. Fields specified in the update mask without a value specified in the body will be deleted from the data source. Providing special "*" value for full data source replacement is not supported. */
418
+ updateMask?: string;
419
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
420
+ upload_protocol?: string;
421
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
422
+ uploadType?: string;
423
+ },
424
+ body: DataSource
425
+ ): Request<DataSource>;
426
+ }
427
+ interface AccountsResource {
428
+ dataSources: DataSourcesResource;
429
+ }
430
+
431
+ const accounts: AccountsResource;
432
+ }
433
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.merchantapi-datasources_v1beta",
3
+ "version": "0.0.20240611",
4
+ "description": "TypeScript typings for Merchant API datasources_v1beta",
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,73 @@
1
+ # TypeScript typings for Merchant API datasources_v1beta
2
+
3
+ Programmatically manage your Merchant Center Accounts.
4
+ For detailed description please check [documentation](https://developers.devsite.corp.google.com/merchant/api).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Merchant API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.merchantapi-datasources_v1beta --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://merchantapi.googleapis.com/$discovery/rest?version=datasources_v1beta',
30
+ () => {
31
+ // now we can use:
32
+ // gapi.client.merchantapi
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('merchantapi', 'datasources_v1beta', () => {
40
+ // now we can use:
41
+ // gapi.client.merchantapi
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
+ // Manage your product listings and accounts for Google Shopping
52
+ 'https://www.googleapis.com/auth/content',
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 Merchant API resources: <!-- TODO: make this work for multiple namespaces -->
70
+
71
+ ```typescript
72
+
73
+ ```