@tirdad/sdk 2.1.45 → 2.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/esm/funcs/events-get-usage-analytics.d.ts +5 -0
  2. package/esm/funcs/events-get-usage-analytics.d.ts.map +1 -1
  3. package/esm/funcs/events-get-usage-analytics.js +5 -0
  4. package/esm/funcs/events-get-usage-analytics.js.map +1 -1
  5. package/esm/funcs/prices-get-price-history.d.ts +17 -0
  6. package/esm/funcs/prices-get-price-history.d.ts.map +1 -0
  7. package/esm/funcs/prices-get-price-history.js +91 -0
  8. package/esm/funcs/prices-get-price-history.js.map +1 -0
  9. package/esm/funcs/subscriptions-get-subscription-line-item-history.d.ts +17 -0
  10. package/esm/funcs/subscriptions-get-subscription-line-item-history.d.ts.map +1 -0
  11. package/esm/funcs/subscriptions-get-subscription-line-item-history.js +91 -0
  12. package/esm/funcs/subscriptions-get-subscription-line-item-history.js.map +1 -0
  13. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.d.ts +17 -0
  14. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.d.ts.map +1 -0
  15. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.js +69 -0
  16. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.js.map +1 -0
  17. package/esm/lib/config.d.ts +3 -3
  18. package/esm/lib/config.d.ts.map +1 -1
  19. package/esm/lib/config.js +10 -2
  20. package/esm/lib/config.js.map +1 -1
  21. package/esm/sdk/events.d.ts +5 -0
  22. package/esm/sdk/events.d.ts.map +1 -1
  23. package/esm/sdk/events.js +5 -0
  24. package/esm/sdk/events.js.map +1 -1
  25. package/esm/sdk/models/commitment-response.d.ts +3 -0
  26. package/esm/sdk/models/commitment-response.d.ts.map +1 -1
  27. package/esm/sdk/models/commitment-response.js.map +1 -1
  28. package/esm/sdk/models/create-commitment-request.d.ts +5 -2
  29. package/esm/sdk/models/create-commitment-request.d.ts.map +1 -1
  30. package/esm/sdk/models/create-commitment-request.js +1 -1
  31. package/esm/sdk/models/create-commitment-request.js.map +1 -1
  32. package/esm/sdk/models/get-price-history-op.d.ts +15 -0
  33. package/esm/sdk/models/get-price-history-op.d.ts.map +1 -0
  34. package/esm/sdk/models/get-price-history-op.js +12 -0
  35. package/esm/sdk/models/get-price-history-op.js.map +1 -0
  36. package/esm/sdk/models/get-subscription-line-item-history-op.d.ts +15 -0
  37. package/esm/sdk/models/get-subscription-line-item-history-op.d.ts.map +1 -0
  38. package/esm/sdk/models/get-subscription-line-item-history-op.js +12 -0
  39. package/esm/sdk/models/get-subscription-line-item-history-op.js.map +1 -0
  40. package/esm/sdk/models/grouped-invoicing-child-request.d.ts +3 -0
  41. package/esm/sdk/models/grouped-invoicing-child-request.d.ts.map +1 -1
  42. package/esm/sdk/models/grouped-invoicing-child-request.js +3 -0
  43. package/esm/sdk/models/grouped-invoicing-child-request.js.map +1 -1
  44. package/esm/sdk/models/index.d.ts +4 -0
  45. package/esm/sdk/models/index.d.ts.map +1 -1
  46. package/esm/sdk/models/index.js +4 -0
  47. package/esm/sdk/models/index.js.map +1 -1
  48. package/esm/sdk/models/payment-attempt-response.d.ts +1 -0
  49. package/esm/sdk/models/payment-attempt-response.d.ts.map +1 -1
  50. package/esm/sdk/models/payment-attempt-response.js +2 -0
  51. package/esm/sdk/models/payment-attempt-response.js.map +1 -1
  52. package/esm/sdk/models/update-subscription-request.d.ts +3 -0
  53. package/esm/sdk/models/update-subscription-request.d.ts.map +1 -1
  54. package/esm/sdk/models/update-subscription-request.js +3 -0
  55. package/esm/sdk/models/update-subscription-request.js.map +1 -1
  56. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.d.ts +17 -0
  57. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.d.ts.map +1 -0
  58. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.js +27 -0
  59. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.js.map +1 -0
  60. package/esm/sdk/models/webhook-dto-payment-attempt.d.ts +17 -0
  61. package/esm/sdk/models/webhook-dto-payment-attempt.d.ts.map +1 -0
  62. package/esm/sdk/models/webhook-dto-payment-attempt.js +27 -0
  63. package/esm/sdk/models/webhook-dto-payment-attempt.js.map +1 -0
  64. package/esm/sdk/models/webhook-event-name.d.ts +1 -0
  65. package/esm/sdk/models/webhook-event-name.d.ts.map +1 -1
  66. package/esm/sdk/models/webhook-event-name.js +1 -0
  67. package/esm/sdk/models/webhook-event-name.js.map +1 -1
  68. package/esm/sdk/prices.d.ts +7 -0
  69. package/esm/sdk/prices.d.ts.map +1 -1
  70. package/esm/sdk/prices.js +10 -0
  71. package/esm/sdk/prices.js.map +1 -1
  72. package/esm/sdk/subscriptions.d.ts +7 -0
  73. package/esm/sdk/subscriptions.d.ts.map +1 -1
  74. package/esm/sdk/subscriptions.js +10 -0
  75. package/esm/sdk/subscriptions.js.map +1 -1
  76. package/esm/sdk/webhook-events.d.ts +7 -0
  77. package/esm/sdk/webhook-events.d.ts.map +1 -1
  78. package/esm/sdk/webhook-events.js +10 -0
  79. package/esm/sdk/webhook-events.js.map +1 -1
  80. package/jsr.json +1 -1
  81. package/package.json +1 -1
  82. package/src/funcs/events-get-usage-analytics.ts +5 -0
  83. package/src/funcs/prices-get-price-history.ts +181 -0
  84. package/src/funcs/subscriptions-get-subscription-line-item-history.ts +185 -0
  85. package/src/funcs/webhook-events-post-webhook-events-payment-attempt-failed.ts +144 -0
  86. package/src/lib/config.ts +10 -2
  87. package/src/sdk/events.ts +5 -0
  88. package/src/sdk/models/commitment-response.ts +3 -0
  89. package/src/sdk/models/create-commitment-request.ts +6 -3
  90. package/src/sdk/models/get-price-history-op.ts +33 -0
  91. package/src/sdk/models/get-subscription-line-item-history-op.ts +36 -0
  92. package/src/sdk/models/grouped-invoicing-child-request.ts +8 -0
  93. package/src/sdk/models/index.ts +4 -0
  94. package/src/sdk/models/payment-attempt-response.ts +3 -0
  95. package/src/sdk/models/update-subscription-request.ts +8 -0
  96. package/src/sdk/models/webhook-dto-payment-attempt-webhook-payload.ts +61 -0
  97. package/src/sdk/models/webhook-dto-payment-attempt.ts +52 -0
  98. package/src/sdk/models/webhook-event-name.ts +1 -0
  99. package/src/sdk/prices.ts +18 -0
  100. package/src/sdk/subscriptions.ts +18 -0
  101. package/src/sdk/webhook-events.ts +16 -0
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+
12
+ export type WebhookDtoPaymentAttempt = {
13
+ attemptNumber?: number | undefined;
14
+ createdAt?: Date | undefined;
15
+ errorMessage?: string | undefined;
16
+ gatewayAttemptId?: string | undefined;
17
+ id?: string | undefined;
18
+ metadata?: { [k: string]: string } | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const WebhookDtoPaymentAttempt$inboundSchema: z.ZodMiniType<
23
+ WebhookDtoPaymentAttempt,
24
+ unknown
25
+ > = z.pipe(
26
+ z.object({
27
+ attempt_number: types.optional(types.number()),
28
+ created_at: types.optional(types.date()),
29
+ error_message: types.optional(types.string()),
30
+ gateway_attempt_id: types.optional(types.string()),
31
+ id: types.optional(types.string()),
32
+ metadata: types.optional(z.record(z.string(), types.string())),
33
+ }),
34
+ z.transform((v) => {
35
+ return remap$(v, {
36
+ "attempt_number": "attemptNumber",
37
+ "created_at": "createdAt",
38
+ "error_message": "errorMessage",
39
+ "gateway_attempt_id": "gatewayAttemptId",
40
+ });
41
+ }),
42
+ );
43
+
44
+ export function webhookDtoPaymentAttemptFromJSON(
45
+ jsonString: string,
46
+ ): SafeParseResult<WebhookDtoPaymentAttempt, SDKValidationError> {
47
+ return safeParse(
48
+ jsonString,
49
+ (x) => WebhookDtoPaymentAttempt$inboundSchema.parse(JSON.parse(x)),
50
+ `Failed to parse 'WebhookDtoPaymentAttempt' from JSON`,
51
+ );
52
+ }
@@ -36,6 +36,7 @@ export const WebhookEventName = {
36
36
  PaymentCreated: "payment.created",
37
37
  PaymentUpdated: "payment.updated",
38
38
  PaymentFailed: "payment.failed",
39
+ PaymentAttemptFailed: "payment.attempt.failed",
39
40
  PaymentSuccess: "payment.success",
40
41
  PaymentPending: "payment.pending",
41
42
  RefundCreated: "refund.created",
package/src/sdk/prices.ts CHANGED
@@ -6,6 +6,7 @@ import { pricesCreatePrice } from "../funcs/prices-create-price.js";
6
6
  import { pricesCreatePricesBulk } from "../funcs/prices-create-prices-bulk.js";
7
7
  import { pricesDeletePrice } from "../funcs/prices-delete-price.js";
8
8
  import { pricesGetPriceByLookupKey } from "../funcs/prices-get-price-by-lookup-key.js";
9
+ import { pricesGetPriceHistory } from "../funcs/prices-get-price-history.js";
9
10
  import { pricesGetPrice } from "../funcs/prices-get-price.js";
10
11
  import { pricesQueryPrice } from "../funcs/prices-query-price.js";
11
12
  import { pricesUpdatePrice } from "../funcs/prices-update-price.js";
@@ -136,4 +137,21 @@ export class Prices extends ClientSDK {
136
137
  options,
137
138
  ));
138
139
  }
