ultracart_rest_api_v2_typescript 4.1.135 → 4.1.136

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.
@@ -39,6 +39,8 @@ src/models/Activity.ts
39
39
  src/models/AddLibraryItemRequest.ts
40
40
  src/models/AdjustInternalCertificateRequest.ts
41
41
  src/models/AdjustInternalCertificateResponse.ts
42
+ src/models/AdjustLoyaltyPointsRequest.ts
43
+ src/models/AdjustLoyaltyPointsResponse.ts
42
44
  src/models/Affiliate.ts
43
45
  src/models/AffiliateAttribute.ts
44
46
  src/models/AffiliateClick.ts
@@ -471,6 +473,7 @@ src/models/CustomerEmailSuppressionResult.ts
471
473
  src/models/CustomerLoyalty.ts
472
474
  src/models/CustomerLoyaltyLedger.ts
473
475
  src/models/CustomerLoyaltyRedemption.ts
476
+ src/models/CustomerLoyaltyResponse.ts
474
477
  src/models/CustomerMagicLinkResponse.ts
475
478
  src/models/CustomerMergeRequest.ts
476
479
  src/models/CustomerOrdersSummary.ts
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # UltraCart Typescript SDK
2
- ## ultracart_rest_api_v2_typescript@4.1.135
2
+ ## ultracart_rest_api_v2_typescript@4.1.136
3
3
 
4
4
  Every API method call has a sample for every language SDK. See https://github.com/UltraCart/sdk_samples
5
5
 
6
6
  Installation
7
7
 
8
8
  ```
9
- npm install ultracart_rest_api_v2_typescript@4.1.135 --save
9
+ npm install ultracart_rest_api_v2_typescript@4.1.136 --save
10
10
  ```
11
11
 
