@maxim_mazurok/gapi.client.merchantapi-promotions_v1 0.0.20250804
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 +336 -0
- package/package.json +20 -0
- package/readme.md +73 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Merchant API promotions_v1 0.0 */
|
|
2
|
+
// Project: https://developers.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=promotions_v1
|
|
12
|
+
// Revision: 20250804
|
|
13
|
+
|
|
14
|
+
/// <reference types="gapi.client" />
|
|
15
|
+
|
|
16
|
+
declare namespace gapi.client {
|
|
17
|
+
/** Load Merchant API promotions_v1 */
|
|
18
|
+
function load(
|
|
19
|
+
urlOrObject: 'https://merchantapi.googleapis.com/$discovery/rest?version=promotions_v1',
|
|
20
|
+
): Promise<void>;
|
|
21
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
22
|
+
function load(name: 'merchantapi', version: 'promotions_v1'): Promise<void>;
|
|
23
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
24
|
+
function load(
|
|
25
|
+
name: 'merchantapi',
|
|
26
|
+
version: 'promotions_v1',
|
|
27
|
+
callback: () => any,
|
|
28
|
+
): void;
|
|
29
|
+
|
|
30
|
+
namespace merchantapi {
|
|
31
|
+
interface Attributes {
|
|
32
|
+
/** Optional. Product filter by [brand exclusion](https://support.google.com/merchants/answer/13861679?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
33
|
+
brandExclusion?: string[];
|
|
34
|
+
/** Optional. Product filter by brand for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
35
|
+
brandInclusion?: string[];
|
|
36
|
+
/** Required. The [coupon value type] (https://support.google.com/merchants/answer/13861986?ref_topic=13773355&sjid=17642868584668136159-NC) attribute to signal the type of promotion that you are running. Depending on type of the selected coupon value [some attributes are required](https://support.google.com/merchants/answer/6393006?ref_topic=7322920). */
|
|
37
|
+
couponValueType?: string;
|
|
38
|
+
/** Optional. [Free gift description](https://support.google.com/merchants/answer/13847245?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. */
|
|
39
|
+
freeGiftDescription?: string;
|
|
40
|
+
/** Optional. [Free gift item ID](https://support.google.com/merchants/answer/13857152?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. */
|
|
41
|
+
freeGiftItemId?: string;
|
|
42
|
+
/** Optional. [Free gift value](https://support.google.com/merchants/answer/13844477?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. */
|
|
43
|
+
freeGiftValue?: Price;
|
|
44
|
+
/** Optional. Generic redemption code for the promotion. To be used with the `offerType` field and must meet the [minimum requirements](https://support.google.com/merchants/answer/13837405?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
45
|
+
genericRedemptionCode?: string;
|
|
46
|
+
/** Optional. The number of items discounted in the promotion. The attribute is set when `couponValueType` is equal to `buy_m_get_n_money_off` or `buy_m_get_n_percent_off`. */
|
|
47
|
+
getThisQuantityDiscounted?: string;
|
|
48
|
+
/** Optional. Product filter by [item group ID](https://support.google.com/merchants/answer/13837298?ref_topic=13773355&sjid=17642868584668136159-NC). The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). exclusion for the promotion. */
|
|
49
|
+
itemGroupIdExclusion?: string[];
|
|
50
|
+
/** Optional. Product filter by item group ID for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability [product_applicability] attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
51
|
+
itemGroupIdInclusion?: string[];
|
|
52
|
+
/** Optional. Product filter by [item ID exclusion](https://support.google.com/merchants/answer/13863524?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
53
|
+
itemIdExclusion?: string[];
|
|
54
|
+
/** Optional. Product filter by [item ID](https://support.google.com/merchants/answer/13861565?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
55
|
+
itemIdInclusion?: string[];
|
|
56
|
+
/** Optional. [Maximum purchase quantity](https://support.google.com/merchants/answer/13861564?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. */
|
|
57
|
+
limitQuantity?: string;
|
|
58
|
+
/** Optional. [Maximum product price](https://support.google.com/merchants/answer/2906014) for promotion. */
|
|
59
|
+
limitValue?: Price;
|
|
60
|
+
/** Required. [Long title](https://support.google.com/merchants/answer/13838102?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. */
|
|
61
|
+
longTitle?: string;
|
|
62
|
+
/** Optional. [Minimum purchase amount](https://support.google.com/merchants/answer/13837705?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. */
|
|
63
|
+
minimumPurchaseAmount?: Price;
|
|
64
|
+
minimumPurchaseQuantity?: string;
|
|
65
|
+
/** Optional. The [money off amount](https://support.google.com/merchants/answer/13838101?ref_topic=13773355&sjid=17642868584668136159-NC) offered in the promotion. */
|
|
66
|
+
moneyOffAmount?: Price;
|
|
67
|
+
/** Required. [Type](https://support.google.com/merchants/answer/13837405?ref_topic=13773355&sjid=17642868584668136159-NC) of the promotion. Use this attribute to indicate whether or not customers need a coupon code to redeem your promotion. */
|
|
68
|
+
offerType?: string;
|
|
69
|
+
/** Optional. The [percentage discount](https://support.google.com/merchants/answer/13837404?sjid=17642868584668136159-NC) offered in the promotion. */
|
|
70
|
+
percentOff?: string;
|
|
71
|
+
/** Required. Applicability of the promotion to either all products or [only specific products](https://support.google.com/merchants/answer/6396257?ref_topic=6396150&sjid=17642868584668136159-NC). */
|
|
72
|
+
productApplicability?: string;
|
|
73
|
+
/** Optional. Product filter by [product type exclusion](https://support.google.com/merchants/answer/13863746?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
74
|
+
productTypeExclusion?: string[];
|
|
75
|
+
/** Optional. Product filter by product type for the promotion. The product filter attributes only applies when the products eligible for promotion product applicability `product_applicability` attribute is set to [specific_products](https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
76
|
+
productTypeInclusion?: string[];
|
|
77
|
+
/** Required. The list of destinations (also known as [Marketing methods](https://support.google.com/merchants/answer/15130232)) where the promotion applies to. If you don't specify a destination by including a supported value in your data source, your promotion will display in Shopping ads and free listings by default. You may have previously submitted the following values as destinations for your products: Shopping Actions, Surfaces across Google, Local surfaces across Google. To represent these values use `FREE_LISTINGS`, `FREE_LOCAL_LISTINGS`, `LOCAL_INVENTORY_ADS`. For more details see [Promotion destination](https://support.google.com/merchants/answer/13837465?sjid=5155774230887277618-NC) */
|
|
78
|
+
promotionDestinations?: string[];
|
|
79
|
+
/** Optional. `TimePeriod` representation of the promotion's display dates. This attribute specifies the date and time frame when the promotion will be live on Google.com and Shopping ads. If the display time period for promotion `promotion_display_time_period` attribute is not specified, the promotion effective time period `promotion_effective_time_period` determines the date and time frame when the promotion will be live on Google.com and Shopping ads. */
|
|
80
|
+
promotionDisplayTimePeriod?: Interval;
|
|
81
|
+
/** Required. `TimePeriod` representation of the promotion's effective dates. This attribute specifies that the promotion can be tested on your online store during this time period. */
|
|
82
|
+
promotionEffectiveTimePeriod?: Interval;
|
|
83
|
+
/** Optional. URL to the page on the merchant's site where the promotion shows. Local Inventory ads promotions throw an error if no `promotion_url` is included. URL is used to confirm that the promotion is valid and can be redeemed. */
|
|
84
|
+
promotionUrl?: string;
|
|
85
|
+
/** Optional. Whether the promotion applies to [all stores, or only specified stores](https://support.google.com/merchants/answer/13857563?sjid=17642868584668136159-NC). Local Inventory ads promotions throw an error if no store applicability is included. An `INVALID_ARGUMENT` error is thrown if `store_applicability` is set to `ALL_STORES` and `store_codes_inclusion` or `score_code_exclusion` is set to a value. */
|
|
86
|
+
storeApplicability?: string;
|
|
87
|
+
/** Optional. [Store codes to exclude](https://support.google.com/merchants/answer/13859586?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. The store filter attributes only applies when the `store_applicability` attribute is set to [specific_stores](https://support.google.com/merchants/answer/13857563?ref_topic=13773355&sjid=17642868584668136159-NC). */
|
|
88
|
+
storeCodesExclusion?: string[];
|
|
89
|
+
/** Optional. [Store codes to include](https://support.google.com/merchants/answer/13857470?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. The store filter attributes only applies when the `store_applicability` attribute is set to [specific_stores](https://support.google.com/merchants/answer/13857563?ref_topic=13773355&sjid=17642868584668136159-NC). Store code (the store ID from your Business Profile) of the physical store the product is sold in. See the [Local product inventory data specification](https://support.google.com/merchants/answer/3061342) for more information. */
|
|
90
|
+
storeCodesInclusion?: string[];
|
|
91
|
+
}
|
|
92
|
+
interface CustomAttribute {
|
|
93
|
+
/** Subattributes within this attribute group. If `group_values` is not empty, `value` must be empty. */
|
|
94
|
+
groupValues?: CustomAttribute[];
|
|
95
|
+
/** The name of the attribute. */
|
|
96
|
+
name?: string;
|
|
97
|
+
/** The value of the attribute. If `value` is not empty, `group_values` must be empty. */
|
|
98
|
+
value?: string;
|
|
99
|
+
}
|
|
100
|
+
interface DestinationStatus {
|
|
101
|
+
/** Output only. The name of the promotion destination. */
|
|
102
|
+
reportingContext?: string;
|
|
103
|
+
/** Output only. The status for the specified destination. */
|
|
104
|
+
status?: string;
|
|
105
|
+
}
|
|
106
|
+
interface InsertPromotionRequest {
|
|
107
|
+
/** Required. The data source of the [promotion](https://support.google.com/merchants/answer/6396268?sjid=5155774230887277618-NC) Format: `accounts/{account}/dataSources/{datasource}`. */
|
|
108
|
+
dataSource?: string;
|
|
109
|
+
/** Required. The promotion to insert. */
|
|
110
|
+
promotion?: Promotion;
|
|
111
|
+
}
|
|
112
|
+
interface Interval {
|
|
113
|
+
/** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
|
|
114
|
+
endTime?: string;
|
|
115
|
+
/** Optional. Inclusive start of the interval. If specified, a Timestamp matching this interval will have to be the same or after the start. */
|
|
116
|
+
startTime?: string;
|
|
117
|
+
}
|
|
118
|
+
interface ItemLevelIssue {
|
|
119
|
+
/** Output only. List of country codes (ISO 3166-1 alpha-2) where issue applies to the offer. */
|
|
120
|
+
applicableCountries?: string[];
|
|
121
|
+
/** Output only. The attribute's name, if the issue is caused by a single attribute. */
|
|
122
|
+
attribute?: string;
|
|
123
|
+
/** Output only. The error code of the issue. */
|
|
124
|
+
code?: string;
|
|
125
|
+
/** Output only. A short issue description in English. */
|
|
126
|
+
description?: string;
|
|
127
|
+
/** Output only. A detailed issue description in English. */
|
|
128
|
+
detail?: string;
|
|
129
|
+
/** Output only. The URL of a web page to help with resolving this issue. */
|
|
130
|
+
documentation?: string;
|
|
131
|
+
/** Output only. The destination the issue applies to. */
|
|
132
|
+
reportingContext?: string;
|
|
133
|
+
/** Output only. Whether the issue can be resolved by the merchant. */
|
|
134
|
+
resolution?: string;
|
|
135
|
+
/** Output only. How this issue affects serving of the promotion. */
|
|
136
|
+
severity?: string;
|
|
137
|
+
}
|
|
138
|
+
interface ListPromotionsResponse {
|
|
139
|
+
/** A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. */
|
|
140
|
+
nextPageToken?: string;
|
|
141
|
+
/** The processed promotions from the specified account. */
|
|
142
|
+
promotions?: Promotion[];
|
|
143
|
+
}
|
|
144
|
+
interface Price {
|
|
145
|
+
/** The price represented as a number in micros (1 million micros is an equivalent to one's currency standard unit, for example, 1 USD = 1000000 micros). */
|
|
146
|
+
amountMicros?: string;
|
|
147
|
+
/** The currency of the price using three-letter acronyms according to [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217). */
|
|
148
|
+
currencyCode?: string;
|
|
149
|
+
}
|
|
150
|
+
interface ProductChange {
|
|
151
|
+
/** The new value of the changed resource or attribute. If empty, it means that the product was deleted. Will have one of these values : (`approved`, `pending`, `disapproved`, ``) */
|
|
152
|
+
newValue?: string;
|
|
153
|
+
/** The old value of the changed resource or attribute. If empty, it means that the product was created. Will have one of these values : (`approved`, `pending`, `disapproved`, ``) */
|
|
154
|
+
oldValue?: string;
|
|
155
|
+
/** Countries that have the change (if applicable). Represented in the ISO 3166 format. */
|
|
156
|
+
regionCode?: string;
|
|
157
|
+
/** Reporting contexts that have the change (if applicable). Currently this field supports only (`SHOPPING_ADS`, `LOCAL_INVENTORY_ADS`, `YOUTUBE_SHOPPING`, `YOUTUBE_CHECKOUT`, `YOUTUBE_AFFILIATE`) from the enum value [ReportingContextEnum](/merchant/api/reference/rest/Shared.Types/ReportingContextEnum) */
|
|
158
|
+
reportingContext?: string;
|
|
159
|
+
}
|
|
160
|
+
interface ProductStatusChangeMessage {
|
|
161
|
+
/** The target account that owns the entity that changed. Format : `accounts/{merchant_id}` */
|
|
162
|
+
account?: string;
|
|
163
|
+
/** The attribute in the resource that changed, in this case it will be always `Status`. */
|
|
164
|
+
attribute?: string;
|
|
165
|
+
/** A message to describe the change that happened to the product */
|
|
166
|
+
changes?: ProductChange[];
|
|
167
|
+
/** The time at which the event was generated. If you want to order the notification messages you receive you should rely on this field not on the order of receiving the notifications. */
|
|
168
|
+
eventTime?: string;
|
|
169
|
+
/** Optional. The product expiration time. This field will not be set if the notification is sent for a product deletion event. */
|
|
170
|
+
expirationTime?: string;
|
|
171
|
+
/** 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}` */
|
|
172
|
+
managingAccount?: string;
|
|
173
|
+
/** The product name. Format: `accounts/{account}/products/{product}` */
|
|
174
|
+
resource?: string;
|
|
175
|
+
/** The product id. */
|
|
176
|
+
resourceId?: string;
|
|
177
|
+
/** The resource that changed, in this case it will always be `Product`. */
|
|
178
|
+
resourceType?: string;
|
|
179
|
+
}
|
|
180
|
+
interface Promotion {
|
|
181
|
+
/** Optional. A list of promotion attributes. */
|
|
182
|
+
attributes?: Attributes;
|
|
183
|
+
/** Required. The two-letter [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the promotion. Promotions is only for [selected languages](https://support.google.com/merchants/answer/4588281?ref_topic=6396150&sjid=18314938579342094533-NC#option3&zippy=). */
|
|
184
|
+
contentLanguage?: string;
|
|
185
|
+
/** Optional. A list of custom (merchant-provided) attributes. It can also be used for submitting any attribute of the data specification in its generic form (for example, `{ "name": "size type", "value": "regular" }`). This is useful for submitting attributes not explicitly exposed by the API. */
|
|
186
|
+
customAttributes?: CustomAttribute[];
|
|
187
|
+
/** Output only. The primary data source of the promotion. */
|
|
188
|
+
dataSource?: string;
|
|
189
|
+
/** Identifier. The name of the promotion. Format: `accounts/{account}/promotions/{promotion}` */
|
|
190
|
+
name?: string;
|
|
191
|
+
/** Required. The user provided promotion ID to uniquely identify the promotion. Follow [minimum requirements](https://support.google.com/merchants/answer/7050148?ref_topic=7322920&sjid=871860036916537104-NC#minimum_requirements) to prevent promotion disapprovals. */
|
|
192
|
+
promotionId?: string;
|
|
193
|
+
/** Output only. The [status of a promotion](https://support.google.com/merchants/answer/3398326?ref_topic=7322924&sjid=5155774230887277618-NC), data validation issues, that is, information about a promotion computed asynchronously. */
|
|
194
|
+
promotionStatus?: PromotionStatus;
|
|
195
|
+
/** Required. [Redemption channel](https://support.google.com/merchants/answer/13837674?ref_topic=13773355&sjid=17642868584668136159-NC) for the promotion. At least one channel is required. */
|
|
196
|
+
redemptionChannel?: string[];
|
|
197
|
+
/** Required. 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, [Free Listings and Shopping ads](https://support.google.com/merchants/answer/4588460) [Local Inventory ads](https://support.google.com/merchants/answer/10146326) */
|
|
198
|
+
targetCountry?: string;
|
|
199
|
+
/** Optional. Represents the existing version (freshness) of the promotion, which can be used to preserve the right order when multiple updates are done at the same time. If set, the insertion is prevented when version number is lower than the current version number of the existing promotion. Re-insertion (for example, promotion refresh after 30 days) can be performed with the current `version_number`. If the operation is prevented, the aborted exception will be thrown. */
|
|
200
|
+
versionNumber?: string;
|
|
201
|
+
}
|
|
202
|
+
interface PromotionStatus {
|
|
203
|
+
/** Output only. Date on which the promotion has been created in [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) format: Date, time, and offset, for example `2020-01-02T09:00:00+01:00` or `2020-01-02T09:00:00Z` */
|
|
204
|
+
creationDate?: string;
|
|
205
|
+
/** Output only. The intended destinations for the promotion. */
|
|
206
|
+
destinationStatuses?: DestinationStatus[];
|
|
207
|
+
/** Output only. A list of issues associated with the promotion. */
|
|
208
|
+
itemLevelIssues?: ItemLevelIssue[];
|
|
209
|
+
/** Output only. Date on which the promotion status has been last updated in [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) format: Date, time, and offset, for example `2020-01-02T09:00:00+01:00` or `2020-01-02T09:00:00Z` */
|
|
210
|
+
lastUpdateDate?: string;
|
|
211
|
+
}
|
|
212
|
+
interface PromotionsResource {
|
|
213
|
+
/** Retrieves the promotion from your Merchant Center account. After inserting or updating a promotion input, it may take several minutes before the updated promotion can be retrieved. */
|
|
214
|
+
get(request?: {
|
|
215
|
+
/** V1 error format. */
|
|
216
|
+
'$.xgafv'?: string;
|
|
217
|
+
/** OAuth access token. */
|
|
218
|
+
access_token?: string;
|
|
219
|
+
/** Data format for response. */
|
|
220
|
+
alt?: string;
|
|
221
|
+
/** JSONP */
|
|
222
|
+
callback?: string;
|
|
223
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
224
|
+
fields?: string;
|
|
225
|
+
/** 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. */
|
|
226
|
+
key?: string;
|
|
227
|
+
/** Required. The name of the promotion to retrieve. Format: `accounts/{account}/promotions/{promotions}` */
|
|
228
|
+
name: string;
|
|
229
|
+
/** OAuth 2.0 token for the current user. */
|
|
230
|
+
oauth_token?: string;
|
|
231
|
+
/** Returns response with indentations and line breaks. */
|
|
232
|
+
prettyPrint?: boolean;
|
|
233
|
+
/** 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. */
|
|
234
|
+
quotaUser?: string;
|
|
235
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
236
|
+
upload_protocol?: string;
|
|
237
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
238
|
+
uploadType?: string;
|
|
239
|
+
}): Request<Promotion>;
|
|
240
|
+
/** Inserts a promotion for your Merchant Center account. If the promotion already exists, then it updates the promotion instead. */
|
|
241
|
+
insert(request: {
|
|
242
|
+
/** V1 error format. */
|
|
243
|
+
'$.xgafv'?: string;
|
|
244
|
+
/** OAuth access token. */
|
|
245
|
+
access_token?: string;
|
|
246
|
+
/** Data format for response. */
|
|
247
|
+
alt?: string;
|
|
248
|
+
/** JSONP */
|
|
249
|
+
callback?: string;
|
|
250
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
251
|
+
fields?: string;
|
|
252
|
+
/** 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. */
|
|
253
|
+
key?: string;
|
|
254
|
+
/** OAuth 2.0 token for the current user. */
|
|
255
|
+
oauth_token?: string;
|
|
256
|
+
/** Required. The account where the promotion will be inserted. Format: accounts/{account} */
|
|
257
|
+
parent: string;
|
|
258
|
+
/** Returns response with indentations and line breaks. */
|
|
259
|
+
prettyPrint?: boolean;
|
|
260
|
+
/** 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. */
|
|
261
|
+
quotaUser?: string;
|
|
262
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
263
|
+
upload_protocol?: string;
|
|
264
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
265
|
+
uploadType?: string;
|
|
266
|
+
/** Request body */
|
|
267
|
+
resource: InsertPromotionRequest;
|
|
268
|
+
}): Request<Promotion>;
|
|
269
|
+
insert(
|
|
270
|
+
request: {
|
|
271
|
+
/** V1 error format. */
|
|
272
|
+
'$.xgafv'?: string;
|
|
273
|
+
/** OAuth access token. */
|
|
274
|
+
access_token?: string;
|
|
275
|
+
/** Data format for response. */
|
|
276
|
+
alt?: string;
|
|
277
|
+
/** JSONP */
|
|
278
|
+
callback?: string;
|
|
279
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
280
|
+
fields?: string;
|
|
281
|
+
/** 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. */
|
|
282
|
+
key?: string;
|
|
283
|
+
/** OAuth 2.0 token for the current user. */
|
|
284
|
+
oauth_token?: string;
|
|
285
|
+
/** Required. The account where the promotion will be inserted. Format: accounts/{account} */
|
|
286
|
+
parent: string;
|
|
287
|
+
/** Returns response with indentations and line breaks. */
|
|
288
|
+
prettyPrint?: boolean;
|
|
289
|
+
/** 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. */
|
|
290
|
+
quotaUser?: string;
|
|
291
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
292
|
+
upload_protocol?: string;
|
|
293
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
294
|
+
uploadType?: string;
|
|
295
|
+
},
|
|
296
|
+
body: InsertPromotionRequest,
|
|
297
|
+
): Request<Promotion>;
|
|
298
|
+
/** Lists the promotions in your Merchant Center account. The response might contain fewer items than specified by `pageSize`. Rely on `pageToken` to determine if there are more items to be requested. After inserting or updating a promotion, it may take several minutes before the updated processed promotion can be retrieved. */
|
|
299
|
+
list(request?: {
|
|
300
|
+
/** V1 error format. */
|
|
301
|
+
'$.xgafv'?: string;
|
|
302
|
+
/** OAuth access token. */
|
|
303
|
+
access_token?: string;
|
|
304
|
+
/** Data format for response. */
|
|
305
|
+
alt?: string;
|
|
306
|
+
/** JSONP */
|
|
307
|
+
callback?: string;
|
|
308
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
309
|
+
fields?: string;
|
|
310
|
+
/** 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. */
|
|
311
|
+
key?: string;
|
|
312
|
+
/** OAuth 2.0 token for the current user. */
|
|
313
|
+
oauth_token?: string;
|
|
314
|
+
/** Output only. The maximum number of promotions to return. The service may return fewer than this value. The maximum value is 250; values above 250 will be coerced to 250. If unspecified, the maximum number of promotions will be returned. */
|
|
315
|
+
pageSize?: number;
|
|
316
|
+
/** Output only. A page token, received from a previous `ListPromotions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListPromotions` must match the call that provided the page token. */
|
|
317
|
+
pageToken?: string;
|
|
318
|
+
/** Required. The account to list processed promotions for. Format: `accounts/{account}` */
|
|
319
|
+
parent: string;
|
|
320
|
+
/** Returns response with indentations and line breaks. */
|
|
321
|
+
prettyPrint?: boolean;
|
|
322
|
+
/** 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. */
|
|
323
|
+
quotaUser?: string;
|
|
324
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
325
|
+
upload_protocol?: string;
|
|
326
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
327
|
+
uploadType?: string;
|
|
328
|
+
}): Request<ListPromotionsResponse>;
|
|
329
|
+
}
|
|
330
|
+
interface AccountsResource {
|
|
331
|
+
promotions: PromotionsResource;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const accounts: AccountsResource;
|
|
335
|
+
}
|
|
336
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.merchantapi-promotions_v1",
|
|
3
|
+
"version": "0.0.20250804",
|
|
4
|
+
"description": "TypeScript typings for Merchant API promotions_v1",
|
|
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 promotions_v1
|
|
2
|
+
|
|
3
|
+
Programmatically manage your Merchant Center Accounts.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/merchant/api).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Merchant API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.merchantapi-promotions_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(
|
|
29
|
+
'https://merchantapi.googleapis.com/$discovery/rest?version=promotions_v1',
|
|
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', 'promotions_v1', () => {
|
|
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
|
+
```
|