140
+
141
+ /**
142
+ * Get price history
143
+ *
144
+ * @remarks
145
+ * Use when you need every version of a plan price, oldest first. Pass the ID of any version; the same timeline is returned.
146
+ */
147
+ async getPriceHistory(
148
+ id: string,
149
+ options?: RequestOptions,
150
+ ): Promise<models.ListPricesResponse> {
151
+ return unwrapAsync(pricesGetPriceHistory(
152
+ this,
153
+ id,
154
+ options,
155
+ ));
156
+ }
139
157
  }
@@ -14,6 +14,7 @@ import { subscriptionsExecuteSubscriptionModify } from "../funcs/subscriptions-e
14
14
  import { subscriptionsExecuteSubscriptionPlanChangeV2 } from "../funcs/subscriptions-execute-subscription-plan-change-v2.js";
15
15
  import { subscriptionsGetSubscriptionAddonAssociations } from "../funcs/subscriptions-get-subscription-addon-associations.js";
16
16
  import { subscriptionsGetSubscriptionEntitlements } from "../funcs/subscriptions-get-subscription-entitlements.js";
17
+ import { subscriptionsGetSubscriptionLineItemHistory } from "../funcs/subscriptions-get-subscription-line-item-history.js";
17
18
  import { subscriptionsGetSubscriptionSchedule } from "../funcs/subscriptions-get-subscription-schedule.js";