12
12
  ```typescript
@@ -85,6 +85,7 @@ Not every change is committed to every SDK.
85
85
 
86
86
  | Version | Date | Comments |
87
87
  | --: | :-: | --- |
88
+ | 4.1.136 | 08/24/2026 | customer api - adjust method for loyalty points |
88
89
  | 4.1.135 | 08/21/2026 | conversation pbx - support send text operation as a menu item froma different phone number |
89
90
  | 4.1.134 | 08/21/2026 | conversation - pbx menu mapping for send text |
90
91
  | 4.1.133 | 08/20/2026 | conversations - pbx agent setting for creating tickets in zoho desk for outgoing calls |
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import { AdjustInternalCertificateRequest, AdjustInternalCertificateResponse, BaseResponse, Customer, CustomerEditorValues, CustomerEmailListChanges, CustomerEmailSuppressionRequest, CustomerEmailSuppressionResponse, CustomerMagicLinkResponse, CustomerMergeRequest, CustomerQuery, CustomerResponse, CustomerStoreCreditAddRequest, CustomerStoreCreditResponse, CustomerWishListItem, CustomerWishListItemResponse, CustomerWishListItemsResponse, CustomersResponse, DataTablesServerSideResponse, EmailListsResponse, EmailVerifyTokenRequest, EmailVerifyTokenResponse, EmailVerifyTokenValidateRequest, EmailVerifyTokenValidateResponse, LookupRequest, LookupResponse, QuickBooksOnlineCustomersResponse } from '../models';
13
+ import { AdjustInternalCertificateRequest, AdjustInternalCertificateResponse, AdjustLoyaltyPointsRequest, AdjustLoyaltyPointsResponse, BaseResponse, Customer, CustomerEditorValues, CustomerEmailListChanges, CustomerEmailSuppressionRequest, CustomerEmailSuppressionResponse, CustomerLoyaltyResponse, CustomerMagicLinkResponse, CustomerMergeRequest, CustomerQuery, CustomerResponse, CustomerStoreCreditAddRequest, CustomerStoreCreditResponse, CustomerWishListItem, CustomerWishListItemResponse, CustomerWishListItemsResponse, CustomersResponse, DataTablesServerSideResponse, EmailListsResponse, EmailVerifyTokenRequest, EmailVerifyTokenResponse, EmailVerifyTokenValidateRequest, EmailVerifyTokenValidateResponse, LookupRequest, LookupResponse, QuickBooksOnlineCustomersResponse } from '../models';
14
14
  export interface AddCustomerStoreCreditRequest {
15
15
  customerProfileOid: number;
16
16
  storeCreditRequest: CustomerStoreCreditAddRequest;
@@ -19,6 +19,10 @@ export interface AdjustInternalCertificateOperationRequest {
19
19
  customerProfileOid: number;
20
20
  adjustInternalCertificateRequest: AdjustInternalCertificateRequest;
21
21
  }
22
+ export interface AdjustLoyaltyPointsOperationRequest {
23
+ customerProfileOid: number;
24
+ adjustLoyaltyPointsRequest: AdjustLoyaltyPointsRequest;
25
+ }
22
26
  export interface DeleteCustomerRequest {
23
27
  customerProfileOid: number;
24
28
  }
@@ -34,6 +38,9 @@ export interface GetCustomerByEmailRequest {
34
38
  email: string;
35
39
  expand?: string;
36
40
  }
41
+ export interface GetCustomerLoyaltyRequest {
42
+ customerProfileOid: number;
43
+ }
37
44
  export interface GetCustomerStoreCreditRequest {
38
45
  customerProfileOid: number;
39
46
  }
@@ -183,6 +190,21 @@ export interface CustomerApiInterface {
183
190
  * Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed.
184
191
  */
185
192
  adjustInternalCertificate(requestParameters: AdjustInternalCertificateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustInternalCertificateResponse>;
193
+ /**
194
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
195
+ * @summary Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
196
+ * @param {number} customerProfileOid The customer profile oid
197
+ * @param {AdjustLoyaltyPointsRequest} adjustLoyaltyPointsRequest adjustLoyaltyPointsRequest
198
+ * @param {*} [options] Override http request option.
199
+ * @throws {RequiredError}
200
+ * @memberof CustomerApiInterface
201
+ */
202
+ adjustLoyaltyPointsRaw(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdjustLoyaltyPointsResponse>>;
203
+ /**
204
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
205
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
206
+ */
207
+ adjustLoyaltyPoints(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustLoyaltyPointsResponse>;
186
208
  /**
187
209
  * Delete a customer on the UltraCart account.
188
210
  * @summary Delete a customer
@@ -268,6 +290,20 @@ export interface CustomerApiInterface {
268
290
  * Retrieve all email lists across all storefronts
269
291
  */
270
292
  getCustomerEmailLists(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmailListsResponse>;
293
+ /**
294
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
295
+ * @summary Retrieve the loyalty points, ledger and redemptions for a customer
296
+ * @param {number} customerProfileOid The customer oid to retrieve.
297
+ * @param {*} [options] Override http request option.
298
+ * @throws {RequiredError}
299
+ * @memberof CustomerApiInterface
300
+ */
301
+ getCustomerLoyaltyRaw(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CustomerLoyaltyResponse>>;
302
+ /**
303
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
304
+ * Retrieve the loyalty points, ledger and redemptions for a customer
305
+ */
306
+ getCustomerLoyalty(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CustomerLoyaltyResponse>;
271
307
  /**
272
308
  * Retrieve the customer store credit accumulated through loyalty programs
273
309
  * @summary Retrieve the customer store credit accumulated through loyalty programs
@@ -613,6 +649,16 @@ export declare class CustomerApi extends runtime.BaseAPI implements CustomerApiI
613
649
  * Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed.
614
650
  */
615
651
  adjustInternalCertificate(requestParameters: AdjustInternalCertificateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustInternalCertificateResponse>;
652
+ /**
653
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
654
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
655
+ */
656
+ adjustLoyaltyPointsRaw(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdjustLoyaltyPointsResponse>>;
657
+ /**
658
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
659
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
660
+ */
661
+ adjustLoyaltyPoints(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustLoyaltyPointsResponse>;
616
662
  /**
617
663
  * Delete a customer on the UltraCart account.
618
664
  * Delete a customer
@@ -673,6 +719,16 @@ export declare class CustomerApi extends runtime.BaseAPI implements CustomerApiI
673
719
  * Retrieve all email lists across all storefronts
674
720
  */
675
721
  getCustomerEmailLists(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmailListsResponse>;
722
+ /**
723
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
724
+ * Retrieve the loyalty points, ledger and redemptions for a customer
725
+ */
726
+ getCustomerLoyaltyRaw(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CustomerLoyaltyResponse>>;
727
+ /**
728
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
729
+ * Retrieve the loyalty points, ledger and redemptions for a customer
730
+ */
731
+ getCustomerLoyalty(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CustomerLoyaltyResponse>;
676
732
  /**
677
733
  * Retrieve the customer store credit accumulated through loyalty programs
678
734
  * Retrieve the customer store credit accumulated through loyalty programs
@@ -203,6 +203,70 @@ var CustomerApi = /** @class */ (function (_super) {
203
203
  });
204
204
  });
205
205
  };
206
+ /**
207
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
208
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
209
+ */
210
+ CustomerApi.prototype.adjustLoyaltyPointsRaw = function (requestParameters, initOverrides) {
211
+ return __awaiter(this, void 0, void 0, function () {
212
+ var queryParameters, headerParameters, _a, _b, response;
213
+ return __generator(this, function (_c) {
214
+ switch (_c.label) {
215
+ case 0:
216
+ if (requestParameters.customerProfileOid === null || requestParameters.customerProfileOid === undefined) {
217
+ throw new runtime.RequiredError('customerProfileOid', 'Required parameter requestParameters.customerProfileOid was null or undefined when calling adjustLoyaltyPoints.');
218
+ }
219
+ if (requestParameters.adjustLoyaltyPointsRequest === null || requestParameters.adjustLoyaltyPointsRequest === undefined) {
220
+ throw new runtime.RequiredError('adjustLoyaltyPointsRequest', 'Required parameter requestParameters.adjustLoyaltyPointsRequest was null or undefined when calling adjustLoyaltyPoints.');
221
+ }
222
+ queryParameters = {};
223
+ headerParameters = {};
224
+ headerParameters['Content-Type'] = 'application/json; charset=UTF-8';
225
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
226
+ // oauth required
227
+ _a = headerParameters;
228
+ _b = "Authorization";
229
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["customer_write"])];
230
+ case 1:
231
+ // oauth required
232
+ _a[_b] = _c.sent();
233
+ _c.label = 2;
234
+ case 2:
235
+ if (this.configuration && this.configuration.apiKey) {
236
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
237
+ }
238
+ return [4 /*yield*/, this.request({
239
+ path: "/customer/customers/{customer_profile_oid}/adjust_loyalty_points".replace("{".concat("customer_profile_oid", "}"), encodeURIComponent(String(requestParameters.customerProfileOid))),
240
+ method: 'POST',
241
+ headers: headerParameters,
242
+ query: queryParameters,
243
+ body: (0, models_1.AdjustLoyaltyPointsRequestToJSON)(requestParameters.adjustLoyaltyPointsRequest),
244
+ }, initOverrides)];
245
+ case 3:
246
+ response = _c.sent();
247
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.AdjustLoyaltyPointsResponseFromJSON)(jsonValue); })];
248
+ }
249
+ });
250
+ });
251
+ };
252
+ /**
253
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
254
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
255
+ */
256
+ CustomerApi.prototype.adjustLoyaltyPoints = function (requestParameters, initOverrides) {
257
+ return __awaiter(this, void 0, void 0, function () {
258
+ var response;
259
+ return __generator(this, function (_a) {
260
+ switch (_a.label) {
261
+ case 0: return [4 /*yield*/, this.adjustLoyaltyPointsRaw(requestParameters, initOverrides)];
262
+ case 1:
263
+ response = _a.sent();
264
+ return [4 /*yield*/, response.value()];
265
+ case 2: return [2 /*return*/, _a.sent()];
266
+ }
267
+ });
268
+ });
269
+ };
206
270
  /**
207
271
  * Delete a customer on the UltraCart account.
208
272
  * Delete a customer
@@ -556,6 +620,65 @@ var CustomerApi = /** @class */ (function (_super) {
556
620
  });
557
621
  });
558
622
  };
623
+ /**
624
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
625
+ * Retrieve the loyalty points, ledger and redemptions for a customer
626
+ */
627
+ CustomerApi.prototype.getCustomerLoyaltyRaw = function (requestParameters, initOverrides) {
628
+ return __awaiter(this, void 0, void 0, function () {
629
+ var queryParameters, headerParameters, _a, _b, response;
630
+ return __generator(this, function (_c) {
631
+ switch (_c.label) {
632
+ case 0:
633
+ if (requestParameters.customerProfileOid === null || requestParameters.customerProfileOid === undefined) {
634
+ throw new runtime.RequiredError('customerProfileOid', 'Required parameter requestParameters.customerProfileOid was null or undefined when calling getCustomerLoyalty.');
635
+ }
636
+ queryParameters = {};
637
+ headerParameters = {};
638
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
639
+ // oauth required
640
+ _a = headerParameters;
641
+ _b = "Authorization";
642
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["customer_read"])];
643
+ case 1:
644
+ // oauth required
645
+ _a[_b] = _c.sent();
646
+ _c.label = 2;
647
+ case 2:
648
+ if (this.configuration && this.configuration.apiKey) {
649
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
650
+ }
651
+ return [4 /*yield*/, this.request({
652
+ path: "/customer/customers/{customer_profile_oid}/loyalty".replace("{".concat("customer_profile_oid", "}"), encodeURIComponent(String(requestParameters.customerProfileOid))),
653
+ method: 'GET',
654
+ headers: headerParameters,
655
+ query: queryParameters,
656
+ }, initOverrides)];
657
+ case 3:
658
+ response = _c.sent();
659
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.CustomerLoyaltyResponseFromJSON)(jsonValue); })];
660
+ }
661
+ });
662
+ });
663
+ };
664
+ /**
665
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
666
+ * Retrieve the loyalty points, ledger and redemptions for a customer
667
+ */
668
+ CustomerApi.prototype.getCustomerLoyalty = function (requestParameters, initOverrides) {
669
+ return __awaiter(this, void 0, void 0, function () {
670
+ var response;
671
+ return __generator(this, function (_a) {
672
+ switch (_a.label) {
673
+ case 0: return [4 /*yield*/, this.getCustomerLoyaltyRaw(requestParameters, initOverrides)];
674
+ case 1:
675
+ response = _a.sent();
676
+ return [4 /*yield*/, response.value()];
677
+ case 2: return [2 /*return*/, _a.sent()];
678
+ }
679
+ });
680
+ });
681
+ };
559
682
  /**
560
683
  * Retrieve the customer store credit accumulated through loyalty programs
561
684
  * Retrieve the customer store credit accumulated through loyalty programs
@@ -0,0 +1,49 @@
1
+ /**
2
+ * UltraCart Rest API V2
3
+ * UltraCart REST API Version 2
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ * Contact: support@ultracart.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface AdjustLoyaltyPointsRequest
16
+ */
17
+ export interface AdjustLoyaltyPointsRequest {
18
+ /**
19
+ * Description of this adjustment, 200 characters max
20
+ * @type {string}
21
+ * @memberof AdjustLoyaltyPointsRequest
22
+ */
23
+ description?: string;
24
+ /**
25
+ * The number of loyalty points to add to the ledger. Use a negative number to debit points. Required and may not be zero.
26
+ * @type {number}
27
+ * @memberof AdjustLoyaltyPointsRequest
28
+ */
29
+ loyalty_points?: number;
30
+ /**
31
+ * Optional order id if this adjustment is related to a particular order
32
+ * @type {string}
33
+ * @memberof AdjustLoyaltyPointsRequest
34
+ */
35
+ order_id?: string;
36
+ /**
37
+ * Optional days required for this adjustment to vest. Leave null to use the merchant configured default. Use zero for immediate vesting.
38
+ * @type {number}
39
+ * @memberof AdjustLoyaltyPointsRequest
40
+ */
41
+ vesting_days?: number;
42
+ }
43
+ /**
44
+ * Check if a given object implements the AdjustLoyaltyPointsRequest interface.
45
+ */
46
+ export declare function instanceOfAdjustLoyaltyPointsRequest(value: object): boolean;
47
+ export declare function AdjustLoyaltyPointsRequestFromJSON(json: any): AdjustLoyaltyPointsRequest;
48
+ export declare function AdjustLoyaltyPointsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdjustLoyaltyPointsRequest;
49
+ export declare function AdjustLoyaltyPointsRequestToJSON(value?: AdjustLoyaltyPointsRequest | null): any;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * UltraCart Rest API V2
6
+ * UltraCart REST API Version 2
7
+ *
8
+ * The version of the OpenAPI document: 2.0.0
9
+ * Contact: support@ultracart.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.AdjustLoyaltyPointsRequestToJSON = exports.AdjustLoyaltyPointsRequestFromJSONTyped = exports.AdjustLoyaltyPointsRequestFromJSON = exports.instanceOfAdjustLoyaltyPointsRequest = void 0;
17
+ var runtime_1 = require("../runtime");
18
+ /**
19
+ * Check if a given object implements the AdjustLoyaltyPointsRequest interface.
20
+ */
21
+ function instanceOfAdjustLoyaltyPointsRequest(value) {
22
+ var isInstance = true;
23
+ return isInstance;
24
+ }
25
+ exports.instanceOfAdjustLoyaltyPointsRequest = instanceOfAdjustLoyaltyPointsRequest;
26
+ function AdjustLoyaltyPointsRequestFromJSON(json) {
27
+ return AdjustLoyaltyPointsRequestFromJSONTyped(json, false);
28
+ }
29
+ exports.AdjustLoyaltyPointsRequestFromJSON = AdjustLoyaltyPointsRequestFromJSON;
30
+ function AdjustLoyaltyPointsRequestFromJSONTyped(json, ignoreDiscriminator) {
31
+ if ((json === undefined) || (json === null)) {
32
+ return json;
33
+ }
34
+ return {
35
+ 'description': !(0, runtime_1.exists)(json, 'description') ? undefined : json['description'],
36
+ 'loyalty_points': !(0, runtime_1.exists)(json, 'loyalty_points') ? undefined : json['loyalty_points'],
37
+ 'order_id': !(0, runtime_1.exists)(json, 'order_id') ? undefined : json['order_id'],
38
+ 'vesting_days': !(0, runtime_1.exists)(json, 'vesting_days') ? undefined : json['vesting_days'],
39
+ };
40
+ }
41
+ exports.AdjustLoyaltyPointsRequestFromJSONTyped = AdjustLoyaltyPointsRequestFromJSONTyped;
42
+ function AdjustLoyaltyPointsRequestToJSON(value) {
43
+ if (value === undefined) {
44
+ return undefined;
45
+ }
46
+ if (value === null) {
47
+ return null;
48
+ }
49
+ return {
50
+ 'description': value.description,
51
+ 'loyalty_points': value.loyalty_points,
52
+ 'order_id': value.order_id,
53
+ 'vesting_days': value.vesting_days,
54
+ };
55
+ }
56
+ exports.AdjustLoyaltyPointsRequestToJSON = AdjustLoyaltyPointsRequestToJSON;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * UltraCart Rest API V2
3
+ * UltraCart REST API Version 2
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ * Contact: support@ultracart.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { ModelError } from './ModelError';
13
+ import { ResponseMetadata } from './ResponseMetadata';
14
+ import { Warning } from './Warning';
15
+ /**
16
+ *
17
+ * @export
18
+ * @interface AdjustLoyaltyPointsResponse
19
+ */
20
+ export interface AdjustLoyaltyPointsResponse {
21
+ /**
22
+ * The current (vested) points balance after the adjustment was made
23
+ * @type {number}
24
+ * @memberof AdjustLoyaltyPointsResponse
25
+ */
26
+ current_points?: number;
27
+ /**
28
+ *
29
+ * @type {ModelError}
30
+ * @memberof AdjustLoyaltyPointsResponse
31
+ */
32
+ error?: ModelError;
33
+ /**
34
+ * The loyalty points adjustment that was written to the ledger
35
+ * @type {number}
36
+ * @memberof AdjustLoyaltyPointsResponse
37
+ */
38
+ loyalty_points?: number;
39
+ /**
40
+ *
41
+ * @type {ResponseMetadata}
42
+ * @memberof AdjustLoyaltyPointsResponse
43
+ */
44
+ metadata?: ResponseMetadata;
45
+ /**
46
+ * The pending (unvested) points balance after the adjustment was made
47
+ * @type {number}
48
+ * @memberof AdjustLoyaltyPointsResponse
49
+ */
50
+ pending_points?: number;
51
+ /**
52
+ * Indicates if API call was successful
53
+ * @type {boolean}
54
+ * @memberof AdjustLoyaltyPointsResponse
55
+ */
56
+ success?: boolean;
57
+ /**
58
+ *
59
+ * @type {Warning}
60
+ * @memberof AdjustLoyaltyPointsResponse
61
+ */
62
+ warning?: Warning;
63
+ }
64
+ /**
65
+ * Check if a given object implements the AdjustLoyaltyPointsResponse interface.
66
+ */
67
+ export declare function instanceOfAdjustLoyaltyPointsResponse(value: object): boolean;
68
+ export declare function AdjustLoyaltyPointsResponseFromJSON(json: any): AdjustLoyaltyPointsResponse;
69
+ export declare function AdjustLoyaltyPointsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdjustLoyaltyPointsResponse;
70
+ export declare function AdjustLoyaltyPointsResponseToJSON(value?: AdjustLoyaltyPointsResponse | null): any;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * UltraCart Rest API V2
6
+ * UltraCart REST API Version 2
7
+ *
8
+ * The version of the OpenAPI document: 2.0.0
9
+ * Contact: support@ultracart.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.AdjustLoyaltyPointsResponseToJSON = exports.AdjustLoyaltyPointsResponseFromJSONTyped = exports.AdjustLoyaltyPointsResponseFromJSON = exports.instanceOfAdjustLoyaltyPointsResponse = void 0;
17
+ var runtime_1 = require("../runtime");
18
+ var ModelError_1 = require("./ModelError");
19
+ var ResponseMetadata_1 = require("./ResponseMetadata");
20
+ var Warning_1 = require("./Warning");
21
+ /**
22
+ * Check if a given object implements the AdjustLoyaltyPointsResponse interface.
23
+ */
24
+ function instanceOfAdjustLoyaltyPointsResponse(value) {
25
+ var isInstance = true;
26
+ return isInstance;
27
+ }
28
+ exports.instanceOfAdjustLoyaltyPointsResponse = instanceOfAdjustLoyaltyPointsResponse;
29
+ function AdjustLoyaltyPointsResponseFromJSON(json) {
30
+ return AdjustLoyaltyPointsResponseFromJSONTyped(json, false);
31
+ }
32
+ exports.AdjustLoyaltyPointsResponseFromJSON = AdjustLoyaltyPointsResponseFromJSON;
33
+ function AdjustLoyaltyPointsResponseFromJSONTyped(json, ignoreDiscriminator) {
34
+ if ((json === undefined) || (json === null)) {
35
+ return json;
36
+ }
37
+ return {
38
+ 'current_points': !(0, runtime_1.exists)(json, 'current_points') ? undefined : json['current_points'],
39
+ 'error': !(0, runtime_1.exists)(json, 'error') ? undefined : (0, ModelError_1.ModelErrorFromJSON)(json['error']),
40
+ 'loyalty_points': !(0, runtime_1.exists)(json, 'loyalty_points') ? undefined : json['loyalty_points'],
41
+ 'metadata': !(0, runtime_1.exists)(json, 'metadata') ? undefined : (0, ResponseMetadata_1.ResponseMetadataFromJSON)(json['metadata']),
42
+ 'pending_points': !(0, runtime_1.exists)(json, 'pending_points') ? undefined : json['pending_points'],
43
+ 'success': !(0, runtime_1.exists)(json, 'success') ? undefined : json['success'],
44
+ 'warning': !(0, runtime_1.exists)(json, 'warning') ? undefined : (0, Warning_1.WarningFromJSON)(json['warning']),
45
+ };
46
+ }
47
+ exports.AdjustLoyaltyPointsResponseFromJSONTyped = AdjustLoyaltyPointsResponseFromJSONTyped;
48
+ function AdjustLoyaltyPointsResponseToJSON(value) {
49
+ if (value === undefined) {
50
+ return undefined;
51
+ }
52
+ if (value === null) {
53
+ return null;
54
+ }
55
+ return {
56
+ 'current_points': value.current_points,
57
+ 'error': (0, ModelError_1.ModelErrorToJSON)(value.error),
58
+ 'loyalty_points': value.loyalty_points,
59
+ 'metadata': (0, ResponseMetadata_1.ResponseMetadataToJSON)(value.metadata),
60
+ 'pending_points': value.pending_points,
61
+ 'success': value.success,
62
+ 'warning': (0, Warning_1.WarningToJSON)(value.warning),
63
+ };
64
+ }
65
+ exports.AdjustLoyaltyPointsResponseToJSON = AdjustLoyaltyPointsResponseToJSON;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * UltraCart Rest API V2
3
+ * UltraCart REST API Version 2
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ * Contact: support@ultracart.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { CustomerLoyalty } from './CustomerLoyalty';
13
+ import { ModelError } from './ModelError';
14
+ import { ResponseMetadata } from './ResponseMetadata';
15
+ import { Warning } from './Warning';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface CustomerLoyaltyResponse
20
+ */
21
+ export interface CustomerLoyaltyResponse {
22
+ /**
23
+ *
24
+ * @type {CustomerLoyalty}
25
+ * @memberof CustomerLoyaltyResponse
26
+ */
27
+ customer_loyalty?: CustomerLoyalty;
28
+ /**
29
+ *
30
+ * @type {ModelError}
31
+ * @memberof CustomerLoyaltyResponse
32
+ */
33
+ error?: ModelError;
34
+ /**
35
+ *
36
+ * @type {ResponseMetadata}
37
+ * @memberof CustomerLoyaltyResponse
38
+ */
39
+ metadata?: ResponseMetadata;
40
+ /**
41
+ * Indicates if API call was successful
42
+ * @type {boolean}
43
+ * @memberof CustomerLoyaltyResponse
44
+ */
45
+ success?: boolean;
46
+ /**
47
+ *
48
+ * @type {Warning}
49
+ * @memberof CustomerLoyaltyResponse
50
+ */
51
+ warning?: Warning;
52
+ }
53
+ /**
54
+ * Check if a given object implements the CustomerLoyaltyResponse interface.
55
+ */
56
+ export declare function instanceOfCustomerLoyaltyResponse(value: object): boolean;
57
+ export declare function CustomerLoyaltyResponseFromJSON(json: any): CustomerLoyaltyResponse;
58
+ export declare function CustomerLoyaltyResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerLoyaltyResponse;
59
+ export declare function CustomerLoyaltyResponseToJSON(value?: CustomerLoyaltyResponse | null): any;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * UltraCart Rest API V2
6
+ * UltraCart REST API Version 2
7
+ *
8
+ * The version of the OpenAPI document: 2.0.0
9
+ * Contact: support@ultracart.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.CustomerLoyaltyResponseToJSON = exports.CustomerLoyaltyResponseFromJSONTyped = exports.CustomerLoyaltyResponseFromJSON = exports.instanceOfCustomerLoyaltyResponse = void 0;
17
+ var runtime_1 = require("../runtime");
18
+ var CustomerLoyalty_1 = require("./CustomerLoyalty");
19
+ var ModelError_1 = require("./ModelError");
20
+ var ResponseMetadata_1 = require("./ResponseMetadata");
21
+ var Warning_1 = require("./Warning");
22
+ /**
23
+ * Check if a given object implements the CustomerLoyaltyResponse interface.
24
+ */
25
+ function instanceOfCustomerLoyaltyResponse(value) {
26
+ var isInstance = true;
27
+ return isInstance;
28
+ }
29
+ exports.instanceOfCustomerLoyaltyResponse = instanceOfCustomerLoyaltyResponse;
30
+ function CustomerLoyaltyResponseFromJSON(json) {
31
+ return CustomerLoyaltyResponseFromJSONTyped(json, false);
32
+ }
33
+ exports.CustomerLoyaltyResponseFromJSON = CustomerLoyaltyResponseFromJSON;
34
+ function CustomerLoyaltyResponseFromJSONTyped(json, ignoreDiscriminator) {
35
+ if ((json === undefined) || (json === null)) {
36
+ return json;
37
+ }
38
+ return {
39
+ 'customer_loyalty': !(0, runtime_1.exists)(json, 'customer_loyalty') ? undefined : (0, CustomerLoyalty_1.CustomerLoyaltyFromJSON)(json['customer_loyalty']),
40
+ 'error': !(0, runtime_1.exists)(json, 'error') ? undefined : (0, ModelError_1.ModelErrorFromJSON)(json['error']),
41
+ 'metadata': !(0, runtime_1.exists)(json, 'metadata') ? undefined : (0, ResponseMetadata_1.ResponseMetadataFromJSON)(json['metadata']),
42
+ 'success': !(0, runtime_1.exists)(json, 'success') ? undefined : json['success'],
43
+ 'warning': !(0, runtime_1.exists)(json, 'warning') ? undefined : (0, Warning_1.WarningFromJSON)(json['warning']),
44
+ };
45
+ }
46
+ exports.CustomerLoyaltyResponseFromJSONTyped = CustomerLoyaltyResponseFromJSONTyped;
47
+ function CustomerLoyaltyResponseToJSON(value) {
48
+ if (value === undefined) {
49
+ return undefined;
50
+ }
51
+ if (value === null) {
52
+ return null;
53
+ }
54
+ return {
55
+ 'customer_loyalty': (0, CustomerLoyalty_1.CustomerLoyaltyToJSON)(value.customer_loyalty),
56
+ 'error': (0, ModelError_1.ModelErrorToJSON)(value.error),
57
+ 'metadata': (0, ResponseMetadata_1.ResponseMetadataToJSON)(value.metadata),
58
+ 'success': value.success,
59
+ 'warning': (0, Warning_1.WarningToJSON)(value.warning),
60
+ };
61
+ }
62
+ exports.CustomerLoyaltyResponseToJSON = CustomerLoyaltyResponseToJSON;
@@ -10,6 +10,8 @@ export * from './Activity';
10
10
  export * from './AddLibraryItemRequest';
11
11
  export * from './AdjustInternalCertificateRequest';
12
12
  export * from './AdjustInternalCertificateResponse';
13
+ export * from './AdjustLoyaltyPointsRequest';
14
+ export * from './AdjustLoyaltyPointsResponse';
13
15
  export * from './Affiliate';
14
16
  export * from './AffiliateAttribute';
15
17
  export * from './AffiliateClick';
@@ -442,6 +444,7 @@ export * from './CustomerEmailSuppressionResult';
442
444
  export * from './CustomerLoyalty';
443
445
  export * from './CustomerLoyaltyLedger';
444
446
  export * from './CustomerLoyaltyRedemption';
447
+ export * from './CustomerLoyaltyResponse';
445
448
  export * from './CustomerMagicLinkResponse';
446
449
  export * from './CustomerMergeRequest';
447
450
  export * from './CustomerOrdersSummary';
@@ -28,6 +28,8 @@ __exportStar(require("./Activity"), exports);
28
28
  __exportStar(require("./AddLibraryItemRequest"), exports);
29
29
  __exportStar(require("./AdjustInternalCertificateRequest"), exports);
30
30
  __exportStar(require("./AdjustInternalCertificateResponse"), exports);
31
+ __exportStar(require("./AdjustLoyaltyPointsRequest"), exports);
32
+ __exportStar(require("./AdjustLoyaltyPointsResponse"), exports);
31
33
  __exportStar(require("./Affiliate"), exports);
32
34
  __exportStar(require("./AffiliateAttribute"), exports);
33
35
  __exportStar(require("./AffiliateClick"), exports);
@@ -460,6 +462,7 @@ __exportStar(require("./CustomerEmailSuppressionResult"), exports);
460
462
  __exportStar(require("./CustomerLoyalty"), exports);
461
463
  __exportStar(require("./CustomerLoyaltyLedger"), exports);
462
464
  __exportStar(require("./CustomerLoyaltyRedemption"), exports);
465
+ __exportStar(require("./CustomerLoyaltyResponse"), exports);
463
466
  __exportStar(require("./CustomerMagicLinkResponse"), exports);
464
467
  __exportStar(require("./CustomerMergeRequest"), exports);
465
468
  __exportStar(require("./CustomerOrdersSummary"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultracart_rest_api_v2_typescript",
3
- "version": "4.1.135",
3
+ "version": "4.1.136",
4
4
  "description": "UltraCart Rest TypeScript SDK",
5
5
  "author": "UltraCart",
6
6
  "repository": {
@@ -21,6 +21,12 @@ import {
21
21
  AdjustInternalCertificateResponse,
22
22
  AdjustInternalCertificateResponseFromJSON,
23
23
  AdjustInternalCertificateResponseToJSON,
24
+ AdjustLoyaltyPointsRequest,
25
+ AdjustLoyaltyPointsRequestFromJSON,
26
+ AdjustLoyaltyPointsRequestToJSON,
27
+ AdjustLoyaltyPointsResponse,
28
+ AdjustLoyaltyPointsResponseFromJSON,
29
+ AdjustLoyaltyPointsResponseToJSON,
24
30
  BaseResponse,
25
31
  BaseResponseFromJSON,
26
32
  BaseResponseToJSON,
@@ -39,6 +45,9 @@ import {
39
45
  CustomerEmailSuppressionResponse,
40
46
  CustomerEmailSuppressionResponseFromJSON,
41
47
  CustomerEmailSuppressionResponseToJSON,
48
+ CustomerLoyaltyResponse,
49
+ CustomerLoyaltyResponseFromJSON,
50
+ CustomerLoyaltyResponseToJSON,
42
51
  CustomerMagicLinkResponse,
43
52
  CustomerMagicLinkResponseFromJSON,
44
53
  CustomerMagicLinkResponseToJSON,
@@ -111,6 +120,11 @@ export interface AdjustInternalCertificateOperationRequest {
111
120
  adjustInternalCertificateRequest: AdjustInternalCertificateRequest;
112
121
  }
113
122
 
123
+ export interface AdjustLoyaltyPointsOperationRequest {
124
+ customerProfileOid: number;
125
+ adjustLoyaltyPointsRequest: AdjustLoyaltyPointsRequest;
126
+ }
127
+
114
128
  export interface DeleteCustomerRequest {
115
129
  customerProfileOid: number;
116
130
  }
@@ -130,6 +144,10 @@ export interface GetCustomerByEmailRequest {
130
144
  expand?: string;
131
145
  }
132
146
 
147
+ export interface GetCustomerLoyaltyRequest {
148
+ customerProfileOid: number;
149
+ }
150
+
133
151
  export interface GetCustomerStoreCreditRequest {
134
152
  customerProfileOid: number;
135
153
  }
@@ -302,6 +320,23 @@ export interface CustomerApiInterface {
302
320
  */
303
321
  adjustInternalCertificate(requestParameters: AdjustInternalCertificateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustInternalCertificateResponse>;
304
322
 
323
+ /**
324
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
325
+ * @summary Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
326
+ * @param {number} customerProfileOid The customer profile oid
327
+ * @param {AdjustLoyaltyPointsRequest} adjustLoyaltyPointsRequest adjustLoyaltyPointsRequest
328
+ * @param {*} [options] Override http request option.
329
+ * @throws {RequiredError}
330
+ * @memberof CustomerApiInterface
331
+ */
332
+ adjustLoyaltyPointsRaw(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdjustLoyaltyPointsResponse>>;
333
+
334
+ /**
335
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
336
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
337
+ */
338
+ adjustLoyaltyPoints(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustLoyaltyPointsResponse>;
339
+
305
340
  /**
306
341
  * Delete a customer on the UltraCart account.
307
342
  * @summary Delete a customer
@@ -399,6 +434,22 @@ export interface CustomerApiInterface {
399
434
  */
400
435
  getCustomerEmailLists(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmailListsResponse>;
401
436
 
437
+ /**
438
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
439
+ * @summary Retrieve the loyalty points, ledger and redemptions for a customer
440
+ * @param {number} customerProfileOid The customer oid to retrieve.
441
+ * @param {*} [options] Override http request option.
442
+ * @throws {RequiredError}
443
+ * @memberof CustomerApiInterface
444
+ */
445
+ getCustomerLoyaltyRaw(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CustomerLoyaltyResponse>>;
446
+
447
+ /**
448
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
449
+ * Retrieve the loyalty points, ledger and redemptions for a customer
450
+ */
451
+ getCustomerLoyalty(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CustomerLoyaltyResponse>;
452
+
402
453
  /**
403
454
  * Retrieve the customer store credit accumulated through loyalty programs
404
455
  * @summary Retrieve the customer store credit accumulated through loyalty programs
@@ -860,6 +911,54 @@ export class CustomerApi extends runtime.BaseAPI implements CustomerApiInterface
860
911
  return await response.value();
861
912
  }
862
913
 
914
+ /**
915
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
916
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
917
+ */
918
+ async adjustLoyaltyPointsRaw(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdjustLoyaltyPointsResponse>> {
919
+ if (requestParameters.customerProfileOid === null || requestParameters.customerProfileOid === undefined) {
920
+ throw new runtime.RequiredError('customerProfileOid','Required parameter requestParameters.customerProfileOid was null or undefined when calling adjustLoyaltyPoints.');
921
+ }
922
+
923
+ if (requestParameters.adjustLoyaltyPointsRequest === null || requestParameters.adjustLoyaltyPointsRequest === undefined) {
924
+ throw new runtime.RequiredError('adjustLoyaltyPointsRequest','Required parameter requestParameters.adjustLoyaltyPointsRequest was null or undefined when calling adjustLoyaltyPoints.');
925
+ }
926
+
927
+ const queryParameters: any = {};
928
+
929
+ const headerParameters: runtime.HTTPHeaders = {};
930
+
931
+ headerParameters['Content-Type'] = 'application/json; charset=UTF-8';
932
+
933
+ if (this.configuration && this.configuration.accessToken) {
934
+ // oauth required
935
+ headerParameters["Authorization"] = await this.configuration.accessToken("ultraCartOauth", ["customer_write"]);
936
+ }
937
+
938
+ if (this.configuration && this.configuration.apiKey) {
939
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
940
+ }
941
+
942
+ const response = await this.request({
943
+ path: `/customer/customers/{customer_profile_oid}/adjust_loyalty_points`.replace(`{${"customer_profile_oid"}}`, encodeURIComponent(String(requestParameters.customerProfileOid))),
944
+ method: 'POST',
945
+ headers: headerParameters,
946
+ query: queryParameters,
947
+ body: AdjustLoyaltyPointsRequestToJSON(requestParameters.adjustLoyaltyPointsRequest),
948
+ }, initOverrides);
949
+
950
+ return new runtime.JSONApiResponse(response, (jsonValue) => AdjustLoyaltyPointsResponseFromJSON(jsonValue));
951
+ }
952
+
953
+ /**
954
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger. The loyalty ledger is append only. Records are never updated or deleted, so a correction is made by posting a second adjustment with the opposite sign.
955
+ * Adjusts the loyalty points for a customer by adding a record to the loyalty ledger.
956
+ */
957
+ async adjustLoyaltyPoints(requestParameters: AdjustLoyaltyPointsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdjustLoyaltyPointsResponse> {
958
+ const response = await this.adjustLoyaltyPointsRaw(requestParameters, initOverrides);
959
+ return await response.value();
960
+ }
961
+
863
962
  /**
864
963
  * Delete a customer on the UltraCart account.
865
964
  * Delete a customer
@@ -1108,6 +1207,47 @@ export class CustomerApi extends runtime.BaseAPI implements CustomerApiInterface
1108
1207
  return await response.value();
1109
1208
  }
1110
1209
 
1210
+ /**
1211
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
1212
+ * Retrieve the loyalty points, ledger and redemptions for a customer
1213
+ */
1214
+ async getCustomerLoyaltyRaw(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CustomerLoyaltyResponse>> {
1215
+ if (requestParameters.customerProfileOid === null || requestParameters.customerProfileOid === undefined) {
1216
+ throw new runtime.RequiredError('customerProfileOid','Required parameter requestParameters.customerProfileOid was null or undefined when calling getCustomerLoyalty.');
1217
+ }
1218
+
1219
+ const queryParameters: any = {};
1220
+
1221
+ const headerParameters: runtime.HTTPHeaders = {};
1222
+
1223
+ if (this.configuration && this.configuration.accessToken) {
1224
+ // oauth required
1225
+ headerParameters["Authorization"] = await this.configuration.accessToken("ultraCartOauth", ["customer_read"]);
1226
+ }
1227
+
1228
+ if (this.configuration && this.configuration.apiKey) {
1229
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
1230
+ }
1231
+
1232
+ const response = await this.request({
1233
+ path: `/customer/customers/{customer_profile_oid}/loyalty`.replace(`{${"customer_profile_oid"}}`, encodeURIComponent(String(requestParameters.customerProfileOid))),
1234
+ method: 'GET',
1235
+ headers: headerParameters,
1236
+ query: queryParameters,
1237
+ }, initOverrides);
1238
+
1239
+ return new runtime.JSONApiResponse(response, (jsonValue) => CustomerLoyaltyResponseFromJSON(jsonValue));
1240
+ }
1241
+
1242
+ /**
1243
+ * Retrieve the loyalty points, ledger and redemptions for a customer. This is a convenience method that returns the same information as expanding loyalty on the customer object, without having to retrieve the entire customer.
1244
+ * Retrieve the loyalty points, ledger and redemptions for a customer
1245
+ */
1246
+ async getCustomerLoyalty(requestParameters: GetCustomerLoyaltyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CustomerLoyaltyResponse> {
1247
+ const response = await this.getCustomerLoyaltyRaw(requestParameters, initOverrides);
1248
+ return await response.value();
1249
+ }
1250
+
1111
1251
  /**
1112
1252
  * Retrieve the customer store credit accumulated through loyalty programs
1113
1253
  * Retrieve the customer store credit accumulated through loyalty programs
@@ -0,0 +1,91 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * UltraCart Rest API V2
5
+ * UltraCart REST API Version 2
6
+ *
7
+ * The version of the OpenAPI document: 2.0.0
8
+ * Contact: support@ultracart.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { exists, mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface AdjustLoyaltyPointsRequest
20
+ */
21
+ export interface AdjustLoyaltyPointsRequest {
22
+ /**
23
+ * Description of this adjustment, 200 characters max
24
+ * @type {string}
25
+ * @memberof AdjustLoyaltyPointsRequest
26
+ */
27
+ description?: string;
28
+ /**
29
+ * The number of loyalty points to add to the ledger. Use a negative number to debit points. Required and may not be zero.
30
+ * @type {number}
31
+ * @memberof AdjustLoyaltyPointsRequest
32
+ */
33
+ loyalty_points?: number;
34
+ /**
35
+ * Optional order id if this adjustment is related to a particular order
36
+ * @type {string}
37
+ * @memberof AdjustLoyaltyPointsRequest
38
+ */
39
+ order_id?: string;
40
+ /**
41
+ * Optional days required for this adjustment to vest. Leave null to use the merchant configured default. Use zero for immediate vesting.
42
+ * @type {number}
43
+ * @memberof AdjustLoyaltyPointsRequest
44
+ */
45
+ vesting_days?: number;
46
+ }
47
+
48
+
49
+
50
+ /**
51
+ * Check if a given object implements the AdjustLoyaltyPointsRequest interface.
52
+ */
53
+ export function instanceOfAdjustLoyaltyPointsRequest(value: object): boolean {
54
+ let isInstance = true;
55
+
56
+ return isInstance;
57
+ }
58
+
59
+ export function AdjustLoyaltyPointsRequestFromJSON(json: any): AdjustLoyaltyPointsRequest {
60
+ return AdjustLoyaltyPointsRequestFromJSONTyped(json, false);
61
+ }
62
+
63
+ export function AdjustLoyaltyPointsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdjustLoyaltyPointsRequest {
64
+ if ((json === undefined) || (json === null)) {
65
+ return json;
66
+ }
67
+ return {
68
+
69
+ 'description': !exists(json, 'description') ? undefined : json['description'],
70
+ 'loyalty_points': !exists(json, 'loyalty_points') ? undefined : json['loyalty_points'],
71
+ 'order_id': !exists(json, 'order_id') ? undefined : json['order_id'],
72
+ 'vesting_days': !exists(json, 'vesting_days') ? undefined : json['vesting_days'],
73
+ };
74
+ }
75
+
76
+ export function AdjustLoyaltyPointsRequestToJSON(value?: AdjustLoyaltyPointsRequest | null): any {
77
+ if (value === undefined) {
78
+ return undefined;
79
+ }
80
+ if (value === null) {
81
+ return null;
82
+ }
83
+ return {
84
+
85
+ 'description': value.description,
86
+ 'loyalty_points': value.loyalty_points,
87
+ 'order_id': value.order_id,
88
+ 'vesting_days': value.vesting_days,
89
+ };
90
+ }
91
+
@@ -0,0 +1,134 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * UltraCart Rest API V2
5
+ * UltraCart REST API Version 2
6
+ *
7
+ * The version of the OpenAPI document: 2.0.0
8
+ * Contact: support@ultracart.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { exists, mapValues } from '../runtime';
16
+ import {
17
+ ModelError,
18
+ ModelErrorFromJSON,
19
+ ModelErrorFromJSONTyped,
20
+ ModelErrorToJSON,
21
+ } from './ModelError';
22
+ import {
23
+ ResponseMetadata,
24
+ ResponseMetadataFromJSON,
25
+ ResponseMetadataFromJSONTyped,
26
+ ResponseMetadataToJSON,
27
+ } from './ResponseMetadata';
28
+ import {
29
+ Warning,
30
+ WarningFromJSON,
31
+ WarningFromJSONTyped,
32
+ WarningToJSON,
33
+ } from './Warning';
34
+
35
+ /**
36
+ *
37
+ * @export
38
+ * @interface AdjustLoyaltyPointsResponse
39
+ */
40
+ export interface AdjustLoyaltyPointsResponse {
41
+ /**
42
+ * The current (vested) points balance after the adjustment was made
43
+ * @type {number}
44
+ * @memberof AdjustLoyaltyPointsResponse
45
+ */
46
+ current_points?: number;
47
+ /**
48
+ *
49
+ * @type {ModelError}
50
+ * @memberof AdjustLoyaltyPointsResponse
51
+ */
52
+ error?: ModelError;
53
+ /**
54
+ * The loyalty points adjustment that was written to the ledger
55
+ * @type {number}
56
+ * @memberof AdjustLoyaltyPointsResponse
57
+ */
58
+ loyalty_points?: number;
59
+ /**
60
+ *
61
+ * @type {ResponseMetadata}
62
+ * @memberof AdjustLoyaltyPointsResponse
63
+ */
64
+ metadata?: ResponseMetadata;
65
+ /**
66
+ * The pending (unvested) points balance after the adjustment was made
67
+ * @type {number}
68
+ * @memberof AdjustLoyaltyPointsResponse
69
+ */
70
+ pending_points?: number;
71
+ /**
72
+ * Indicates if API call was successful
73
+ * @type {boolean}
74
+ * @memberof AdjustLoyaltyPointsResponse
75
+ */
76
+ success?: boolean;
77
+ /**
78
+ *
79
+ * @type {Warning}
80
+ * @memberof AdjustLoyaltyPointsResponse
81
+ */
82
+ warning?: Warning;
83
+ }
84
+
85
+
86
+
87
+ /**
88
+ * Check if a given object implements the AdjustLoyaltyPointsResponse interface.
89
+ */
90
+ export function instanceOfAdjustLoyaltyPointsResponse(value: object): boolean {
91
+ let isInstance = true;
92
+
93
+ return isInstance;
94
+ }
95
+
96
+ export function AdjustLoyaltyPointsResponseFromJSON(json: any): AdjustLoyaltyPointsResponse {
97
+ return AdjustLoyaltyPointsResponseFromJSONTyped(json, false);
98
+ }
99
+
100
+ export function AdjustLoyaltyPointsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdjustLoyaltyPointsResponse {
101
+ if ((json === undefined) || (json === null)) {
102
+ return json;
103
+ }
104
+ return {
105
+
106
+ 'current_points': !exists(json, 'current_points') ? undefined : json['current_points'],
107
+ 'error': !exists(json, 'error') ? undefined : ModelErrorFromJSON(json['error']),
108
+ 'loyalty_points': !exists(json, 'loyalty_points') ? undefined : json['loyalty_points'],
109
+ 'metadata': !exists(json, 'metadata') ? undefined : ResponseMetadataFromJSON(json['metadata']),
110
+ 'pending_points': !exists(json, 'pending_points') ? undefined : json['pending_points'],
111
+ 'success': !exists(json, 'success') ? undefined : json['success'],
112
+ 'warning': !exists(json, 'warning') ? undefined : WarningFromJSON(json['warning']),
113
+ };
114
+ }
115
+
116
+ export function AdjustLoyaltyPointsResponseToJSON(value?: AdjustLoyaltyPointsResponse | null): any {
117
+ if (value === undefined) {
118
+ return undefined;
119
+ }
120
+ if (value === null) {
121
+ return null;
122
+ }
123
+ return {
124
+
125
+ 'current_points': value.current_points,
126
+ 'error': ModelErrorToJSON(value.error),
127
+ 'loyalty_points': value.loyalty_points,
128
+ 'metadata': ResponseMetadataToJSON(value.metadata),
129
+ 'pending_points': value.pending_points,
130
+ 'success': value.success,
131
+ 'warning': WarningToJSON(value.warning),
132
+ };
133
+ }
134
+
@@ -0,0 +1,124 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * UltraCart Rest API V2
5
+ * UltraCart REST API Version 2
6
+ *
7
+ * The version of the OpenAPI document: 2.0.0
8
+ * Contact: support@ultracart.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { exists, mapValues } from '../runtime';
16
+ import {
17
+ CustomerLoyalty,
18
+ CustomerLoyaltyFromJSON,
19
+ CustomerLoyaltyFromJSONTyped,
20
+ CustomerLoyaltyToJSON,
21
+ } from './CustomerLoyalty';
22
+ import {
23
+ ModelError,
24
+ ModelErrorFromJSON,
25
+ ModelErrorFromJSONTyped,
26
+ ModelErrorToJSON,
27
+ } from './ModelError';
28
+ import {
29
+ ResponseMetadata,
30
+ ResponseMetadataFromJSON,
31
+ ResponseMetadataFromJSONTyped,
32
+ ResponseMetadataToJSON,
33
+ } from './ResponseMetadata';
34
+ import {
35
+ Warning,
36
+ WarningFromJSON,
37
+ WarningFromJSONTyped,
38
+ WarningToJSON,
39
+ } from './Warning';
40
+
41
+ /**
42
+ *
43
+ * @export
44
+ * @interface CustomerLoyaltyResponse
45
+ */
46
+ export interface CustomerLoyaltyResponse {
47
+ /**
48
+ *
49
+ * @type {CustomerLoyalty}
50
+ * @memberof CustomerLoyaltyResponse
51
+ */
52
+ customer_loyalty?: CustomerLoyalty;
53
+ /**
54
+ *
55
+ * @type {ModelError}
56
+ * @memberof CustomerLoyaltyResponse
57
+ */
58
+ error?: ModelError;
59
+ /**
60
+ *
61
+ * @type {ResponseMetadata}
62
+ * @memberof CustomerLoyaltyResponse
63
+ */
64
+ metadata?: ResponseMetadata;
65
+ /**
66
+ * Indicates if API call was successful
67
+ * @type {boolean}
68
+ * @memberof CustomerLoyaltyResponse
69
+ */
70
+ success?: boolean;
71
+ /**
72
+ *
73
+ * @type {Warning}
74
+ * @memberof CustomerLoyaltyResponse
75
+ */
76
+ warning?: Warning;
77
+ }
78
+
79
+
80
+
81
+ /**
82
+ * Check if a given object implements the CustomerLoyaltyResponse interface.
83
+ */
84
+ export function instanceOfCustomerLoyaltyResponse(value: object): boolean {
85
+ let isInstance = true;
86
+
87
+ return isInstance;
88
+ }
89
+
90
+ export function CustomerLoyaltyResponseFromJSON(json: any): CustomerLoyaltyResponse {
91
+ return CustomerLoyaltyResponseFromJSONTyped(json, false);
92
+ }
93
+
94
+ export function CustomerLoyaltyResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerLoyaltyResponse {
95
+ if ((json === undefined) || (json === null)) {
96
+ return json;
97
+ }
98
+ return {
99
+
100
+ 'customer_loyalty': !exists(json, 'customer_loyalty') ? undefined : CustomerLoyaltyFromJSON(json['customer_loyalty']),
101
+ 'error': !exists(json, 'error') ? undefined : ModelErrorFromJSON(json['error']),
102
+ 'metadata': !exists(json, 'metadata') ? undefined : ResponseMetadataFromJSON(json['metadata']),
103
+ 'success': !exists(json, 'success') ? undefined : json['success'],
104
+ 'warning': !exists(json, 'warning') ? undefined : WarningFromJSON(json['warning']),
105
+ };
106
+ }
107
+
108
+ export function CustomerLoyaltyResponseToJSON(value?: CustomerLoyaltyResponse | null): any {
109
+ if (value === undefined) {
110
+ return undefined;
111
+ }
112
+ if (value === null) {
113
+ return null;
114
+ }
115
+ return {
116
+
117
+ 'customer_loyalty': CustomerLoyaltyToJSON(value.customer_loyalty),
118
+ 'error': ModelErrorToJSON(value.error),
119
+ 'metadata': ResponseMetadataToJSON(value.metadata),
120
+ 'success': value.success,
121
+ 'warning': WarningToJSON(value.warning),
122
+ };
123
+ }
124
+
@@ -12,6 +12,8 @@ export * from './Activity';
12
12
  export * from './AddLibraryItemRequest';
13
13
  export * from './AdjustInternalCertificateRequest';
14
14
  export * from './AdjustInternalCertificateResponse';
15
+ export * from './AdjustLoyaltyPointsRequest';
16
+ export * from './AdjustLoyaltyPointsResponse';
15
17
  export * from './Affiliate';
16
18
  export * from './AffiliateAttribute';
17
19
  export * from './AffiliateClick';
@@ -444,6 +446,7 @@ export * from './CustomerEmailSuppressionResult';
444
446
  export * from './CustomerLoyalty';
445
447
  export * from './CustomerLoyaltyLedger';
446
448
  export * from './CustomerLoyaltyRedemption';
449
+ export * from './CustomerLoyaltyResponse';
447
450
  export * from './CustomerMagicLinkResponse';
448
451
  export * from './CustomerMergeRequest';
449
452
  export * from './CustomerOrdersSummary';