@googleapis/merchantapi 19.0.0 → 20.0.0

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.
@@ -0,0 +1,304 @@
1
+ import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient, GaxiosResponseWithHTTP2, GoogleConfigurable, MethodOptions, StreamMethodOptions, GlobalOptions, GoogleAuth, BodyResponseCallback, APIRequestContext } from 'googleapis-common';
2
+ import { Readable } from 'stream';
3
+ export declare namespace merchantapi_loyaltycustomers_v1 {
4
+ export interface Options extends GlobalOptions {
5
+ version: 'loyaltycustomers_v1';
6
+ }
7
+ interface StandardParameters {
8
+ /**
9
+ * Auth client or API Key for the request
10
+ */
11
+ auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient | BaseExternalAccountClient | GoogleAuth;
12
+ /**
13
+ * V1 error format.
14
+ */
15
+ '$.xgafv'?: string;
16
+ /**
17
+ * OAuth access token.
18
+ */
19
+ access_token?: string;
20
+ /**
21
+ * Data format for response.
22
+ */
23
+ alt?: string;
24
+ /**
25
+ * JSONP
26
+ */
27
+ callback?: string;
28
+ /**
29
+ * Selector specifying which fields to include in a partial response.
30
+ */
31
+ fields?: string;
32
+ /**
33
+ * 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.
34
+ */
35
+ key?: string;
36
+ /**
37
+ * OAuth 2.0 token for the current user.
38
+ */
39
+ oauth_token?: string;
40
+ /**
41
+ * Returns response with indentations and line breaks.
42
+ */
43
+ prettyPrint?: boolean;
44
+ /**
45
+ * 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.
46
+ */
47
+ quotaUser?: string;
48
+ /**
49
+ * Legacy upload protocol for media (e.g. "media", "multipart").
50
+ */
51
+ uploadType?: string;
52
+ /**
53
+ * Upload protocol for media (e.g. "raw", "multipart").
54
+ */
55
+ upload_protocol?: string;
56
+ }
57
+ /**
58
+ * Merchant API
59
+ *
60
+ * Programmatically manage your Merchant Center Accounts.
61
+ *
62
+ * @example
63
+ * ```js
64
+ * const {google} = require('googleapis');
65
+ * const merchantapi = google.merchantapi('loyaltycustomers_v1');
66
+ * ```
67
+ */
68
+ export class Merchantapi {
69
+ context: APIRequestContext;
70
+ accounts: Resource$Accounts;
71
+ constructor(options: GlobalOptions, google?: GoogleConfigurable);
72
+ }
73
+ /**
74
+ * Represents a customer’s physical address.
75
+ */
76
+ export interface Schema$AddressInfo {
77
+ /**
78
+ * Optional. The city of the customer.
79
+ */
80
+ city?: string | null;
81
+ /**
82
+ * Optional. The family name of the customer.
83
+ */
84
+ familyName?: string | null;
85
+ /**
86
+ * Optional. The given name of the customer.
87
+ */
88
+ givenName?: string | null;
89
+ /**
90
+ * Optional. The postal code (zip code) of the customer. **Format Rules:** * **United States:** 5-digit zip codes (e.g., "94108").
91
+ */
92
+ postalCode?: string | null;
93
+ /**
94
+ * Optional. The Unicode country/region code (CLDR) of the customer, such as "US" or "CH". This field is case-insensitive. For more information, see https://cldr.unicode.org/ and https://www.unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html.
95
+ */
96
+ regionCode?: string | null;
97
+ /**
98
+ * Optional. The state or province of the customer.
99
+ */
100
+ state?: string | null;
101
+ }
102
+ /**
103
+ * Represents a customer’s loyalty information. Represents loyalty customer data in `ManageLoyaltyCustomerMatch` API, but is not a resource that can be retrieved or listed by other methods.
104
+ */
105
+ export interface Schema$LoyaltyCustomer {
106
+ /**
107
+ * Required. The tier label of the loyalty tier the customer belongs to.
108
+ */
109
+ loyaltyTier?: string | null;
110
+ /**
111
+ * Optional. The point balance of the loyalty customer.
112
+ */
113
+ pointBalance?: string | null;
114
+ /**
115
+ * Required. The identifiers for the customer.
116
+ */
117
+ userIdentifier?: Schema$UserIdentifier;
118
+ }
119
+ /**
120
+ * Request message for the ManageLoyaltyCustomerMatch method.
121
+ */
122
+ export interface Schema$ManageLoyaltyCustomerMatchRequest {
123
+ /**
124
+ * Required. The loyalty customer to insert, update, or remove.
125
+ */
126
+ loyaltyCustomer?: Schema$LoyaltyCustomer;
127
+ }
128
+ /**
129
+ * Response message for the ManageLoyaltyCustomerMatch method.
130
+ */
131
+ export interface Schema$ManageLoyaltyCustomerMatchResponse {
132
+ /**
133
+ * The loyalty customer that was inserted, updated, or removed. If the customer's identifier cannot be matched to a Google account or if the user has not opted into loyalty personalization, this field will contain a default `LoyaltyCustomer` instance.
134
+ */
135
+ loyaltyCustomer?: Schema$LoyaltyCustomer;
136
+ }
137
+ /**
138
+ * The change that happened to the product including old value, new value, country code as the region code and reporting context.
139
+ */
140
+ export interface Schema$ProductChange {
141
+ /**
142
+ * 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`, ``)
143
+ */
144
+ newValue?: string | null;
145
+ /**
146
+ * 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`, ``)
147
+ */
148
+ oldValue?: string | null;
149
+ /**
150
+ * Countries that have the change (if applicable). Represented in the ISO 3166 format.
151
+ */
152
+ regionCode?: string | null;
153
+ /**
154
+ * 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)
155
+ */
156
+ reportingContext?: string | null;
157
+ }
158
+ /**
159
+ * The message that the merchant will receive to notify about product status change event
160
+ */
161
+ export interface Schema$ProductStatusChangeMessage {
162
+ /**
163
+ * The target account that owns the entity that changed. Format : `accounts/{merchant_id\}`
164
+ */
165
+ account?: string | null;
166
+ /**
167
+ * The attribute in the resource that changed, in this case it will be always `Status`.
168
+ */
169
+ attribute?: string | null;
170
+ /**
171
+ * A message to describe the change that happened to the product
172
+ */
173
+ changes?: Schema$ProductChange[];
174
+ /**
175
+ * 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.
176
+ */
177
+ eventTime?: string | null;
178
+ /**
179
+ * Optional. The product expiration time. This field will not be set if the notification is sent for a product deletion event.
180
+ */
181
+ expirationTime?: string | null;
182
+ /**
183
+ * 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\}`
184
+ */
185
+ managingAccount?: string | null;
186
+ /**
187
+ * The product name. Format: `accounts/{account\}/products/{product\}`
188
+ */
189
+ resource?: string | null;
190
+ /**
191
+ * The product id.
192
+ */
193
+ resourceId?: string | null;
194
+ /**
195
+ * The resource that changed, in this case it will always be `Product`.
196
+ */
197
+ resourceType?: string | null;
198
+ }
199
+ /**
200
+ * The user identifiers associated with the customer. At least one of the fields within this message must be provided.
201
+ */
202
+ export interface Schema$UserIdentifier {
203
+ /**
204
+ * Optional. The customer’s physical address.
205
+ */
206
+ address?: Schema$AddressInfo;
207
+ /**
208
+ * Optional. The customer’s email address.
209
+ */
210
+ emailAddress?: string | null;
211
+ /**
212
+ * Optional. The customer's phone number, in [E.164 format](https://support.google.com/google-ads/answer/16355235) (e.g., "+16502530000").
213
+ */
214
+ phoneNumber?: string | null;
215
+ }
216
+ export class Resource$Accounts {
217
+ context: APIRequestContext;
218
+ loyaltyCustomers: Resource$Accounts$Loyaltycustomers;
219
+ constructor(context: APIRequestContext);
220
+ }
221
+ export class Resource$Accounts$Loyaltycustomers {
222
+ context: APIRequestContext;
223
+ constructor(context: APIRequestContext);
224
+ /**
225
+ * Manages (inserts, updates, or removes) a customer's loyalty tier information. This method serves as a single interface for all changes to a customer's loyalty status. The specific action (insert, update, or remove) is determined by the current state of the merchant-to-customer association and the `loyalty_tier` value provided in the request. **Operation Logic:** * **Upsert (Insert/Update):** Providing any valid tier other than `NON_MEMBER` will associate the customer with that tier. If an association already exists, it will be updated; otherwise, a new one will be created. * **Removal:** Setting `loyalty_tier` to `NON_MEMBER` will remove any existing loyalty association for the customer. **Privacy Note:** To protect user privacy, this method consistently returns a `200 OK` status with a default `LoyaltyCustomer` response if the customer's identifier cannot be matched to a Google account or if the user has not opted into loyalty personalization.
226
+ * @example
227
+ * ```js
228
+ * // Before running the sample:
229
+ * // - Enable the API at:
230
+ * // https://console.developers.google.com/apis/api/merchantapi.googleapis.com
231
+ * // - Login into gcloud by running:
232
+ * // ```sh
233
+ * // $ gcloud auth application-default login
234
+ * // ```
235
+ * // - Install the npm module by running:
236
+ * // ```sh
237
+ * // $ npm install googleapis
238
+ * // ```
239
+ *
240
+ * const {google} = require('googleapis');
241
+ * const merchantapi = google.merchantapi('loyaltycustomers_v1');
242
+ *
243
+ * async function main() {
244
+ * const auth = new google.auth.GoogleAuth({
245
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
246
+ * scopes: ['https://www.googleapis.com/auth/content'],
247
+ * });
248
+ *
249
+ * // Acquire an auth client, and bind it to all future calls
250
+ * const authClient = await auth.getClient();
251
+ * google.options({auth: authClient});
252
+ *
253
+ * // Do the magic
254
+ * const res = await merchantapi.accounts.loyaltyCustomers.manage({
255
+ * // Required. The parent account where this loyalty customer will be handled. Format: `accounts/{account\}`
256
+ * parent: 'accounts/my-account',
257
+ *
258
+ * // Request body metadata
259
+ * requestBody: {
260
+ * // request body parameters
261
+ * // {
262
+ * // "loyaltyCustomer": {}
263
+ * // }
264
+ * },
265
+ * });
266
+ * console.log(res.data);
267
+ *
268
+ * // Example response
269
+ * // {
270
+ * // "loyaltyCustomer": {}
271
+ * // }
272
+ * }
273
+ *
274
+ * main().catch(e => {
275
+ * console.error(e);
276
+ * throw e;
277
+ * });
278
+ *
279
+ * ```
280
+ *
281
+ * @param params - Parameters for request
282
+ * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
283
+ * @param callback - Optional callback that handles the response.
284
+ * @returns A promise if used with async/await, or void if used with a callback.
285
+ */
286
+ manage(params: Params$Resource$Accounts$Loyaltycustomers$Manage, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
287
+ manage(params?: Params$Resource$Accounts$Loyaltycustomers$Manage, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$ManageLoyaltyCustomerMatchResponse>>;
288
+ manage(params: Params$Resource$Accounts$Loyaltycustomers$Manage, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
289
+ manage(params: Params$Resource$Accounts$Loyaltycustomers$Manage, options: MethodOptions | BodyResponseCallback<Schema$ManageLoyaltyCustomerMatchResponse>, callback: BodyResponseCallback<Schema$ManageLoyaltyCustomerMatchResponse>): void;
290
+ manage(params: Params$Resource$Accounts$Loyaltycustomers$Manage, callback: BodyResponseCallback<Schema$ManageLoyaltyCustomerMatchResponse>): void;
291
+ manage(callback: BodyResponseCallback<Schema$ManageLoyaltyCustomerMatchResponse>): void;
292
+ }
293
+ export interface Params$Resource$Accounts$Loyaltycustomers$Manage extends StandardParameters {
294
+ /**
295
+ * Required. The parent account where this loyalty customer will be handled. Format: `accounts/{account\}`
296
+ */
297
+ parent?: string;
298
+ /**
299
+ * Request body metadata
300
+ */
301
+ requestBody?: Schema$ManageLoyaltyCustomerMatchRequest;
302
+ }
303
+ export {};
304
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ // Copyright 2020 Google LLC
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.merchantapi_loyaltycustomers_v1 = void 0;
16
+ /* eslint-disable @typescript-eslint/no-explicit-any */
17
+ /* eslint-disable @typescript-eslint/no-unused-vars */
18
+ /* eslint-disable @typescript-eslint/no-empty-interface */
19
+ /* eslint-disable @typescript-eslint/no-namespace */
20
+ /* eslint-disable no-irregular-whitespace */
21
+ const googleapis_common_1 = require("googleapis-common");
22
+ var merchantapi_loyaltycustomers_v1;
23
+ (function (merchantapi_loyaltycustomers_v1) {
24
+ /**
25
+ * Merchant API
26
+ *
27
+ * Programmatically manage your Merchant Center Accounts.
28
+ *
29
+ * @example
30
+ * ```js
31
+ * const {google} = require('googleapis');
32
+ * const merchantapi = google.merchantapi('loyaltycustomers_v1');
33
+ * ```
34
+ */
35
+ class Merchantapi {
36
+ context;
37
+ accounts;
38
+ constructor(options, google) {
39
+ this.context = {
40
+ _options: options || {},
41
+ google,
42
+ };
43
+ this.accounts = new Resource$Accounts(this.context);
44
+ }
45
+ }
46
+ merchantapi_loyaltycustomers_v1.Merchantapi = Merchantapi;
47
+ class Resource$Accounts {
48
+ context;
49
+ loyaltyCustomers;
50
+ constructor(context) {
51
+ this.context = context;
52
+ this.loyaltyCustomers = new Resource$Accounts$Loyaltycustomers(this.context);
53
+ }
54
+ }
55
+ merchantapi_loyaltycustomers_v1.Resource$Accounts = Resource$Accounts;
56
+ class Resource$Accounts$Loyaltycustomers {
57
+ context;
58
+ constructor(context) {
59
+ this.context = context;
60
+ }
61
+ manage(paramsOrCallback, optionsOrCallback, callback) {
62
+ let params = (paramsOrCallback ||
63
+ {});
64
+ let options = (optionsOrCallback || {});
65
+ if (typeof paramsOrCallback === 'function') {
66
+ callback = paramsOrCallback;
67
+ params = {};
68
+ options = {};
69
+ }
70
+ if (typeof optionsOrCallback === 'function') {
71
+ callback = optionsOrCallback;
72
+ options = {};
73
+ }
74
+ const rootUrl = options.rootUrl || 'https://merchantapi.googleapis.com/';
75
+ const parameters = {
76
+ options: Object.assign({
77
+ url: (rootUrl + '/loyaltyCustomers/v1/{+parent}/loyaltyCustomers:manage').replace(/([^:]\/)\/+/g, '$1'),
78
+ method: 'POST',
79
+ apiVersion: '',
80
+ }, options),
81
+ params,
82
+ requiredParams: ['parent'],
83
+ pathParams: ['parent'],
84
+ context: this.context,
85
+ };
86
+ if (callback) {
87
+ (0, googleapis_common_1.createAPIRequest)(parameters, callback);
88
+ }
89
+ else {
90
+ return (0, googleapis_common_1.createAPIRequest)(parameters);
91
+ }
92
+ }
93
+ }
94
+ merchantapi_loyaltycustomers_v1.Resource$Accounts$Loyaltycustomers = Resource$Accounts$Loyaltycustomers;
95
+ })(merchantapi_loyaltycustomers_v1 || (exports.merchantapi_loyaltycustomers_v1 = merchantapi_loyaltycustomers_v1 = {}));
96
+ //# sourceMappingURL=loyaltycustomers_v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyaltycustomers_v1.js","sourceRoot":"","sources":["../loyaltycustomers_v1.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uDAAuD;AACvD,sDAAsD;AACtD,0DAA0D;AAC1D,oDAAoD;AACpD,4CAA4C;AAE5C,yDAe2B;AAG3B,IAAiB,+BAA+B,CAga/C;AAhaD,WAAiB,+BAA+B;IAgE9C;;;;;;;;;;OAUG;IACH,MAAa,WAAW;QACtB,OAAO,CAAoB;QAC3B,QAAQ,CAAoB;QAE5B,YAAY,OAAsB,EAAE,MAA2B;YAC7D,IAAI,CAAC,OAAO,GAAG;gBACb,QAAQ,EAAE,OAAO,IAAI,EAAE;gBACvB,MAAM;aACP,CAAC;YAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC;KACF;IAZY,2CAAW,cAYvB,CAAA;IAkJD,MAAa,iBAAiB;QAC5B,OAAO,CAAoB;QAC3B,gBAAgB,CAAqC;QACrD,YAAY,OAA0B;YACpC,IAAI,CAAC,OAAO,GA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