@paygentic/sdk 0.9.4 → 0.9.6
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/README.md +12 -5
- package/dist/commonjs/funcs/pricesUpdate.d.ts +1 -1
- package/dist/commonjs/funcs/pricesUpdate.d.ts.map +1 -1
- package/dist/commonjs/funcs/pricesUpdate.js +2 -2
- package/dist/commonjs/funcs/pricesUpdate.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js +127 -0
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js.map +1 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +18 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js +128 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.js +129 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +53 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +63 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -0
- package/dist/commonjs/models/errors/index.d.ts +1 -0
- package/dist/commonjs/models/errors/index.d.ts.map +1 -1
- package/dist/commonjs/models/errors/index.js +1 -0
- package/dist/commonjs/models/errors/index.js.map +1 -1
- package/dist/commonjs/models/errors/updateprice.d.ts +36 -0
- package/dist/commonjs/models/errors/updateprice.d.ts.map +1 -0
- package/dist/commonjs/models/errors/updateprice.js +77 -0
- package/dist/commonjs/models/errors/updateprice.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +4 -1
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -1
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +8 -3
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +2 -1
- package/dist/commonjs/models/operations/createprice.js.map +1 -1
- package/dist/commonjs/models/operations/createsubscriptionadjustment.d.ts +18 -0
- package/dist/commonjs/models/operations/createsubscriptionadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createsubscriptionadjustment.js +56 -0
- package/dist/commonjs/models/operations/createsubscriptionadjustment.js.map +1 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.d.ts +20 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.js +50 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listsubscriptionadjustments.d.ts +25 -0
- package/dist/commonjs/models/operations/listsubscriptionadjustments.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listsubscriptionadjustments.js +51 -0
- package/dist/commonjs/models/operations/listsubscriptionadjustments.js.map +1 -0
- package/dist/commonjs/models/operations/updateprice.d.ts +18 -3
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +14 -2
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.d.ts +4 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.js +1 -0
- package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
- package/dist/commonjs/models/price.d.ts +4 -0
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +1 -0
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricemodel.d.ts +2 -2
- package/dist/commonjs/models/pricemodel.js +1 -1
- package/dist/commonjs/models/pricemodelinput.d.ts +3 -2
- package/dist/commonjs/models/pricemodelinput.d.ts.map +1 -1
- package/dist/commonjs/models/pricemodelinput.js +2 -1
- package/dist/commonjs/models/pricemodelinput.js.map +1 -1
- package/dist/commonjs/models/priceproperties.d.ts +125 -0
- package/dist/commonjs/models/priceproperties.d.ts.map +1 -0
- package/dist/commonjs/models/priceproperties.js +152 -0
- package/dist/commonjs/models/priceproperties.js.map +1 -0
- package/dist/commonjs/models/schemasprice.d.ts +7 -3
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +3 -2
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/commonjs/models/subscriptionadjustment.d.ts +49 -0
- package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionadjustment.js +68 -0
- package/dist/commonjs/models/subscriptionadjustment.js.map +1 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.d.ts +16 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.js +53 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.js.map +1 -0
- package/dist/commonjs/sdk/subscriptions.d.ts +21 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +30 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/pricesUpdate.d.ts +1 -1
- package/dist/esm/funcs/pricesUpdate.d.ts.map +1 -1
- package/dist/esm/funcs/pricesUpdate.js +2 -2
- package/dist/esm/funcs/pricesUpdate.js.map +1 -1
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js +91 -0
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js.map +1 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +18 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js +92 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.js +93 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +53 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.js +26 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -0
- package/dist/esm/models/errors/index.d.ts +1 -0
- package/dist/esm/models/errors/index.d.ts.map +1 -1
- package/dist/esm/models/errors/index.js +1 -0
- package/dist/esm/models/errors/index.js.map +1 -1
- package/dist/esm/models/errors/updateprice.d.ts +36 -0
- package/dist/esm/models/errors/updateprice.d.ts.map +1 -0
- package/dist/esm/models/errors/updateprice.js +40 -0
- package/dist/esm/models/errors/updateprice.js.map +1 -0
- package/dist/esm/models/index.d.ts +4 -1
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/createprice.d.ts +8 -3
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +2 -1
- package/dist/esm/models/operations/createprice.js.map +1 -1
- package/dist/esm/models/operations/createsubscriptionadjustment.d.ts +18 -0
- package/dist/esm/models/operations/createsubscriptionadjustment.d.ts.map +1 -0
- package/dist/esm/models/operations/createsubscriptionadjustment.js +19 -0
- package/dist/esm/models/operations/createsubscriptionadjustment.js.map +1 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.d.ts +20 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.d.ts.map +1 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.js +13 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listsubscriptionadjustments.d.ts +25 -0
- package/dist/esm/models/operations/listsubscriptionadjustments.d.ts.map +1 -0
- package/dist/esm/models/operations/listsubscriptionadjustments.js +14 -0
- package/dist/esm/models/operations/listsubscriptionadjustments.js.map +1 -0
- package/dist/esm/models/operations/updateprice.d.ts +18 -3
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +12 -1
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/planversionpriceslot.d.ts +4 -0
- package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/esm/models/planversionpriceslot.js +1 -0
- package/dist/esm/models/planversionpriceslot.js.map +1 -1
- package/dist/esm/models/price.d.ts +4 -0
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +1 -0
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricemodel.d.ts +2 -2
- package/dist/esm/models/pricemodel.js +1 -1
- package/dist/esm/models/pricemodelinput.d.ts +3 -2
- package/dist/esm/models/pricemodelinput.d.ts.map +1 -1
- package/dist/esm/models/pricemodelinput.js +2 -1
- package/dist/esm/models/pricemodelinput.js.map +1 -1
- package/dist/esm/models/priceproperties.d.ts +125 -0
- package/dist/esm/models/priceproperties.d.ts.map +1 -0
- package/dist/esm/models/priceproperties.js +104 -0
- package/dist/esm/models/priceproperties.js.map +1 -0
- package/dist/esm/models/schemasprice.d.ts +7 -3
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +3 -2
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/dist/esm/models/subscriptionadjustment.d.ts +49 -0
- package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -0
- package/dist/esm/models/subscriptionadjustment.js +31 -0
- package/dist/esm/models/subscriptionadjustment.js.map +1 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.d.ts +16 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.d.ts.map +1 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.js +16 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.js.map +1 -0
- package/dist/esm/sdk/subscriptions.d.ts +21 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +30 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/pricesUpdate.ts +5 -1
- package/src/funcs/subscriptionsCreateSubscriptionAdjustment.ts +186 -0
- package/src/funcs/subscriptionsDeleteSubscriptionAdjustment.ts +185 -0
- package/src/funcs/subscriptionsListSubscriptionAdjustments.ts +183 -0
- package/src/lib/config.ts +2 -2
- package/src/models/createsubscriptionadjustmentrequest.ts +85 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/errors/updateprice.ts +71 -0
- package/src/models/index.ts +4 -1
- package/src/models/operations/createprice.ts +10 -4
- package/src/models/operations/createsubscriptionadjustment.ts +48 -0
- package/src/models/operations/deletesubscriptionadjustment.ts +42 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/listsubscriptionadjustments.ts +48 -0
- package/src/models/operations/updateprice.ts +40 -4
- package/src/models/planversionpriceslot.ts +5 -0
- package/src/models/price.ts +5 -0
- package/src/models/pricemodel.ts +2 -2
- package/src/models/pricemodelinput.ts +3 -2
- package/src/models/priceproperties.ts +325 -0
- package/src/models/schemasprice.ts +11 -6
- package/src/models/subscriptionadjustment.ts +94 -0
- package/src/models/subscriptionadjustmentsresponse.ts +44 -0
- package/src/sdk/subscriptions.ts +54 -0
- package/dist/commonjs/models/pricepropertiesunion.d.ts +0 -152
- package/dist/commonjs/models/pricepropertiesunion.d.ts.map +0 -1
- package/dist/commonjs/models/pricepropertiesunion.js +0 -169
- package/dist/commonjs/models/pricepropertiesunion.js.map +0 -1
- package/dist/esm/models/pricepropertiesunion.d.ts +0 -152
- package/dist/esm/models/pricepropertiesunion.d.ts.map +0 -1
- package/dist/esm/models/pricepropertiesunion.js +0 -121
- package/dist/esm/models/pricepropertiesunion.js.map +0 -1
- package/src/models/pricepropertiesunion.ts +0 -364
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import { subscriptionsCreate } from "../funcs/subscriptionsCreate.js";
|
|
5
|
+
import { subscriptionsCreateSubscriptionAdjustment } from "../funcs/subscriptionsCreateSubscriptionAdjustment.js";
|
|
6
|
+
import { subscriptionsDeleteSubscriptionAdjustment } from "../funcs/subscriptionsDeleteSubscriptionAdjustment.js";
|
|
5
7
|
import { subscriptionsGeneratePortalLink } from "../funcs/subscriptionsGeneratePortalLink.js";
|
|
6
8
|
import { subscriptionsGet } from "../funcs/subscriptionsGet.js";
|
|
7
9
|
import { subscriptionsList } from "../funcs/subscriptionsList.js";
|
|
10
|
+
import { subscriptionsListSubscriptionAdjustments } from "../funcs/subscriptionsListSubscriptionAdjustments.js";
|
|
8
11
|
import { subscriptionsReconcileSubscriptionFeatures } from "../funcs/subscriptionsReconcileSubscriptionFeatures.js";
|
|
9
12
|
import { subscriptionsTerminate } from "../funcs/subscriptionsTerminate.js";
|
|
10
13
|
import { subscriptionsUpdateSubscription } from "../funcs/subscriptionsUpdateSubscription.js";
|
|
@@ -65,5 +68,32 @@ export class Subscriptions extends ClientSDK {
|
|
|
65
68
|
async reconcileSubscriptionFeatures(request, options) {
|
|
66
69
|
return unwrapAsync(subscriptionsReconcileSubscriptionFeatures(this, request, options));
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* List Adjustments
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* Reads the adjustments on the subscription, oldest window first. A subscription with no adjustment returns an empty array. Paginated, because a long-running subscription accumulates one adjustment per rate change of every deal it has carried.
|
|
76
|
+
*/
|
|
77
|
+
async listSubscriptionAdjustments(request, options) {
|
|
78
|
+
return unwrapAsync(subscriptionsListSubscriptionAdjustments(this, request, options));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create Adjustment
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* Attaches a percentage discount to the subscription for a dated window. Every invoice calculated while the window is open carries one discount line for each discounted charge, and tax is assessed on the reduced amount. An invoice that already exists is not changed, including one still in draft — the discount reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change a rate before any invoice has issued under the discount, delete the adjustment and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
85
|
+
*/
|
|
86
|
+
async createSubscriptionAdjustment(request, options) {
|
|
87
|
+
return unwrapAsync(subscriptionsCreateSubscriptionAdjustment(this, request, options));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Delete Adjustment
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Deletes an adjustment that has not yet reached an issued invoice. No invoice changes: an invoice still in draft keeps its numbers, and loses the discount only when its period is calculated again. An adjustment that has already discounted an issued invoice cannot be deleted, because the invoice records why the customer was charged that amount. Its window cannot be shortened afterwards either, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
94
|
+
*/
|
|
95
|
+
async deleteSubscriptionAdjustment(request, options) {
|
|
96
|
+
return unwrapAsync(subscriptionsDeleteSubscriptionAdjustment(this, request, options));
|
|
97
|
+
}
|
|
68
98
|
}
|
|
69
99
|
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/sdk/subscriptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,0CAA0C,EAAE,MAAM,wDAAwD,CAAC;AACpH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,OAAyD,EACzD,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,mBAAmB,CACpC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,OAA0C,EAC1C,OAAwB;QAExB,OAAO,WAAW,CAAC,gBAAgB,CACjC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,+BAA+B,CAChD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,+BAA+B,CAChD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CACb,OAAgD,EAChD,OAAwB;QAExB,OAAO,WAAW,CAAC,sBAAsB,CACvC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,6BAA6B,CACjC,OAAwD,EACxD,OAAwB;QAExB,OAAO,WAAW,CAAC,0CAA0C,CAC3D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/sdk/subscriptions.ts"],"names":[],"mappings":"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"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ export function pricesUpdate(
|
|
|
38
38
|
models.SchemasPrice,
|
|
39
39
|
| errors.BadRequest
|
|
40
40
|
| errors.ErrorT
|
|
41
|
+
| errors.UpdatePriceConflictError
|
|
41
42
|
| PaygenticError
|
|
42
43
|
| ResponseValidationError
|
|
43
44
|
| ConnectionError
|
|
@@ -65,6 +66,7 @@ async function $do(
|
|
|
65
66
|
models.SchemasPrice,
|
|
66
67
|
| errors.BadRequest
|
|
67
68
|
| errors.ErrorT
|
|
69
|
+
| errors.UpdatePriceConflictError
|
|
68
70
|
| PaygenticError
|
|
69
71
|
| ResponseValidationError
|
|
70
72
|
| ConnectionError
|
|
@@ -137,7 +139,7 @@ async function $do(
|
|
|
137
139
|
|
|
138
140
|
const doResult = await client._do(req, {
|
|
139
141
|
context,
|
|
140
|
-
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
142
|
+
errorCodes: ["400", "401", "403", "404", "409", "4XX", "500", "5XX"],
|
|
141
143
|
retryConfig: context.retryConfig,
|
|
142
144
|
retryCodes: context.retryCodes,
|
|
143
145
|
});
|
|
@@ -154,6 +156,7 @@ async function $do(
|
|
|
154
156
|
models.SchemasPrice,
|
|
155
157
|
| errors.BadRequest
|
|
156
158
|
| errors.ErrorT
|
|
159
|
+
| errors.UpdatePriceConflictError
|
|
157
160
|
| PaygenticError
|
|
158
161
|
| ResponseValidationError
|
|
159
162
|
| ConnectionError
|
|
@@ -166,6 +169,7 @@ async function $do(
|
|
|
166
169
|
M.json(200, models.SchemasPrice$inboundSchema),
|
|
167
170
|
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
168
171
|
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
172
|
+
M.jsonErr(409, errors.UpdatePriceConflictError$inboundSchema),
|
|
169
173
|
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
170
174
|
M.fail("4XX"),
|
|
171
175
|
M.fail("5XX"),
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PaygenticCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as models from "../models/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create Adjustment
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Attaches a percentage discount to the subscription for a dated window. Every invoice calculated while the window is open carries one discount line for each discounted charge, and tax is assessed on the reduced amount. An invoice that already exists is not changed, including one still in draft — the discount reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change a rate before any invoice has issued under the discount, delete the adjustment and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
34
|
+
*/
|
|
35
|
+
export function subscriptionsCreateSubscriptionAdjustment(
|
|
36
|
+
client: PaygenticCore,
|
|
37
|
+
request: operations.CreateSubscriptionAdjustmentRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.SubscriptionAdjustment,
|
|
42
|
+
| errors.BadRequest
|
|
43
|
+
| errors.ErrorT
|
|
44
|
+
| PaygenticError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: PaygenticCore,
|
|
63
|
+
request: operations.CreateSubscriptionAdjustmentRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
models.SubscriptionAdjustment,
|
|
69
|
+
| errors.BadRequest
|
|
70
|
+
| errors.ErrorT
|
|
71
|
+
| PaygenticError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) =>
|
|
86
|
+
operations.CreateSubscriptionAdjustmentRequest$outboundSchema.parse(
|
|
87
|
+
value,
|
|
88
|
+
),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = encodeJSON("body", payload.CreateSubscriptionAdjustmentRequest, {
|
|
96
|
+
explode: true,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const pathParams = {
|
|
100
|
+
id: encodeSimple("id", payload.id, {
|
|
101
|
+
explode: false,
|
|
102
|
+
charEncoding: "percent",
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
const path = pathToFunc("/v0/subscriptions/{id}/adjustments")(pathParams);
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
Accept: "application/json",
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
113
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
114
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
115
|
+
|
|
116
|
+
const context = {
|
|
117
|
+
options: client._options,
|
|
118
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
119
|
+
operationID: "createSubscriptionAdjustment",
|
|
120
|
+
oAuth2Scopes: null,
|
|
121
|
+
|
|
122
|
+
resolvedSecurity: requestSecurity,
|
|
123
|
+
|
|
124
|
+
securitySource: client._options.bearerAuth,
|
|
125
|
+
retryConfig: options?.retries
|
|
126
|
+
|| client._options.retryConfig
|
|
127
|
+
|| { strategy: "none" },
|
|
128
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const requestRes = client._createRequest(context, {
|
|
132
|
+
security: requestSecurity,
|
|
133
|
+
method: "POST",
|
|
134
|
+
baseURL: options?.serverURL,
|
|
135
|
+
path: path,
|
|
136
|
+
headers: headers,
|
|
137
|
+
body: body,
|
|
138
|
+
userAgent: client._options.userAgent,
|
|
139
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
140
|
+
}, options);
|
|
141
|
+
if (!requestRes.ok) {
|
|
142
|
+
return [requestRes, { status: "invalid" }];
|
|
143
|
+
}
|
|
144
|
+
const req = requestRes.value;
|
|
145
|
+
|
|
146
|
+
const doResult = await client._do(req, {
|
|
147
|
+
context,
|
|
148
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
149
|
+
retryConfig: context.retryConfig,
|
|
150
|
+
retryCodes: context.retryCodes,
|
|
151
|
+
});
|
|
152
|
+
if (!doResult.ok) {
|
|
153
|
+
return [doResult, { status: "request-error", request: req }];
|
|
154
|
+
}
|
|
155
|
+
const response = doResult.value;
|
|
156
|
+
|
|
157
|
+
const responseFields = {
|
|
158
|
+
HttpMeta: { Response: response, Request: req },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const [result] = await M.match<
|
|
162
|
+
models.SubscriptionAdjustment,
|
|
163
|
+
| errors.BadRequest
|
|
164
|
+
| errors.ErrorT
|
|
165
|
+
| PaygenticError
|
|
166
|
+
| ResponseValidationError
|
|
167
|
+
| ConnectionError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| InvalidRequestError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| SDKValidationError
|
|
173
|
+
>(
|
|
174
|
+
M.json([200, 201], models.SubscriptionAdjustment$inboundSchema),
|
|
175
|
+
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
176
|
+
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
177
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
178
|
+
M.fail("4XX"),
|
|
179
|
+
M.fail("5XX"),
|
|
180
|
+
)(response, req, { extraFields: responseFields });
|
|
181
|
+
if (!result.ok) {
|
|
182
|
+
return [result, { status: "complete", request: req, response }];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return [result, { status: "complete", request: req, response }];
|
|
186
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { PaygenticCore } from "../core.js";
|
|
7
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Delete Adjustment
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Deletes an adjustment that has not yet reached an issued invoice. No invoice changes: an invoice still in draft keeps its numbers, and loses the discount only when its period is calculated again. An adjustment that has already discounted an issued invoice cannot be deleted, because the invoice records why the customer was charged that amount. Its window cannot be shortened afterwards either, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
34
|
+
*/
|
|
35
|
+
export function subscriptionsDeleteSubscriptionAdjustment(
|
|
36
|
+
client: PaygenticCore,
|
|
37
|
+
request: operations.DeleteSubscriptionAdjustmentRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
void,
|
|
42
|
+
| errors.ErrorT
|
|
43
|
+
| PaygenticError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: PaygenticCore,
|
|
62
|
+
request: operations.DeleteSubscriptionAdjustmentRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
void,
|
|
68
|
+
| errors.ErrorT
|
|
69
|
+
| PaygenticError
|
|
70
|
+
| ResponseValidationError
|
|
71
|
+
| ConnectionError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| InvalidRequestError
|
|
75
|
+
| UnexpectedClientError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
>,
|
|
78
|
+
APICall,
|
|
79
|
+
]
|
|
80
|
+
> {
|
|
81
|
+
const parsed = safeParse(
|
|
82
|
+
request,
|
|
83
|
+
(value) =>
|
|
84
|
+
operations.DeleteSubscriptionAdjustmentRequest$outboundSchema.parse(
|
|
85
|
+
value,
|
|
86
|
+
),
|
|
87
|
+
"Input validation failed",
|
|
88
|
+
);
|
|
89
|
+
if (!parsed.ok) {
|
|
90
|
+
return [parsed, { status: "invalid" }];
|
|
91
|
+
}
|
|
92
|
+
const payload = parsed.value;
|
|
93
|
+
const body = null;
|
|
94
|
+
|
|
95
|
+
const pathParams = {
|
|
96
|
+
adjustmentId: encodeSimple("adjustmentId", payload.adjustmentId, {
|
|
97
|
+
explode: false,
|
|
98
|
+
charEncoding: "percent",
|
|
99
|
+
}),
|
|
100
|
+
id: encodeSimple("id", payload.id, {
|
|
101
|
+
explode: false,
|
|
102
|
+
charEncoding: "percent",
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
const path = pathToFunc("/v0/subscriptions/{id}/adjustments/{adjustmentId}")(
|
|
106
|
+
pathParams,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const headers = new Headers(compactMap({
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
114
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
options: client._options,
|
|
119
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
120
|
+
operationID: "deleteSubscriptionAdjustment",
|
|
121
|
+
oAuth2Scopes: null,
|
|
122
|
+
|
|
123
|
+
resolvedSecurity: requestSecurity,
|
|
124
|
+
|
|
125
|
+
securitySource: client._options.bearerAuth,
|
|
126
|
+
retryConfig: options?.retries
|
|
127
|
+
|| client._options.retryConfig
|
|
128
|
+
|| { strategy: "none" },
|
|
129
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const requestRes = client._createRequest(context, {
|
|
133
|
+
security: requestSecurity,
|
|
134
|
+
method: "DELETE",
|
|
135
|
+
baseURL: options?.serverURL,
|
|
136
|
+
path: path,
|
|
137
|
+
headers: headers,
|
|
138
|
+
body: body,
|
|
139
|
+
userAgent: client._options.userAgent,
|
|
140
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
141
|
+
}, options);
|
|
142
|
+
if (!requestRes.ok) {
|
|
143
|
+
return [requestRes, { status: "invalid" }];
|
|
144
|
+
}
|
|
145
|
+
const req = requestRes.value;
|
|
146
|
+
|
|
147
|
+
const doResult = await client._do(req, {
|
|
148
|
+
context,
|
|
149
|
+
errorCodes: ["401", "403", "404", "409", "4XX", "500", "5XX"],
|
|
150
|
+
retryConfig: context.retryConfig,
|
|
151
|
+
retryCodes: context.retryCodes,
|
|
152
|
+
});
|
|
153
|
+
if (!doResult.ok) {
|
|
154
|
+
return [doResult, { status: "request-error", request: req }];
|
|
155
|
+
}
|
|
156
|
+
const response = doResult.value;
|
|
157
|
+
|
|
158
|
+
const responseFields = {
|
|
159
|
+
HttpMeta: { Response: response, Request: req },
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const [result] = await M.match<
|
|
163
|
+
void,
|
|
164
|
+
| errors.ErrorT
|
|
165
|
+
| PaygenticError
|
|
166
|
+
| ResponseValidationError
|
|
167
|
+
| ConnectionError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| InvalidRequestError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| SDKValidationError
|
|
173
|
+
>(
|
|
174
|
+
M.nil(204, z.void()),
|
|
175
|
+
M.jsonErr([401, 403, 404, 409], errors.ErrorT$inboundSchema),
|
|
176
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
177
|
+
M.fail("4XX"),
|
|
178
|
+
M.fail("5XX"),
|
|
179
|
+
)(response, req, { extraFields: responseFields });
|
|
180
|
+
if (!result.ok) {
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return [result, { status: "complete", request: req, response }];
|
|
185
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PaygenticCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as models from "../models/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List Adjustments
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Reads the adjustments on the subscription, oldest window first. A subscription with no adjustment returns an empty array. Paginated, because a long-running subscription accumulates one adjustment per rate change of every deal it has carried.
|
|
34
|
+
*/
|
|
35
|
+
export function subscriptionsListSubscriptionAdjustments(
|
|
36
|
+
client: PaygenticCore,
|
|
37
|
+
request: operations.ListSubscriptionAdjustmentsRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.SubscriptionAdjustmentsResponse,
|
|
42
|
+
| errors.ErrorT
|
|
43
|
+
| PaygenticError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: PaygenticCore,
|
|
62
|
+
request: operations.ListSubscriptionAdjustmentsRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
models.SubscriptionAdjustmentsResponse,
|
|
68
|
+
| errors.ErrorT
|
|
69
|
+
| PaygenticError
|
|
70
|
+
| ResponseValidationError
|
|
71
|
+
| ConnectionError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| InvalidRequestError
|
|
75
|
+
| UnexpectedClientError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
>,
|
|
78
|
+
APICall,
|
|
79
|
+
]
|
|
80
|
+
> {
|
|
81
|
+
const parsed = safeParse(
|
|
82
|
+
request,
|
|
83
|
+
(value) =>
|
|
84
|
+
operations.ListSubscriptionAdjustmentsRequest$outboundSchema.parse(value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
93
|
+
const pathParams = {
|
|
94
|
+
id: encodeSimple("id", payload.id, {
|
|
95
|
+
explode: false,
|
|
96
|
+
charEncoding: "percent",
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
const path = pathToFunc("/v0/subscriptions/{id}/adjustments")(pathParams);
|
|
100
|
+
|
|
101
|
+
const query = encodeFormQuery({
|
|
102
|
+
"limit": payload.limit,
|
|
103
|
+
"offset": payload.offset,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const headers = new Headers(compactMap({
|
|
107
|
+
Accept: "application/json",
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
111
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
112
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
113
|
+
|
|
114
|
+
const context = {
|
|
115
|
+
options: client._options,
|
|
116
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
117
|
+
operationID: "listSubscriptionAdjustments",
|
|
118
|
+
oAuth2Scopes: null,
|
|
119
|
+
|
|
120
|
+
resolvedSecurity: requestSecurity,
|
|
121
|
+
|
|
122
|
+
securitySource: client._options.bearerAuth,
|
|
123
|
+
retryConfig: options?.retries
|
|
124
|
+
|| client._options.retryConfig
|
|
125
|
+
|| { strategy: "none" },
|
|
126
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const requestRes = client._createRequest(context, {
|
|
130
|
+
security: requestSecurity,
|
|
131
|
+
method: "GET",
|
|
132
|
+
baseURL: options?.serverURL,
|
|
133
|
+
path: path,
|
|
134
|
+
headers: headers,
|
|
135
|
+
query: query,
|
|
136
|
+
body: body,
|
|
137
|
+
userAgent: client._options.userAgent,
|
|
138
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
|
+
}, options);
|
|
140
|
+
if (!requestRes.ok) {
|
|
141
|
+
return [requestRes, { status: "invalid" }];
|
|
142
|
+
}
|
|
143
|
+
const req = requestRes.value;
|
|
144
|
+
|
|
145
|
+
const doResult = await client._do(req, {
|
|
146
|
+
context,
|
|
147
|
+
errorCodes: ["401", "403", "404", "4XX", "500", "5XX"],
|
|
148
|
+
retryConfig: context.retryConfig,
|
|
149
|
+
retryCodes: context.retryCodes,
|
|
150
|
+
});
|
|
151
|
+
if (!doResult.ok) {
|
|
152
|
+
return [doResult, { status: "request-error", request: req }];
|
|
153
|
+
}
|
|
154
|
+
const response = doResult.value;
|
|
155
|
+
|
|
156
|
+
const responseFields = {
|
|
157
|
+
HttpMeta: { Response: response, Request: req },
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const [result] = await M.match<
|
|
161
|
+
models.SubscriptionAdjustmentsResponse,
|
|
162
|
+
| errors.ErrorT
|
|
163
|
+
| PaygenticError
|
|
164
|
+
| ResponseValidationError
|
|
165
|
+
| ConnectionError
|
|
166
|
+
| RequestAbortedError
|
|
167
|
+
| RequestTimeoutError
|
|
168
|
+
| InvalidRequestError
|
|
169
|
+
| UnexpectedClientError
|
|
170
|
+
| SDKValidationError
|
|
171
|
+
>(
|
|
172
|
+
M.json(200, models.SubscriptionAdjustmentsResponse$inboundSchema),
|
|
173
|
+
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
174
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
175
|
+
M.fail("4XX"),
|
|
176
|
+
M.fail("5XX"),
|
|
177
|
+
)(response, req, { extraFields: responseFields });
|
|
178
|
+
if (!result.ok) {
|
|
179
|
+
return [result, { status: "complete", request: req, response }];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return [result, { status: "complete", request: req, response }];
|
|
183
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "0.1.0",
|
|
68
|
-
sdkVersion: "0.9.
|
|
68
|
+
sdkVersion: "0.9.6",
|
|
69
69
|
genVersion: "2.879.13",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.9.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.9.6 2.879.13 0.1.0 @paygentic/sdk",
|
|
71
71
|
} as const;
|