@leaflow/sdk 0.208.0 → 0.210.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/v1/generated/models.d.ts +133 -69
- package/dist/billing/v1/generated/models.js +12 -26
- package/dist/billing/v1/generated/schemas.zod.d.ts +91 -18
- package/dist/billing/v1/generated/schemas.zod.js +132 -14
- package/dist/billing/v1/generated/validators/activeResource.zod.js +2 -1
- package/dist/billing/v1/generated/validators/activeResourceStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/activeResourceStatus.zod.js +9 -0
- package/dist/billing/v1/generated/validators/allowance.zod.js +2 -1
- package/dist/billing/v1/generated/validators/allowanceStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/allowanceStatus.zod.js +9 -0
- package/dist/billing/v1/generated/validators/creditGrant.zod.js +2 -1
- package/dist/billing/v1/generated/validators/creditGrantStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/creditGrantStatus.zod.js +9 -0
- package/dist/billing/v1/generated/validators/creditNote.zod.js +2 -1
- package/dist/billing/v1/generated/validators/creditNoteStatus.zod.d.ts +14 -0
- package/dist/billing/v1/generated/validators/creditNoteStatus.zod.js +9 -0
- package/dist/billing/v1/generated/validators/discount.zod.js +2 -3
- package/dist/billing/v1/generated/validators/discountStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/discountStatus.zod.js +11 -0
- package/dist/billing/v1/generated/validators/listAccountDiscountsParams.zod.d.ts +7 -0
- package/dist/billing/v1/generated/validators/listAccountDiscountsParams.zod.js +3 -0
- package/dist/billing/v1/generated/validators/listActiveResourcesParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listActiveResourcesParams.zod.js +3 -1
- package/dist/billing/v1/generated/validators/listAllowancesParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listAllowancesParams.zod.js +3 -1
- package/dist/billing/v1/generated/validators/listCancellationsParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listCancellationsParams.zod.js +4 -1
- package/dist/billing/v1/generated/validators/listCheckoutSessionsParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listCheckoutSessionsParams.zod.js +6 -1
- package/dist/billing/v1/generated/validators/listCreditGrantsParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listCreditGrantsParams.zod.js +3 -1
- package/dist/billing/v1/generated/validators/listCreditNotesParams.zod.d.ts +5 -0
- package/dist/billing/v1/generated/validators/listCreditNotesParams.zod.js +3 -0
- package/dist/billing/v1/generated/validators/listFeatureGrantsParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listFeatureGrantsParams.zod.js +2 -1
- package/dist/billing/v1/generated/validators/listInvoicesParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listInvoicesParams.zod.js +2 -1
- package/dist/billing/v1/generated/validators/listOrdersParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listOrdersParams.zod.js +2 -1
- package/dist/billing/v1/generated/validators/listPaymentMethodsParams.zod.d.ts +5 -0
- package/dist/billing/v1/generated/validators/listPaymentMethodsParams.zod.js +6 -0
- package/dist/billing/v1/generated/validators/listRefundsParams.zod.d.ts +7 -0
- package/dist/billing/v1/generated/validators/listRefundsParams.zod.js +3 -0
- package/dist/billing/v1/generated/validators/listStatementsParams.zod.d.ts +3 -2
- package/dist/billing/v1/generated/validators/listStatementsParams.zod.js +2 -1
- package/dist/billing/v1/generated/validators/listSubscriptionsParams.zod.d.ts +9 -0
- package/dist/billing/v1/generated/validators/listSubscriptionsParams.zod.js +3 -0
- package/dist/billing/v1/generated/validators/listTopUpsParams.zod.d.ts +7 -0
- package/dist/billing/v1/generated/validators/listTopUpsParams.zod.js +3 -0
- package/dist/billing/v1/generated/validators/listTransactionsParams.zod.d.ts +15 -0
- package/dist/billing/v1/generated/validators/listTransactionsParams.zod.js +6 -0
- package/dist/billing/v1/generated/validators/listWithdrawalsParams.zod.d.ts +9 -0
- package/dist/billing/v1/generated/validators/listWithdrawalsParams.zod.js +3 -0
- package/dist/billing/v1/generated/validators/refund.zod.js +2 -3
- package/dist/billing/v1/generated/validators/refundStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/refundStatus.zod.js +11 -0
- package/dist/billing/v1/generated/validators/subscription.zod.js +2 -3
- package/dist/billing/v1/generated/validators/subscriptionStatus.zod.d.ts +18 -0
- package/dist/billing/v1/generated/validators/subscriptionStatus.zod.js +11 -0
- package/dist/billing/v1/generated/validators/topUp.zod.js +2 -3
- package/dist/billing/v1/generated/validators/topUpStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/topUpStatus.zod.js +11 -0
- package/dist/billing/v1/generated/validators/transaction.zod.js +2 -4
- package/dist/billing/v1/generated/validators/transactionStatus.zod.d.ts +16 -0
- package/dist/billing/v1/generated/validators/transactionStatus.zod.js +11 -0
- package/dist/billing/v1/generated/validators/withdrawal.zod.js +2 -8
- package/dist/billing/v1/generated/validators/withdrawalStatus.zod.d.ts +18 -0
- package/dist/billing/v1/generated/validators/withdrawalStatus.zod.js +16 -0
- package/dist/canopy/v1/generated/functions.d.ts +73 -1
- package/dist/canopy/v1/generated/functions.js +92 -6
- package/dist/canopy/v1/generated/models.d.ts +148 -12
- package/dist/canopy/v1/generated/models.js +13 -0
- package/dist/canopy/v1/generated/schemas.zod.d.ts +49 -0
- package/dist/canopy/v1/generated/schemas.zod.js +28 -0
- package/dist/canopy/v1/generated/validators/cursorPageRequestResource.zod.d.ts +10 -0
- package/dist/canopy/v1/generated/validators/getVideoContentHeaders.zod.d.ts +46 -0
- package/dist/canopy/v1/generated/validators/getVideoContentHeaders.zod.js +44 -0
- package/dist/canopy/v1/generated/validators/mediaUsageDetails.zod.d.ts +61 -0
- package/dist/canopy/v1/generated/validators/mediaUsageDetails.zod.js +67 -0
- package/dist/canopy/v1/generated/validators/requestResource.zod.d.ts +10 -0
- package/dist/canopy/v1/generated/validators/requestResource.zod.js +2 -0
- package/dist/canopy/v1/generated/validators/videoCreateRequest.zod.d.ts +67 -0
- package/dist/canopy/v1/generated/validators/videoCreateRequest.zod.js +70 -0
- package/dist/canopy/v1/generated/validators/videoReferenceMedia.zod.d.ts +53 -0
- package/dist/canopy/v1/generated/validators/videoReferenceMedia.zod.js +53 -0
- package/dist/canopy/v1/generated/validators/videoTask.zod.d.ts +71 -0
- package/dist/canopy/v1/generated/validators/videoTask.zod.js +64 -0
- package/dist/canopy/v1/generated/validators/videoUsage.zod.d.ts +54 -0
- package/dist/canopy/v1/generated/validators/videoUsage.zod.js +62 -0
- package/dist/compute/v2/generated/models.d.ts +1 -1
- package/dist/compute/v2/generated/validators/createSecurityGroupRuleRequestBody.zod.js +1 -1
- package/dist/proto/leaflow/fleet/virtualdesktop/datatransfer/v1/datatransfer_pb.d.ts +10 -5
- package/dist/routes.d.ts +24 -0
- package/dist/routes.js +27 -0
- package/package.json +1 -1
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* OpenAPI spec version: v1
|
|
7
7
|
*/
|
|
8
8
|
import * as zod from "zod";
|
|
9
|
+
import { TransactionStatus } from "./transactionStatus.zod.js";
|
|
10
|
+
import { TransactionType } from "./transactionType.zod.js";
|
|
9
11
|
export const listTransactionsParamsPageDefault = 1;
|
|
10
12
|
export const listTransactionsParamsPageMax = 2147483647;
|
|
11
13
|
export const listTransactionsParamsPageSizeDefault = 50;
|
|
12
14
|
export const listTransactionsParamsPageSizeMax = 200;
|
|
15
|
+
export const listTransactionsParamsTypeMax = 5;
|
|
16
|
+
export const listTransactionsParamsStatusMax = 4;
|
|
13
17
|
export const ListTransactionsParams = zod.strictObject({
|
|
14
18
|
page: zod
|
|
15
19
|
.int()
|
|
@@ -24,4 +28,6 @@ export const ListTransactionsParams = zod.strictObject({
|
|
|
24
28
|
billing_account_id: zod.int().optional(),
|
|
25
29
|
from: zod.iso.datetime({ offset: true }).optional(),
|
|
26
30
|
to: zod.iso.datetime({ offset: true }).optional(),
|
|
31
|
+
type: zod.array(TransactionType).min(1).max(listTransactionsParamsTypeMax).optional(),
|
|
32
|
+
status: zod.array(TransactionStatus).min(1).max(listTransactionsParamsStatusMax).optional(),
|
|
27
33
|
});
|
|
@@ -10,10 +10,19 @@ export declare const listWithdrawalsParamsPageDefault = 1;
|
|
|
10
10
|
export declare const listWithdrawalsParamsPageMax = 2147483647;
|
|
11
11
|
export declare const listWithdrawalsParamsPageSizeDefault = 50;
|
|
12
12
|
export declare const listWithdrawalsParamsPageSizeMax = 200;
|
|
13
|
+
export declare const listWithdrawalsParamsStatusMax = 6;
|
|
13
14
|
export declare const ListWithdrawalsParams: zod.ZodObject<{
|
|
14
15
|
page: zod.ZodDefault<zod.ZodInt>;
|
|
15
16
|
page_size: zod.ZodDefault<zod.ZodInt>;
|
|
16
17
|
billing_account_id: zod.ZodOptional<zod.ZodInt>;
|
|
18
|
+
status: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
|
|
19
|
+
failed: "failed";
|
|
20
|
+
pending: "pending";
|
|
21
|
+
succeeded: "succeeded";
|
|
22
|
+
processing: "processing";
|
|
23
|
+
partially_completed: "partially_completed";
|
|
24
|
+
reversed: "reversed";
|
|
25
|
+
}>>>;
|
|
17
26
|
}, zod.z.core.$strict>;
|
|
18
27
|
export type ListWithdrawalsParams = zod.input<typeof ListWithdrawalsParams>;
|
|
19
28
|
export type ListWithdrawalsParamsOutput = zod.output<typeof ListWithdrawalsParams>;
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* OpenAPI spec version: v1
|
|
7
7
|
*/
|
|
8
8
|
import * as zod from "zod";
|
|
9
|
+
import { WithdrawalStatus } from "./withdrawalStatus.zod.js";
|
|
9
10
|
export const listWithdrawalsParamsPageDefault = 1;
|
|
10
11
|
export const listWithdrawalsParamsPageMax = 2147483647;
|
|
11
12
|
export const listWithdrawalsParamsPageSizeDefault = 50;
|
|
12
13
|
export const listWithdrawalsParamsPageSizeMax = 200;
|
|
14
|
+
export const listWithdrawalsParamsStatusMax = 6;
|
|
13
15
|
export const ListWithdrawalsParams = zod.strictObject({
|
|
14
16
|
page: zod
|
|
15
17
|
.int()
|
|
@@ -22,4 +24,5 @@ export const ListWithdrawalsParams = zod.strictObject({
|
|
|
22
24
|
.max(listWithdrawalsParamsPageSizeMax)
|
|
23
25
|
.default(listWithdrawalsParamsPageSizeDefault),
|
|
24
26
|
billing_account_id: zod.int().optional(),
|
|
27
|
+
status: zod.array(WithdrawalStatus).min(1).max(listWithdrawalsParamsStatusMax).optional(),
|
|
25
28
|
});
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import * as zod from "zod";
|
|
9
9
|
import { Money } from "./money.zod.js";
|
|
10
10
|
import { RefundReason } from "./refundReason.zod.js";
|
|
11
|
+
import { RefundStatus } from "./refundStatus.zod.js";
|
|
11
12
|
import { Transaction } from "./transaction.zod.js";
|
|
12
13
|
export const Refund = zod.strictObject({
|
|
13
14
|
transaction_id: zod.uuid().optional(),
|
|
@@ -32,9 +33,7 @@ export const Refund = zod.strictObject({
|
|
|
32
33
|
.enum(["balance", "gateway"])
|
|
33
34
|
.optional()
|
|
34
35
|
.describe("Use balance_amount, credit_amount and gateway_amount, which also show a refund split between destinations."),
|
|
35
|
-
status:
|
|
36
|
-
.enum(["pending", "processing", "succeeded", "failed"])
|
|
37
|
-
.describe("Summary of the parts in `transactions`.\n\n- `pending`: nothing has been returned yet, and at least one part is in progress.\n- `processing`: some parts have been returned, and at least one is still in progress.\n- `succeeded`: every part has been returned.\n- `failed`: no part is in progress and at least one has failed. What was returned is in\n settled_amount.\n\nReturns to the balance and to credit grants complete shortly after the refund is made; a\nreturn to a payment method completes when the gateway confirms it."),
|
|
36
|
+
status: RefundStatus,
|
|
38
37
|
settled_at: zod.iso
|
|
39
38
|
.datetime({ offset: true })
|
|
40
39
|
.optional()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export declare const RefundStatus: zod.ZodEnum<{
|
|
10
|
+
failed: "failed";
|
|
11
|
+
pending: "pending";
|
|
12
|
+
succeeded: "succeeded";
|
|
13
|
+
processing: "processing";
|
|
14
|
+
}>;
|
|
15
|
+
export type RefundStatus = zod.input<typeof RefundStatus>;
|
|
16
|
+
export type RefundStatusOutput = zod.output<typeof RefundStatus>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export const RefundStatus = zod
|
|
10
|
+
.enum(["pending", "processing", "succeeded", "failed"])
|
|
11
|
+
.describe("Summary of the parts in `transactions`.\n\n- `pending`: nothing has been returned yet, and at least one part is in progress.\n- `processing`: some parts have been returned, and at least one is still in progress.\n- `succeeded`: every part has been returned.\n- `failed`: no part is in progress and at least one has failed. What was returned is in\n settled_amount.\n\nReturns to the balance and to credit grants complete shortly after the refund is made; a\nreturn to a payment method completes when the gateway confirms it.");
|
|
@@ -17,6 +17,7 @@ import { RefundPolicy } from "./refundPolicy.zod.js";
|
|
|
17
17
|
import { ScheduledChange } from "./scheduledChange.zod.js";
|
|
18
18
|
import { SubscriptionCancellation } from "./subscriptionCancellation.zod.js";
|
|
19
19
|
import { SubscriptionRestriction } from "./subscriptionRestriction.zod.js";
|
|
20
|
+
import { SubscriptionStatus } from "./subscriptionStatus.zod.js";
|
|
20
21
|
import { UsageType } from "./usageType.zod.js";
|
|
21
22
|
export const subscriptionDiscountedRenewalsRemainingMin = 0;
|
|
22
23
|
export const Subscription = zod
|
|
@@ -107,9 +108,7 @@ export const Subscription = zod
|
|
|
107
108
|
auto_renew: zod
|
|
108
109
|
.boolean()
|
|
109
110
|
.describe("Whether a licensed subscription renews automatically. A metered subscription continues until it is canceled; for it this is true until a cancellation is requested, and cannot be set."),
|
|
110
|
-
status:
|
|
111
|
-
.enum(["pending", "provisioning", "active", "suspended", "canceled", "terminated"])
|
|
112
|
-
.describe("`pending`: the order has not been accepted. `provisioning`: the owning service accepted the order and is delivering. `active`: delivery was confirmed; payment alone does not make a subscription active. `suspended`: service is stopped while a lien restricts its use. `canceled`: cancellation completed, or an undelivered purchase was canceled or failed. `terminated`: an operator or the owning service ended it immediately."),
|
|
111
|
+
status: SubscriptionStatus,
|
|
113
112
|
started_at: zod.iso
|
|
114
113
|
.datetime({ offset: true })
|
|
115
114
|
.nullish()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export declare const SubscriptionStatus: zod.ZodEnum<{
|
|
10
|
+
active: "active";
|
|
11
|
+
pending: "pending";
|
|
12
|
+
suspended: "suspended";
|
|
13
|
+
canceled: "canceled";
|
|
14
|
+
provisioning: "provisioning";
|
|
15
|
+
terminated: "terminated";
|
|
16
|
+
}>;
|
|
17
|
+
export type SubscriptionStatus = zod.input<typeof SubscriptionStatus>;
|
|
18
|
+
export type SubscriptionStatusOutput = zod.output<typeof SubscriptionStatus>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export const SubscriptionStatus = zod
|
|
10
|
+
.enum(["pending", "provisioning", "active", "suspended", "canceled", "terminated"])
|
|
11
|
+
.describe("`pending`: the order has not been accepted. `provisioning`: the owning service accepted the order and is delivering. `active`: delivery was confirmed; payment alone does not make a subscription active. `suspended`: service is stopped while a lien restricts its use. `canceled`: cancellation completed, or an undelivered purchase was canceled or failed. `terminated`: an operator or the owning service ended it immediately.");
|
|
@@ -10,6 +10,7 @@ import { AccountIdentity } from "./accountIdentity.zod.js";
|
|
|
10
10
|
import { Money } from "./money.zod.js";
|
|
11
11
|
import { PaymentAction } from "./paymentAction.zod.js";
|
|
12
12
|
import { PaymentCancellationReason } from "./paymentCancellationReason.zod.js";
|
|
13
|
+
import { TopUpStatus } from "./topUpStatus.zod.js";
|
|
13
14
|
export const TopUp = zod
|
|
14
15
|
.strictObject({
|
|
15
16
|
id: zod.uuid(),
|
|
@@ -18,9 +19,7 @@ export const TopUp = zod
|
|
|
18
19
|
amount: Money.describe("What is credited to the account, in its currency."),
|
|
19
20
|
currency: zod.string(),
|
|
20
21
|
remaining_amount: Money.optional().describe("The part of this top-up still in the balance. Pending refunds may hold part of it, so not all of it is necessarily withdrawable."),
|
|
21
|
-
status:
|
|
22
|
-
.enum(["pending", "succeeded", "failed", "canceled"])
|
|
23
|
-
.describe("`pending` until the payment gateway reaches a result; the balance increases on `succeeded`. `failed`: the gateway declined the payment, which is withdrawn at the gateway; create a new top-up to pay another way. `canceled`: withdrawn without collecting money, for the reason in `cancellation_reason`. Unknown gateway outcomes stay `pending`; a browser redirect is not proof of payment. `failed` and `canceled` are final; a payment the gateway collects afterwards is credited as a separate `succeeded` top-up."),
|
|
22
|
+
status: TopUpStatus,
|
|
24
23
|
cancellation_reason: PaymentCancellationReason.optional(),
|
|
25
24
|
payment_gateway: zod.string().optional().describe("Which payment gateway collected it."),
|
|
26
25
|
method_type: zod
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export declare const TopUpStatus: zod.ZodEnum<{
|
|
10
|
+
failed: "failed";
|
|
11
|
+
pending: "pending";
|
|
12
|
+
canceled: "canceled";
|
|
13
|
+
succeeded: "succeeded";
|
|
14
|
+
}>;
|
|
15
|
+
export type TopUpStatus = zod.input<typeof TopUpStatus>;
|
|
16
|
+
export type TopUpStatusOutput = zod.output<typeof TopUpStatus>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export const TopUpStatus = zod
|
|
10
|
+
.enum(["pending", "succeeded", "failed", "canceled"])
|
|
11
|
+
.describe("`pending` until the payment gateway reaches a result; the balance increases on `succeeded`. `failed`: the gateway declined the payment, which is withdrawn at the gateway; create a new top-up to pay another way. `canceled`: withdrawn without collecting money, for the reason in `cancellation_reason`. Unknown gateway outcomes stay `pending`; a browser redirect is not proof of payment. `failed` and `canceled` are final; a payment the gateway collects afterwards is credited as a separate `succeeded` top-up.");
|
|
@@ -9,6 +9,7 @@ import * as zod from "zod";
|
|
|
9
9
|
import { Money } from "./money.zod.js";
|
|
10
10
|
import { ObjectIdentity } from "./objectIdentity.zod.js";
|
|
11
11
|
import { PaymentCancellationReason } from "./paymentCancellationReason.zod.js";
|
|
12
|
+
import { TransactionStatus } from "./transactionStatus.zod.js";
|
|
12
13
|
import { TransactionType } from "./transactionType.zod.js";
|
|
13
14
|
export const Transaction = zod
|
|
14
15
|
.strictObject({
|
|
@@ -24,10 +25,7 @@ export const Transaction = zod
|
|
|
24
25
|
.enum(["balance", "credit", "gateway"])
|
|
25
26
|
.optional()
|
|
26
27
|
.describe("Present on refunds: where this part goes. `balance`: the account balance. `credit`: the credit grant that paid, keeping its original expiry. `gateway`: the payment method it was paid with."),
|
|
27
|
-
status:
|
|
28
|
-
.enum(["pending", "succeeded", "failed", "canceled"])
|
|
29
|
-
.optional()
|
|
30
|
-
.describe("`failed`: the operation did not succeed; for a gateway payment, the gateway declined it. `canceled`: a gateway payment was withdrawn without collecting money. Either way, the invoice it was for stays open."),
|
|
28
|
+
status: TransactionStatus.optional(),
|
|
31
29
|
cancellation_reason: PaymentCancellationReason.optional(),
|
|
32
30
|
payment_gateway: zod.string().optional(),
|
|
33
31
|
method_type: zod.string().optional(),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export declare const TransactionStatus: zod.ZodEnum<{
|
|
10
|
+
failed: "failed";
|
|
11
|
+
pending: "pending";
|
|
12
|
+
canceled: "canceled";
|
|
13
|
+
succeeded: "succeeded";
|
|
14
|
+
}>;
|
|
15
|
+
export type TransactionStatus = zod.input<typeof TransactionStatus>;
|
|
16
|
+
export type TransactionStatusOutput = zod.output<typeof TransactionStatus>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export const TransactionStatus = zod
|
|
10
|
+
.enum(["pending", "succeeded", "failed", "canceled"])
|
|
11
|
+
.describe("`failed`: the operation did not succeed; for a gateway payment, the gateway declined it. `canceled`: a gateway payment was withdrawn without collecting money. Either way, the invoice it was for stays open.");
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* OpenAPI spec version: v1
|
|
7
7
|
*/
|
|
8
8
|
import * as zod from "zod";
|
|
9
|
+
import { WithdrawalStatus } from "./withdrawalStatus.zod.js";
|
|
9
10
|
export const withdrawalCurrencyMin = 3;
|
|
10
11
|
export const withdrawalCurrencyMax = 3;
|
|
11
12
|
export const withdrawalAmountRegExp = new RegExp("^[0-9]{1,15}([.][0-9]{1,10})?$");
|
|
@@ -25,14 +26,7 @@ export const Withdrawal = zod
|
|
|
25
26
|
deducted_amount: zod.string().regex(withdrawalDeductedAmountRegExp),
|
|
26
27
|
settled_amount: zod.string().regex(withdrawalSettledAmountRegExp),
|
|
27
28
|
charged_fee_amount: zod.string().regex(withdrawalChargedFeeAmountRegExp),
|
|
28
|
-
status:
|
|
29
|
-
"pending",
|
|
30
|
-
"processing",
|
|
31
|
-
"succeeded",
|
|
32
|
-
"partially_completed",
|
|
33
|
-
"failed",
|
|
34
|
-
"reversed",
|
|
35
|
-
]),
|
|
29
|
+
status: WithdrawalStatus,
|
|
36
30
|
created_at: zod.iso.datetime({ offset: true }),
|
|
37
31
|
completed_at: zod.iso.datetime({ offset: true }).optional(),
|
|
38
32
|
created_by: zod
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export declare const WithdrawalStatus: zod.ZodEnum<{
|
|
10
|
+
failed: "failed";
|
|
11
|
+
pending: "pending";
|
|
12
|
+
succeeded: "succeeded";
|
|
13
|
+
processing: "processing";
|
|
14
|
+
partially_completed: "partially_completed";
|
|
15
|
+
reversed: "reversed";
|
|
16
|
+
}>;
|
|
17
|
+
export type WithdrawalStatus = zod.input<typeof WithdrawalStatus>;
|
|
18
|
+
export type WithdrawalStatusOutput = zod.output<typeof WithdrawalStatus>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Billing API
|
|
5
|
+
* Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, quote purchases, changes and renewals, preview cancellations, and, with the project permission `billing:finance.manage` granted in IAM, renew, cancel and turn automatic renewal of its subscriptions on or off, change its billing account and read its costs. A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
|
|
6
|
+
* OpenAPI spec version: v1
|
|
7
|
+
*/
|
|
8
|
+
import * as zod from "zod";
|
|
9
|
+
export const WithdrawalStatus = zod.enum([
|
|
10
|
+
"pending",
|
|
11
|
+
"processing",
|
|
12
|
+
"succeeded",
|
|
13
|
+
"partially_completed",
|
|
14
|
+
"failed",
|
|
15
|
+
"reversed",
|
|
16
|
+
]);
|
|
@@ -38,13 +38,85 @@
|
|
|
38
38
|
* - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
|
|
39
39
|
* OpenAPI spec version: 1.0.0
|
|
40
40
|
*/
|
|
41
|
-
import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, NativeRequest, NativeResponse, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, StreamGenerateContentParams, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody } from "./models.js";
|
|
41
|
+
import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, GetVideoContentHeaders, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, NativeRequest, NativeResponse, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, StreamGenerateContentParams, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody, VideoCreateRequest, VideoTask } from "./models.js";
|
|
42
42
|
export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
|
|
43
43
|
export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
|
|
44
44
|
export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
|
|
45
45
|
export type HTTPStatusCode4xx = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451;
|
|
46
46
|
export type HTTPStatusCode5xx = 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
47
47
|
export type HTTPStatusCodes = HTTPStatusCode1xx | HTTPStatusCode2xx | HTTPStatusCode3xx | HTTPStatusCode4xx | HTTPStatusCode5xx;
|
|
48
|
+
export type createVideoResponse200 = {
|
|
49
|
+
data: VideoTask;
|
|
50
|
+
status: 200;
|
|
51
|
+
};
|
|
52
|
+
export type createVideoResponseDefault = {
|
|
53
|
+
data: InferenceError;
|
|
54
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
55
|
+
};
|
|
56
|
+
export type createVideoResponseSuccess = createVideoResponse200 & {
|
|
57
|
+
headers: Headers;
|
|
58
|
+
};
|
|
59
|
+
export type createVideoResponseError = createVideoResponseDefault & {
|
|
60
|
+
headers: Headers;
|
|
61
|
+
};
|
|
62
|
+
export type createVideoResponse = createVideoResponseSuccess | createVideoResponseError;
|
|
63
|
+
export declare const getCreateVideoUrl: () => string;
|
|
64
|
+
/**
|
|
65
|
+
* Create an asynchronous video task in the verified project. Model and upstream support
|
|
66
|
+
* determine the accepted duration, resolution and references. Poll the returned task id.
|
|
67
|
+
* `reference_media` is a Canopy extension for ordered, typed image, video and audio URLs.
|
|
68
|
+
* Existing `input_reference` remains a first frame.
|
|
69
|
+
* The runtime also accepts OpenAI multipart uploads; send reference_media as a JSON text field.
|
|
70
|
+
* No remote reference is downloaded or retained by Canopy during request preparation.
|
|
71
|
+
* @summary Create a video
|
|
72
|
+
*/
|
|
73
|
+
export declare const createVideo: (videoCreateRequest: VideoCreateRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createVideoResponse>;
|
|
74
|
+
export type getVideoResponse200 = {
|
|
75
|
+
data: VideoTask;
|
|
76
|
+
status: 200;
|
|
77
|
+
};
|
|
78
|
+
export type getVideoResponseDefault = {
|
|
79
|
+
data: InferenceError;
|
|
80
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
81
|
+
};
|
|
82
|
+
export type getVideoResponseSuccess = getVideoResponse200 & {
|
|
83
|
+
headers: Headers;
|
|
84
|
+
};
|
|
85
|
+
export type getVideoResponseError = getVideoResponseDefault & {
|
|
86
|
+
headers: Headers;
|
|
87
|
+
};
|
|
88
|
+
export type getVideoResponse = getVideoResponseSuccess | getVideoResponseError;
|
|
89
|
+
export declare const getGetVideoUrl: (video: string) => string;
|
|
90
|
+
/**
|
|
91
|
+
* Read an existing task owned by the verified project; does not create another video.
|
|
92
|
+
* @summary Get a video task
|
|
93
|
+
*/
|
|
94
|
+
export declare const getVideo: (video: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getVideoResponse>;
|
|
95
|
+
export type getVideoContentResponse200 = {
|
|
96
|
+
data: Blob;
|
|
97
|
+
status: 200;
|
|
98
|
+
};
|
|
99
|
+
export type getVideoContentResponse206 = {
|
|
100
|
+
data: Blob;
|
|
101
|
+
status: 206;
|
|
102
|
+
};
|
|
103
|
+
export type getVideoContentResponseDefault = {
|
|
104
|
+
data: InferenceError;
|
|
105
|
+
status: Exclude<HTTPStatusCodes, 200 | 206>;
|
|
106
|
+
};
|
|
107
|
+
export type getVideoContentResponseSuccess = (getVideoContentResponse200 | getVideoContentResponse206) & {
|
|
108
|
+
headers: Headers;
|
|
109
|
+
};
|
|
110
|
+
export type getVideoContentResponseError = getVideoContentResponseDefault & {
|
|
111
|
+
headers: Headers;
|
|
112
|
+
};
|
|
113
|
+
export type getVideoContentResponse = getVideoContentResponseSuccess | getVideoContentResponseError;
|
|
114
|
+
export declare const getGetVideoContentUrl: (video: string) => string;
|
|
115
|
+
/**
|
|
116
|
+
* Stream a completed video owned by the verified project. Supports HTTP Range.
|
|
117
|
+
* @summary Get generated video content
|
|
118
|
+
*/
|
|
119
|
+
export declare const getVideoContent: (video: string, headers?: GetVideoContentHeaders, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getVideoContentResponse>;
|
|
48
120
|
export type createResponseResponse200ApplicationJson = {
|
|
49
121
|
data: ResponseResource;
|
|
50
122
|
status: 200;
|
|
@@ -1,3 +1,93 @@
|
|
|
1
|
+
export const getCreateVideoUrl = () => {
|
|
2
|
+
return `https://canopy.leaflow.cloud/v1/videos`;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Create an asynchronous video task in the verified project. Model and upstream support
|
|
6
|
+
* determine the accepted duration, resolution and references. Poll the returned task id.
|
|
7
|
+
* `reference_media` is a Canopy extension for ordered, typed image, video and audio URLs.
|
|
8
|
+
* Existing `input_reference` remains a first frame.
|
|
9
|
+
* The runtime also accepts OpenAI multipart uploads; send reference_media as a JSON text field.
|
|
10
|
+
* No remote reference is downloaded or retained by Canopy during request preparation.
|
|
11
|
+
* @summary Create a video
|
|
12
|
+
*/
|
|
13
|
+
export const createVideo = async (videoCreateRequest, options, fetchFn) => {
|
|
14
|
+
const getHeaders = (h) => {
|
|
15
|
+
if (!h)
|
|
16
|
+
return {};
|
|
17
|
+
if (h instanceof Headers)
|
|
18
|
+
return Object.fromEntries(h.entries());
|
|
19
|
+
if (Symbol.iterator in h) {
|
|
20
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
21
|
+
}
|
|
22
|
+
const headers = {};
|
|
23
|
+
for (const [name, value] of Object.entries(h)) {
|
|
24
|
+
if (value !== undefined)
|
|
25
|
+
headers[name] = value;
|
|
26
|
+
}
|
|
27
|
+
return headers;
|
|
28
|
+
};
|
|
29
|
+
const res = await (fetchFn ?? fetch)(getCreateVideoUrl(), {
|
|
30
|
+
...options,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
33
|
+
body: JSON.stringify(videoCreateRequest),
|
|
34
|
+
});
|
|
35
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
36
|
+
const data = body ? JSON.parse(body) : {};
|
|
37
|
+
return { data, status: res.status, headers: res.headers };
|
|
38
|
+
};
|
|
39
|
+
export const getGetVideoUrl = (video) => {
|
|
40
|
+
return `https://canopy.leaflow.cloud/v1/videos/${encodeURIComponent(String(video))}`;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Read an existing task owned by the verified project; does not create another video.
|
|
44
|
+
* @summary Get a video task
|
|
45
|
+
*/
|
|
46
|
+
export const getVideo = async (video, options, fetchFn) => {
|
|
47
|
+
const res = await (fetchFn ?? fetch)(getGetVideoUrl(video), {
|
|
48
|
+
...options,
|
|
49
|
+
method: "GET",
|
|
50
|
+
});
|
|
51
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
52
|
+
const data = body ? JSON.parse(body) : {};
|
|
53
|
+
return { data, status: res.status, headers: res.headers };
|
|
54
|
+
};
|
|
55
|
+
export const getGetVideoContentUrl = (video) => {
|
|
56
|
+
return `https://canopy.leaflow.cloud/v1/videos/${encodeURIComponent(String(video))}/content`;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Stream a completed video owned by the verified project. Supports HTTP Range.
|
|
60
|
+
* @summary Get generated video content
|
|
61
|
+
*/
|
|
62
|
+
export const getVideoContent = async (video, headers, options, fetchFn) => {
|
|
63
|
+
const getHeaders = (h) => {
|
|
64
|
+
if (!h)
|
|
65
|
+
return {};
|
|
66
|
+
if (h instanceof Headers)
|
|
67
|
+
return Object.fromEntries(h.entries());
|
|
68
|
+
if (Symbol.iterator in h) {
|
|
69
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
70
|
+
}
|
|
71
|
+
const headers = {};
|
|
72
|
+
for (const [name, value] of Object.entries(h)) {
|
|
73
|
+
if (value !== undefined)
|
|
74
|
+
headers[name] = value;
|
|
75
|
+
}
|
|
76
|
+
return headers;
|
|
77
|
+
};
|
|
78
|
+
const res = await (fetchFn ?? fetch)(getGetVideoContentUrl(video), {
|
|
79
|
+
...options,
|
|
80
|
+
method: "GET",
|
|
81
|
+
headers: { ...headers, ...getHeaders(options?.headers) },
|
|
82
|
+
});
|
|
83
|
+
const body = [204, 205, 304].includes(res.status)
|
|
84
|
+
? null
|
|
85
|
+
: res.headers.get("content-type")?.includes("application/json")
|
|
86
|
+
? JSON.parse(await res.text())
|
|
87
|
+
: await res.blob();
|
|
88
|
+
const data = body;
|
|
89
|
+
return { data, status: res.status, headers: res.headers };
|
|
90
|
+
};
|
|
1
91
|
export const getCreateResponseUrl = () => {
|
|
2
92
|
return `https://canopy.leaflow.cloud/v1/responses`;
|
|
3
93
|
};
|
|
@@ -27,11 +117,7 @@ export const createResponse = async (responseCreate, options, fetchFn) => {
|
|
|
27
117
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
28
118
|
body: JSON.stringify(responseCreate),
|
|
29
119
|
});
|
|
30
|
-
const body = [204, 205, 304].includes(res.status)
|
|
31
|
-
? null
|
|
32
|
-
: res.headers.get("content-type")?.includes("application/json")
|
|
33
|
-
? JSON.parse(await res.text())
|
|
34
|
-
: await res.blob();
|
|
120
|
+
const body = [204, 205, 304].includes(res.status) ? null : res.headers.get("content-type")?.includes("application/json") ? JSON.parse(await res.text()) : await res.blob();
|
|
35
121
|
const data = body;
|
|
36
122
|
return { data, status: res.status, headers: res.headers };
|
|
37
123
|
};
|
|
@@ -94,7 +180,7 @@ export const createChatCompletion = async (chatCompletionRequest, options, fetch
|
|
|
94
180
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
95
181
|
body: JSON.stringify(chatCompletionRequest),
|
|
96
182
|
});
|
|
97
|
-
const body = [204, 205, 304].includes(res.status) ? null :
|
|
183
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.blob();
|
|
98
184
|
const data = body;
|
|
99
185
|
return { data, status: res.status, headers: res.headers };
|
|
100
186
|
};
|