18
19
  import { subscriptionsGetSubscriptionUpcomingGrants } from "../funcs/subscriptions-get-subscription-upcoming-grants.js";
19
20
  import { subscriptionsGetSubscriptionUsage } from "../funcs/subscriptions-get-subscription-usage.js";
@@ -148,6 +149,23 @@ export class Subscriptions extends ClientSDK {
148
149
  ));
149
150
  }
150
151
 
152
+ /**
153
+ * Get subscription line item history
154
+ *
155
+ * @remarks
156
+ * Use when you need every version of a subscription line item, oldest first. Pass the ID of any version; the same timeline is returned. Versions cancelled before they started are left out unless requested directly.
157
+ */
158
+ async getSubscriptionLineItemHistory(
159
+ id: string,
160
+ options?: RequestOptions,
161
+ ): Promise<models.ListSubscriptionLineItemsResponse> {
162
+ return unwrapAsync(subscriptionsGetSubscriptionLineItemHistory(
163
+ this,
164
+ id,
165
+ options,
166
+ ));
167
+ }
168
+
151
169
  /**
152
170
  * List all subscription schedules
153
171
  *
@@ -31,6 +31,7 @@ import { webhookEventsPostWebhookEventsInvoiceUpdateFinalized } from "../funcs/w
31
31
  import { webhookEventsPostWebhookEventsInvoiceUpdatePayment } from "../funcs/webhook-events-post-webhook-events-invoice-update-payment.js";
32
32
  import { webhookEventsPostWebhookEventsInvoiceUpdateVoided } from "../funcs/webhook-events-post-webhook-events-invoice-update-voided.js";
33
33
  import { webhookEventsPostWebhookEventsInvoiceUpdate } from "../funcs/webhook-events-post-webhook-events-invoice-update.js";
34
+ import { webhookEventsPostWebhookEventsPaymentAttemptFailed } from "../funcs/webhook-events-post-webhook-events-payment-attempt-failed.js";
34
35
  import { webhookEventsPostWebhookEventsPaymentCreated } from "../funcs/webhook-events-post-webhook-events-payment-created.js";
35
36
  import { webhookEventsPostWebhookEventsPaymentFailed } from "../funcs/webhook-events-post-webhook-events-payment-failed.js";
36
37
  import { webhookEventsPostWebhookEventsPaymentPending } from "../funcs/webhook-events-post-webhook-events-payment-pending.js";
@@ -509,6 +510,21 @@ export class WebhookEvents extends ClientSDK {
509
510
  ));
510
511
  }
511
512
 
513
+ /**
514
+ * payment.attempt.failed
515
+ *
516
+ * @remarks
517
+ * Fired when one charge attempt is declined and the payment stays open for retry. Doc-only for parsing.
518
+ */
519
+ async postWebhookEventsPaymentAttemptFailed(
520
+ options?: RequestOptions,
521
+ ): Promise<models.WebhookDtoPaymentAttemptWebhookPayload> {
522
+ return unwrapAsync(webhookEventsPostWebhookEventsPaymentAttemptFailed(
523
+ this,
524
+ options,
525
+ ));
526
+ }
527
+
512
528
  /**
513
529
  * payment.created
514
530
  *