recurly-mcp 0.1.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/CHANGELOG.md +61 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +19 -0
- package/dist/bin.js.map +1 -0
- package/dist/client/errors.d.ts +16 -0
- package/dist/client/errors.js +44 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/pagination.d.ts +8 -0
- package/dist/client/pagination.js +33 -0
- package/dist/client/pagination.js.map +1 -0
- package/dist/client/recurly.d.ts +19 -0
- package/dist/client/recurly.js +277 -0
- package/dist/client/recurly.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +99 -0
- package/dist/config.js.map +1 -0
- package/dist/responseGuard.d.ts +1 -0
- package/dist/responseGuard.js +124 -0
- package/dist/responseGuard.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +119 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/accounts.d.ts +217 -0
- package/dist/tools/accounts.js +71 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/addOns.d.ts +46 -0
- package/dist/tools/addOns.js +24 -0
- package/dist/tools/addOns.js.map +1 -0
- package/dist/tools/billingInfo.d.ts +57 -0
- package/dist/tools/billingInfo.js +31 -0
- package/dist/tools/billingInfo.js.map +1 -0
- package/dist/tools/businessEntities.d.ts +80 -0
- package/dist/tools/businessEntities.js +32 -0
- package/dist/tools/businessEntities.js.map +1 -0
- package/dist/tools/couponRedemptions.d.ts +135 -0
- package/dist/tools/couponRedemptions.js +57 -0
- package/dist/tools/couponRedemptions.js.map +1 -0
- package/dist/tools/coupons.d.ts +86 -0
- package/dist/tools/coupons.js +37 -0
- package/dist/tools/coupons.js.map +1 -0
- package/dist/tools/creditPayments.d.ts +73 -0
- package/dist/tools/creditPayments.js +28 -0
- package/dist/tools/creditPayments.js.map +1 -0
- package/dist/tools/customFieldDefinitions.d.ts +46 -0
- package/dist/tools/customFieldDefinitions.js +32 -0
- package/dist/tools/customFieldDefinitions.js.map +1 -0
- package/dist/tools/dunningCampaigns.d.ts +42 -0
- package/dist/tools/dunningCampaigns.js +21 -0
- package/dist/tools/dunningCampaigns.js.map +1 -0
- package/dist/tools/exports.d.ts +20 -0
- package/dist/tools/exports.js +21 -0
- package/dist/tools/exports.js.map +1 -0
- package/dist/tools/externalAccounts.d.ts +48 -0
- package/dist/tools/externalAccounts.js +28 -0
- package/dist/tools/externalAccounts.js.map +1 -0
- package/dist/tools/externalInvoices.d.ts +73 -0
- package/dist/tools/externalInvoices.js +28 -0
- package/dist/tools/externalInvoices.js.map +1 -0
- package/dist/tools/externalProducts.d.ts +85 -0
- package/dist/tools/externalProducts.js +34 -0
- package/dist/tools/externalProducts.js.map +1 -0
- package/dist/tools/externalSubscriptions.d.ts +147 -0
- package/dist/tools/externalSubscriptions.js +47 -0
- package/dist/tools/externalSubscriptions.js.map +1 -0
- package/dist/tools/generalLedgerAccounts.d.ts +46 -0
- package/dist/tools/generalLedgerAccounts.js +32 -0
- package/dist/tools/generalLedgerAccounts.js.map +1 -0
- package/dist/tools/giftCards.d.ts +42 -0
- package/dist/tools/giftCards.js +21 -0
- package/dist/tools/giftCards.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +68 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/invoiceTemplates.d.ts +83 -0
- package/dist/tools/invoiceTemplates.js +39 -0
- package/dist/tools/invoiceTemplates.js.map +1 -0
- package/dist/tools/invoices.d.ts +168 -0
- package/dist/tools/invoices.js +58 -0
- package/dist/tools/invoices.js.map +1 -0
- package/dist/tools/items.d.ts +46 -0
- package/dist/tools/items.js +24 -0
- package/dist/tools/items.js.map +1 -0
- package/dist/tools/lineItems.d.ts +93 -0
- package/dist/tools/lineItems.js +37 -0
- package/dist/tools/lineItems.js.map +1 -0
- package/dist/tools/measuredUnits.d.ts +46 -0
- package/dist/tools/measuredUnits.js +24 -0
- package/dist/tools/measuredUnits.js.map +1 -0
- package/dist/tools/performanceObligations.d.ts +42 -0
- package/dist/tools/performanceObligations.js +24 -0
- package/dist/tools/performanceObligations.js.map +1 -0
- package/dist/tools/plans.d.ts +93 -0
- package/dist/tools/plans.js +34 -0
- package/dist/tools/plans.js.map +1 -0
- package/dist/tools/priceSegments.d.ts +42 -0
- package/dist/tools/priceSegments.js +21 -0
- package/dist/tools/priceSegments.js.map +1 -0
- package/dist/tools/request.d.ts +17 -0
- package/dist/tools/request.js +55 -0
- package/dist/tools/request.js.map +1 -0
- package/dist/tools/shared.d.ts +32 -0
- package/dist/tools/shared.js +73 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/shippingAddresses.d.ts +48 -0
- package/dist/tools/shippingAddresses.js +28 -0
- package/dist/tools/shippingAddresses.js.map +1 -0
- package/dist/tools/shippingMethods.d.ts +42 -0
- package/dist/tools/shippingMethods.js +21 -0
- package/dist/tools/shippingMethods.js.map +1 -0
- package/dist/tools/sites.d.ts +46 -0
- package/dist/tools/sites.js +24 -0
- package/dist/tools/sites.js.map +1 -0
- package/dist/tools/subscriptions.d.ts +178 -0
- package/dist/tools/subscriptions.js +68 -0
- package/dist/tools/subscriptions.js.map +1 -0
- package/dist/tools/transactions.d.ts +87 -0
- package/dist/tools/transactions.js +36 -0
- package/dist/tools/transactions.js.map +1 -0
- package/dist/tools/types.d.ts +13 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/usage.d.ts +52 -0
- package/dist/tools/usage.js +33 -0
- package/dist/tools/usage.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
action: "list";
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
order?: "asc" | "desc" | undefined;
|
|
18
|
+
sort?: string | undefined;
|
|
19
|
+
ids?: string[] | undefined;
|
|
20
|
+
begin_time?: string | undefined;
|
|
21
|
+
end_time?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
action: "list";
|
|
24
|
+
cursor?: string | undefined;
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
order?: "asc" | "desc" | undefined;
|
|
27
|
+
sort?: string | undefined;
|
|
28
|
+
ids?: string[] | undefined;
|
|
29
|
+
begin_time?: string | undefined;
|
|
30
|
+
end_time?: string | undefined;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"get">;
|
|
33
|
+
business_entity_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
action: "get";
|
|
36
|
+
business_entity_id: string;
|
|
37
|
+
}, {
|
|
38
|
+
action: "get";
|
|
39
|
+
business_entity_id: string;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
action: z.ZodLiteral<"list_invoices">;
|
|
42
|
+
business_entity_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
43
|
+
} & {
|
|
44
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
46
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
47
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
48
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
49
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
50
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
51
|
+
} & {
|
|
52
|
+
state: z.ZodOptional<z.ZodString>;
|
|
53
|
+
type: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
action: "list_invoices";
|
|
56
|
+
business_entity_id: string;
|
|
57
|
+
cursor?: string | undefined;
|
|
58
|
+
limit?: number | undefined;
|
|
59
|
+
order?: "asc" | "desc" | undefined;
|
|
60
|
+
sort?: string | undefined;
|
|
61
|
+
type?: string | undefined;
|
|
62
|
+
ids?: string[] | undefined;
|
|
63
|
+
begin_time?: string | undefined;
|
|
64
|
+
end_time?: string | undefined;
|
|
65
|
+
state?: string | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
action: "list_invoices";
|
|
68
|
+
business_entity_id: string;
|
|
69
|
+
cursor?: string | undefined;
|
|
70
|
+
limit?: number | undefined;
|
|
71
|
+
order?: "asc" | "desc" | undefined;
|
|
72
|
+
sort?: string | undefined;
|
|
73
|
+
type?: string | undefined;
|
|
74
|
+
ids?: string[] | undefined;
|
|
75
|
+
begin_time?: string | undefined;
|
|
76
|
+
end_time?: string | undefined;
|
|
77
|
+
state?: string | undefined;
|
|
78
|
+
}>]>;
|
|
79
|
+
export declare const businessEntitiesTool: ToolDefinition<typeof inputSchema>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const businessEntityId = idParam('business_entity_id');
|
|
4
|
+
const invoiceFilters = {
|
|
5
|
+
state: z.string().optional().describe('Filter by invoice state, e.g. open, paid, past_due.'),
|
|
6
|
+
type: z.string().optional().describe('Filter by invoice type, e.g. charge, credit.'),
|
|
7
|
+
};
|
|
8
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
9
|
+
z.object({ action: z.literal('list') }).merge(listParamsSchema),
|
|
10
|
+
z.object({ action: z.literal('get'), business_entity_id: businessEntityId }),
|
|
11
|
+
z
|
|
12
|
+
.object({ action: z.literal('list_invoices'), business_entity_id: businessEntityId })
|
|
13
|
+
.merge(listParamsSchema)
|
|
14
|
+
.extend(invoiceFilters),
|
|
15
|
+
]);
|
|
16
|
+
export const businessEntitiesTool = {
|
|
17
|
+
name: 'recurly_business_entities',
|
|
18
|
+
description: 'Recurly business entities (read-only). Actions: list, get, list_invoices (invoices for a business entity). business_entity_id accepts a Recurly ID or `code-<your_code>`. Returns raw Recurly JSON; list actions add a _pagination cursor hint.',
|
|
19
|
+
inputSchema,
|
|
20
|
+
handler: async (ctx, input) => {
|
|
21
|
+
const parsed = inputSchema.parse(input);
|
|
22
|
+
switch (parsed.action) {
|
|
23
|
+
case 'list':
|
|
24
|
+
return fetchList(ctx, '/business_entities', parsed);
|
|
25
|
+
case 'get':
|
|
26
|
+
return ctx.client.request('GET', `/business_entities/${enc(parsed.business_entity_id)}`);
|
|
27
|
+
case 'list_invoices':
|
|
28
|
+
return fetchList(ctx, `/business_entities/${enc(parsed.business_entity_id)}/invoices`, parsed, ['business_entity_id']);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=businessEntities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"businessEntities.js","sourceRoot":"","sources":["../../src/tools/businessEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEvD,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IAC5F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CACrF,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC;IAC5E,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC;SACpF,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC,cAAc,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAuC;IACtE,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,iPAAiP;IACnP,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;YACtD,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;YAC3F,KAAK,eAAe;gBAClB,OAAO,SAAS,CACd,GAAG,EACH,sBAAsB,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,WAAW,EAC/D,MAAM,EACN,CAAC,oBAAoB,CAAC,CACvB,CAAC;QACN,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list_for_account">;
|
|
5
|
+
account_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
6
|
+
} & {
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
9
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
10
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
11
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
12
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
14
|
+
} & {
|
|
15
|
+
state: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
action: "list_for_account";
|
|
18
|
+
account_id: string;
|
|
19
|
+
cursor?: string | undefined;
|
|
20
|
+
limit?: number | undefined;
|
|
21
|
+
order?: "asc" | "desc" | undefined;
|
|
22
|
+
sort?: string | undefined;
|
|
23
|
+
ids?: string[] | undefined;
|
|
24
|
+
begin_time?: string | undefined;
|
|
25
|
+
end_time?: string | undefined;
|
|
26
|
+
state?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
action: "list_for_account";
|
|
29
|
+
account_id: string;
|
|
30
|
+
cursor?: string | undefined;
|
|
31
|
+
limit?: number | undefined;
|
|
32
|
+
order?: "asc" | "desc" | undefined;
|
|
33
|
+
sort?: string | undefined;
|
|
34
|
+
ids?: string[] | undefined;
|
|
35
|
+
begin_time?: string | undefined;
|
|
36
|
+
end_time?: string | undefined;
|
|
37
|
+
state?: string | undefined;
|
|
38
|
+
}>, z.ZodObject<{
|
|
39
|
+
action: z.ZodLiteral<"list_active_for_account">;
|
|
40
|
+
account_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
action: "list_active_for_account";
|
|
43
|
+
account_id: string;
|
|
44
|
+
}, {
|
|
45
|
+
action: "list_active_for_account";
|
|
46
|
+
account_id: string;
|
|
47
|
+
}>, z.ZodObject<{
|
|
48
|
+
action: z.ZodLiteral<"get_for_account">;
|
|
49
|
+
account_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
50
|
+
coupon_redemption_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
action: "get_for_account";
|
|
53
|
+
account_id: string;
|
|
54
|
+
coupon_redemption_id: string;
|
|
55
|
+
}, {
|
|
56
|
+
action: "get_for_account";
|
|
57
|
+
account_id: string;
|
|
58
|
+
coupon_redemption_id: string;
|
|
59
|
+
}>, z.ZodObject<{
|
|
60
|
+
action: z.ZodLiteral<"list_for_invoice">;
|
|
61
|
+
invoice_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
62
|
+
} & {
|
|
63
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
65
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
66
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
67
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
68
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
69
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
action: "list_for_invoice";
|
|
72
|
+
invoice_id: string;
|
|
73
|
+
cursor?: string | undefined;
|
|
74
|
+
limit?: number | undefined;
|
|
75
|
+
order?: "asc" | "desc" | undefined;
|
|
76
|
+
sort?: string | undefined;
|
|
77
|
+
ids?: string[] | undefined;
|
|
78
|
+
begin_time?: string | undefined;
|
|
79
|
+
end_time?: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
action: "list_for_invoice";
|
|
82
|
+
invoice_id: string;
|
|
83
|
+
cursor?: string | undefined;
|
|
84
|
+
limit?: number | undefined;
|
|
85
|
+
order?: "asc" | "desc" | undefined;
|
|
86
|
+
sort?: string | undefined;
|
|
87
|
+
ids?: string[] | undefined;
|
|
88
|
+
begin_time?: string | undefined;
|
|
89
|
+
end_time?: string | undefined;
|
|
90
|
+
}>, z.ZodObject<{
|
|
91
|
+
action: z.ZodLiteral<"list_for_subscription">;
|
|
92
|
+
subscription_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
93
|
+
} & {
|
|
94
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
96
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
97
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
98
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
99
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
100
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
action: "list_for_subscription";
|
|
103
|
+
subscription_id: string;
|
|
104
|
+
cursor?: string | undefined;
|
|
105
|
+
limit?: number | undefined;
|
|
106
|
+
order?: "asc" | "desc" | undefined;
|
|
107
|
+
sort?: string | undefined;
|
|
108
|
+
ids?: string[] | undefined;
|
|
109
|
+
begin_time?: string | undefined;
|
|
110
|
+
end_time?: string | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
action: "list_for_subscription";
|
|
113
|
+
subscription_id: string;
|
|
114
|
+
cursor?: string | undefined;
|
|
115
|
+
limit?: number | undefined;
|
|
116
|
+
order?: "asc" | "desc" | undefined;
|
|
117
|
+
sort?: string | undefined;
|
|
118
|
+
ids?: string[] | undefined;
|
|
119
|
+
begin_time?: string | undefined;
|
|
120
|
+
end_time?: string | undefined;
|
|
121
|
+
}>, z.ZodObject<{
|
|
122
|
+
action: z.ZodLiteral<"get_for_subscription">;
|
|
123
|
+
subscription_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
124
|
+
coupon_redemption_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
action: "get_for_subscription";
|
|
127
|
+
coupon_redemption_id: string;
|
|
128
|
+
subscription_id: string;
|
|
129
|
+
}, {
|
|
130
|
+
action: "get_for_subscription";
|
|
131
|
+
coupon_redemption_id: string;
|
|
132
|
+
subscription_id: string;
|
|
133
|
+
}>]>;
|
|
134
|
+
export declare const couponRedemptionsTool: ToolDefinition<typeof inputSchema>;
|
|
135
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const accountId = idParam('account_id');
|
|
4
|
+
const couponRedemptionId = idParam('coupon_redemption_id');
|
|
5
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
6
|
+
z
|
|
7
|
+
.object({ action: z.literal('list_for_account'), account_id: accountId })
|
|
8
|
+
.merge(listParamsSchema)
|
|
9
|
+
.extend({ state: z.string().optional().describe('Filter by state, e.g. active or inactive.') }),
|
|
10
|
+
z.object({ action: z.literal('list_active_for_account'), account_id: accountId }),
|
|
11
|
+
z.object({
|
|
12
|
+
action: z.literal('get_for_account'),
|
|
13
|
+
account_id: accountId,
|
|
14
|
+
coupon_redemption_id: couponRedemptionId,
|
|
15
|
+
}),
|
|
16
|
+
z
|
|
17
|
+
.object({ action: z.literal('list_for_invoice'), invoice_id: idParam('invoice_id') })
|
|
18
|
+
.merge(listParamsSchema),
|
|
19
|
+
z
|
|
20
|
+
.object({
|
|
21
|
+
action: z.literal('list_for_subscription'),
|
|
22
|
+
subscription_id: idParam('subscription_id'),
|
|
23
|
+
})
|
|
24
|
+
.merge(listParamsSchema),
|
|
25
|
+
z.object({
|
|
26
|
+
action: z.literal('get_for_subscription'),
|
|
27
|
+
subscription_id: idParam('subscription_id'),
|
|
28
|
+
coupon_redemption_id: couponRedemptionId,
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
export const couponRedemptionsTool = {
|
|
32
|
+
name: 'recurly_coupon_redemptions',
|
|
33
|
+
description: 'Recurly coupon redemptions (read-only), viewed from their parent resource. Actions: list_for_account, list_active_for_account (the currently-active redemption(s) on an account), get_for_account, list_for_invoice, list_for_subscription, get_for_subscription. Returns raw Recurly JSON; list actions add a _pagination cursor hint.',
|
|
34
|
+
inputSchema,
|
|
35
|
+
handler: async (ctx, input) => {
|
|
36
|
+
const parsed = inputSchema.parse(input);
|
|
37
|
+
switch (parsed.action) {
|
|
38
|
+
case 'list_for_account':
|
|
39
|
+
return fetchList(ctx, `/accounts/${enc(parsed.account_id)}/coupon_redemptions`, parsed, [
|
|
40
|
+
'account_id',
|
|
41
|
+
]);
|
|
42
|
+
case 'list_active_for_account':
|
|
43
|
+
return ctx.client.request('GET', `/accounts/${enc(parsed.account_id)}/coupon_redemptions/active`);
|
|
44
|
+
case 'get_for_account':
|
|
45
|
+
return ctx.client.request('GET', `/accounts/${enc(parsed.account_id)}/coupon_redemptions/${enc(parsed.coupon_redemption_id)}`);
|
|
46
|
+
case 'list_for_invoice':
|
|
47
|
+
return fetchList(ctx, `/invoices/${enc(parsed.invoice_id)}/coupon_redemptions`, parsed, [
|
|
48
|
+
'invoice_id',
|
|
49
|
+
]);
|
|
50
|
+
case 'list_for_subscription':
|
|
51
|
+
return fetchList(ctx, `/subscriptions/${enc(parsed.subscription_id)}/coupon_redemptions`, parsed, ['subscription_id']);
|
|
52
|
+
case 'get_for_subscription':
|
|
53
|
+
return ctx.client.request('GET', `/subscriptions/${enc(parsed.subscription_id)}/coupon_redemptions/${enc(parsed.coupon_redemption_id)}`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=couponRedemptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"couponRedemptions.js","sourceRoot":"","sources":["../../src/tools/couponRedemptions.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
action: "list";
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
order?: "asc" | "desc" | undefined;
|
|
18
|
+
sort?: string | undefined;
|
|
19
|
+
ids?: string[] | undefined;
|
|
20
|
+
begin_time?: string | undefined;
|
|
21
|
+
end_time?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
action: "list";
|
|
24
|
+
cursor?: string | undefined;
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
order?: "asc" | "desc" | undefined;
|
|
27
|
+
sort?: string | undefined;
|
|
28
|
+
ids?: string[] | undefined;
|
|
29
|
+
begin_time?: string | undefined;
|
|
30
|
+
end_time?: string | undefined;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"get">;
|
|
33
|
+
coupon_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
action: "get";
|
|
36
|
+
coupon_id: string;
|
|
37
|
+
}, {
|
|
38
|
+
action: "get";
|
|
39
|
+
coupon_id: string;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
action: z.ZodLiteral<"list_unique_coupon_codes">;
|
|
42
|
+
coupon_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
43
|
+
} & {
|
|
44
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
46
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
47
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
48
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
49
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
50
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
51
|
+
} & {
|
|
52
|
+
redeemed: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
action: "list_unique_coupon_codes";
|
|
55
|
+
coupon_id: string;
|
|
56
|
+
cursor?: string | undefined;
|
|
57
|
+
limit?: number | undefined;
|
|
58
|
+
order?: "asc" | "desc" | undefined;
|
|
59
|
+
sort?: string | undefined;
|
|
60
|
+
ids?: string[] | undefined;
|
|
61
|
+
begin_time?: string | undefined;
|
|
62
|
+
end_time?: string | undefined;
|
|
63
|
+
redeemed?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
action: "list_unique_coupon_codes";
|
|
66
|
+
coupon_id: string;
|
|
67
|
+
cursor?: string | undefined;
|
|
68
|
+
limit?: number | undefined;
|
|
69
|
+
order?: "asc" | "desc" | undefined;
|
|
70
|
+
sort?: string | undefined;
|
|
71
|
+
ids?: string[] | undefined;
|
|
72
|
+
begin_time?: string | undefined;
|
|
73
|
+
end_time?: string | undefined;
|
|
74
|
+
redeemed?: string | undefined;
|
|
75
|
+
}>, z.ZodObject<{
|
|
76
|
+
action: z.ZodLiteral<"get_unique_coupon_code">;
|
|
77
|
+
unique_coupon_code_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
action: "get_unique_coupon_code";
|
|
80
|
+
unique_coupon_code_id: string;
|
|
81
|
+
}, {
|
|
82
|
+
action: "get_unique_coupon_code";
|
|
83
|
+
unique_coupon_code_id: string;
|
|
84
|
+
}>]>;
|
|
85
|
+
export declare const couponsTool: ToolDefinition<typeof inputSchema>;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
4
|
+
z.object({ action: z.literal('list') }).merge(listParamsSchema),
|
|
5
|
+
z.object({ action: z.literal('get'), coupon_id: idParam('coupon_id') }),
|
|
6
|
+
z
|
|
7
|
+
.object({ action: z.literal('list_unique_coupon_codes'), coupon_id: idParam('coupon_id') })
|
|
8
|
+
.merge(listParamsSchema)
|
|
9
|
+
.extend({
|
|
10
|
+
redeemed: z.string().optional().describe('Filter by redemption status ("true"/"false").'),
|
|
11
|
+
}),
|
|
12
|
+
z.object({
|
|
13
|
+
action: z.literal('get_unique_coupon_code'),
|
|
14
|
+
unique_coupon_code_id: idParam('unique_coupon_code_id'),
|
|
15
|
+
}),
|
|
16
|
+
]);
|
|
17
|
+
export const couponsTool = {
|
|
18
|
+
name: 'recurly_coupons',
|
|
19
|
+
description: 'Recurly coupons (read-only). Actions: list, get, list_unique_coupon_codes (the generated codes for a bulk coupon), get_unique_coupon_code (a single unique code by ID). coupon_id accepts a Recurly ID or `code-<your_code>`. Returns raw Recurly JSON; list actions add a _pagination cursor hint.',
|
|
20
|
+
inputSchema,
|
|
21
|
+
handler: async (ctx, input) => {
|
|
22
|
+
const parsed = inputSchema.parse(input);
|
|
23
|
+
switch (parsed.action) {
|
|
24
|
+
case 'list':
|
|
25
|
+
return fetchList(ctx, '/coupons', parsed);
|
|
26
|
+
case 'get':
|
|
27
|
+
return ctx.client.request('GET', `/coupons/${enc(parsed.coupon_id)}`);
|
|
28
|
+
case 'list_unique_coupon_codes':
|
|
29
|
+
return fetchList(ctx, `/coupons/${enc(parsed.coupon_id)}/unique_coupon_codes`, parsed, [
|
|
30
|
+
'coupon_id',
|
|
31
|
+
]);
|
|
32
|
+
case 'get_unique_coupon_code':
|
|
33
|
+
return ctx.client.request('GET', `/unique_coupon_codes/${enc(parsed.unique_coupon_code_id)}`);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=coupons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coupons.js","sourceRoot":"","sources":["../../src/tools/coupons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;IACvE,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;SAC1F,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC;QACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;KAC1F,CAAC;IACJ,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC;QAC3C,qBAAqB,EAAE,OAAO,CAAC,uBAAuB,CAAC;KACxD,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAuC;IAC7D,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,qSAAqS;IACvS,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;YAC5C,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YACxE,KAAK,0BAA0B;gBAC7B,OAAO,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,sBAAsB,EAAE,MAAM,EAAE;oBACrF,WAAW;iBACZ,CAAC,CAAC;YACL,KAAK,wBAAwB;gBAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CACvB,KAAK,EACL,wBAAwB,GAAG,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,CAC5D,CAAC;QACN,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
action: "list";
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
order?: "asc" | "desc" | undefined;
|
|
18
|
+
sort?: string | undefined;
|
|
19
|
+
ids?: string[] | undefined;
|
|
20
|
+
begin_time?: string | undefined;
|
|
21
|
+
end_time?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
action: "list";
|
|
24
|
+
cursor?: string | undefined;
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
order?: "asc" | "desc" | undefined;
|
|
27
|
+
sort?: string | undefined;
|
|
28
|
+
ids?: string[] | undefined;
|
|
29
|
+
begin_time?: string | undefined;
|
|
30
|
+
end_time?: string | undefined;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"get">;
|
|
33
|
+
credit_payment_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
action: "get";
|
|
36
|
+
credit_payment_id: string;
|
|
37
|
+
}, {
|
|
38
|
+
action: "get";
|
|
39
|
+
credit_payment_id: string;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
action: z.ZodLiteral<"list_for_account">;
|
|
42
|
+
account_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
43
|
+
} & {
|
|
44
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
46
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
47
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
48
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
49
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
50
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
action: "list_for_account";
|
|
53
|
+
account_id: string;
|
|
54
|
+
cursor?: string | undefined;
|
|
55
|
+
limit?: number | undefined;
|
|
56
|
+
order?: "asc" | "desc" | undefined;
|
|
57
|
+
sort?: string | undefined;
|
|
58
|
+
ids?: string[] | undefined;
|
|
59
|
+
begin_time?: string | undefined;
|
|
60
|
+
end_time?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
action: "list_for_account";
|
|
63
|
+
account_id: string;
|
|
64
|
+
cursor?: string | undefined;
|
|
65
|
+
limit?: number | undefined;
|
|
66
|
+
order?: "asc" | "desc" | undefined;
|
|
67
|
+
sort?: string | undefined;
|
|
68
|
+
ids?: string[] | undefined;
|
|
69
|
+
begin_time?: string | undefined;
|
|
70
|
+
end_time?: string | undefined;
|
|
71
|
+
}>]>;
|
|
72
|
+
export declare const creditPaymentsTool: ToolDefinition<typeof inputSchema>;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
4
|
+
z.object({ action: z.literal('list') }).merge(listParamsSchema),
|
|
5
|
+
z.object({ action: z.literal('get'), credit_payment_id: idParam('credit_payment_id') }),
|
|
6
|
+
z
|
|
7
|
+
.object({ action: z.literal('list_for_account'), account_id: idParam('account_id') })
|
|
8
|
+
.merge(listParamsSchema),
|
|
9
|
+
]);
|
|
10
|
+
export const creditPaymentsTool = {
|
|
11
|
+
name: 'recurly_credit_payments',
|
|
12
|
+
description: 'Recurly credit payments (read-only). Actions: list (site-wide), get (one by ID), list_for_account. Returns raw Recurly JSON; list actions add a _pagination cursor hint.',
|
|
13
|
+
inputSchema,
|
|
14
|
+
handler: async (ctx, input) => {
|
|
15
|
+
const parsed = inputSchema.parse(input);
|
|
16
|
+
switch (parsed.action) {
|
|
17
|
+
case 'list':
|
|
18
|
+
return fetchList(ctx, '/credit_payments', parsed);
|
|
19
|
+
case 'get':
|
|
20
|
+
return ctx.client.request('GET', `/credit_payments/${enc(parsed.credit_payment_id)}`);
|
|
21
|
+
case 'list_for_account':
|
|
22
|
+
return fetchList(ctx, `/accounts/${enc(parsed.account_id)}/credit_payments`, parsed, [
|
|
23
|
+
'account_id',
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=creditPayments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditPayments.js","sourceRoot":"","sources":["../../src/tools/creditPayments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACvF,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;SACpF,KAAK,CAAC,gBAAgB,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,0KAA0K;IAC5K,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;YACpD,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,oBAAoB,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YACxF,KAAK,kBAAkB;gBACrB,OAAO,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAkB,EAAE,MAAM,EAAE;oBACnF,YAAY;iBACb,CAAC,CAAC;QACP,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
} & {
|
|
14
|
+
related_type: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
action: "list";
|
|
17
|
+
cursor?: string | undefined;
|
|
18
|
+
limit?: number | undefined;
|
|
19
|
+
order?: "asc" | "desc" | undefined;
|
|
20
|
+
sort?: string | undefined;
|
|
21
|
+
ids?: string[] | undefined;
|
|
22
|
+
begin_time?: string | undefined;
|
|
23
|
+
end_time?: string | undefined;
|
|
24
|
+
related_type?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
action: "list";
|
|
27
|
+
cursor?: string | undefined;
|
|
28
|
+
limit?: number | undefined;
|
|
29
|
+
order?: "asc" | "desc" | undefined;
|
|
30
|
+
sort?: string | undefined;
|
|
31
|
+
ids?: string[] | undefined;
|
|
32
|
+
begin_time?: string | undefined;
|
|
33
|
+
end_time?: string | undefined;
|
|
34
|
+
related_type?: string | undefined;
|
|
35
|
+
}>, z.ZodObject<{
|
|
36
|
+
action: z.ZodLiteral<"get">;
|
|
37
|
+
custom_field_definition_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
action: "get";
|
|
40
|
+
custom_field_definition_id: string;
|
|
41
|
+
}, {
|
|
42
|
+
action: "get";
|
|
43
|
+
custom_field_definition_id: string;
|
|
44
|
+
}>]>;
|
|
45
|
+
export declare const customFieldDefinitionsTool: ToolDefinition<typeof inputSchema>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
4
|
+
z
|
|
5
|
+
.object({ action: z.literal('list') })
|
|
6
|
+
.merge(listParamsSchema)
|
|
7
|
+
.extend({
|
|
8
|
+
related_type: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('Filter by related type, e.g. account or item.'),
|
|
12
|
+
}),
|
|
13
|
+
z.object({
|
|
14
|
+
action: z.literal('get'),
|
|
15
|
+
custom_field_definition_id: idParam('custom_field_definition_id'),
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
export const customFieldDefinitionsTool = {
|
|
19
|
+
name: 'recurly_custom_field_definitions',
|
|
20
|
+
description: 'Recurly custom field definitions (read-only). Actions: list, get. Returns raw Recurly JSON; list adds a _pagination cursor hint.',
|
|
21
|
+
inputSchema,
|
|
22
|
+
handler: async (ctx, input) => {
|
|
23
|
+
const parsed = inputSchema.parse(input);
|
|
24
|
+
switch (parsed.action) {
|
|
25
|
+
case 'list':
|
|
26
|
+
return fetchList(ctx, '/custom_field_definitions', parsed);
|
|
27
|
+
case 'get':
|
|
28
|
+
return ctx.client.request('GET', `/custom_field_definitions/${enc(parsed.custom_field_definition_id)}`);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=customFieldDefinitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customFieldDefinitions.js","sourceRoot":"","sources":["../../src/tools/customFieldDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;SACrC,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC;QACN,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,+CAA+C,CAAC;KAC7D,CAAC;IACJ,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACxB,0BAA0B,EAAE,OAAO,CAAC,4BAA4B,CAAC;KAClE,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAuC;IAC5E,IAAI,EAAE,kCAAkC;IACxC,WAAW,EACT,kIAAkI;IACpI,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,2BAA2B,EAAE,MAAM,CAAC,CAAC;YAC7D,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CACvB,KAAK,EACL,6BAA6B,GAAG,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,CACtE,CAAC;QACN,CAAC;IACH,CAAC;CACF,CAAC"}
|