From 7229325dc71ff2439472d3f922b7e87420ccb319 Mon Sep 17 00:00:00 2001 From: rafael Date: Tue, 17 Dec 2024 21:42:30 -0300 Subject: [PATCH] Add purchase-related lexicons and codegen --- .../bsky/purchase/createStripeBillingUrl.json | 29 +++++++ .../purchase/createStripeCheckoutUrl.json | 31 +++++++ packages/api/src/client/index.ts | 28 +++++++ packages/api/src/client/lexicons.ts | 82 +++++++++++++++++++ .../bsky/purchase/createStripeBillingUrl.ts | 37 +++++++++ .../bsky/purchase/createStripeCheckoutUrl.ts | 39 +++++++++ packages/bsky/src/lexicon/index.ts | 24 ++++++ packages/bsky/src/lexicon/lexicons.ts | 82 +++++++++++++++++++ .../bsky/purchase/createStripeBillingUrl.ts | 49 +++++++++++ .../bsky/purchase/createStripeCheckoutUrl.ts | 51 ++++++++++++ packages/ozone/src/lexicon/index.ts | 24 ++++++ packages/ozone/src/lexicon/lexicons.ts | 82 +++++++++++++++++++ .../bsky/purchase/createStripeBillingUrl.ts | 49 +++++++++++ .../bsky/purchase/createStripeCheckoutUrl.ts | 51 ++++++++++++ packages/pds/src/lexicon/index.ts | 24 ++++++ packages/pds/src/lexicon/lexicons.ts | 82 +++++++++++++++++++ .../bsky/purchase/createStripeBillingUrl.ts | 49 +++++++++++ .../bsky/purchase/createStripeCheckoutUrl.ts | 51 ++++++++++++ 18 files changed, 864 insertions(+) create mode 100644 lexicons/app/bsky/purchase/createStripeBillingUrl.json create mode 100644 lexicons/app/bsky/purchase/createStripeCheckoutUrl.json create mode 100644 packages/api/src/client/types/app/bsky/purchase/createStripeBillingUrl.ts create mode 100644 packages/api/src/client/types/app/bsky/purchase/createStripeCheckoutUrl.ts create mode 100644 packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts create mode 100644 packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts create mode 100644 packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts create mode 100644 packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts create mode 100644 packages/pds/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts create mode 100644 packages/pds/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts diff --git a/lexicons/app/bsky/purchase/createStripeBillingUrl.json b/lexicons/app/bsky/purchase/createStripeBillingUrl.json new file mode 100644 index 00000000000..143f2d7c603 --- /dev/null +++ b/lexicons/app/bsky/purchase/createStripeBillingUrl.json @@ -0,0 +1,29 @@ +{ + "lexicon": 1, + "id": "app.bsky.purchase.createStripeBillingUrl", + "defs": { + "main": { + "type": "procedure", + "description": "Creates a Stripe Billing Portal session and returns the URL to access it. Requires auth.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["redirectUrl"], + "properties": { + "redirectUrl": { "type": "string", "format": "uri" } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": { + "billingUrl": { "type": "string", "format": "uri" } + } + } + } + } + } +} diff --git a/lexicons/app/bsky/purchase/createStripeCheckoutUrl.json b/lexicons/app/bsky/purchase/createStripeCheckoutUrl.json new file mode 100644 index 00000000000..9010637c5df --- /dev/null +++ b/lexicons/app/bsky/purchase/createStripeCheckoutUrl.json @@ -0,0 +1,31 @@ +{ + "lexicon": 1, + "id": "app.bsky.purchase.createStripeCheckoutUrl", + "defs": { + "main": { + "type": "procedure", + "description": "Creates a Stripe Checkout session and returns the URL to access it. Requires auth.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["email", "priceId", "redirectUrl"], + "properties": { + "email": { "type": "string" }, + "priceId": { "type": "string" }, + "redirectUrl": { "type": "string", "format": "uri" } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": { + "checkoutUrl": { "type": "string", "format": "uri" } + } + } + } + } + } +} diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index 4f5c24478c1..3f662be4b2c 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -161,6 +161,8 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences' import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush' import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' +import * as AppBskyPurchaseCreateStripeBillingUrl from './types/app/bsky/purchase/createStripeBillingUrl' +import * as AppBskyPurchaseCreateStripeCheckoutUrl from './types/app/bsky/purchase/createStripeCheckoutUrl' import * as AppBskyPurchaseGetFeatures from './types/app/bsky/purchase/getFeatures' import * as AppBskyPurchaseGetSubscriptionGroup from './types/app/bsky/purchase/getSubscriptionGroup' import * as AppBskyPurchaseGetSubscriptions from './types/app/bsky/purchase/getSubscriptions' @@ -392,6 +394,8 @@ export * as AppBskyNotificationListNotifications from './types/app/bsky/notifica export * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences' export * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush' export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' +export * as AppBskyPurchaseCreateStripeBillingUrl from './types/app/bsky/purchase/createStripeBillingUrl' +export * as AppBskyPurchaseCreateStripeCheckoutUrl from './types/app/bsky/purchase/createStripeCheckoutUrl' export * as AppBskyPurchaseGetFeatures from './types/app/bsky/purchase/getFeatures' export * as AppBskyPurchaseGetSubscriptionGroup from './types/app/bsky/purchase/getSubscriptionGroup' export * as AppBskyPurchaseGetSubscriptions from './types/app/bsky/purchase/getSubscriptions' @@ -3043,6 +3047,30 @@ export class AppBskyPurchaseNS { this._client = client } + createStripeBillingUrl( + data?: AppBskyPurchaseCreateStripeBillingUrl.InputSchema, + opts?: AppBskyPurchaseCreateStripeBillingUrl.CallOptions, + ): Promise { + return this._client.call( + 'app.bsky.purchase.createStripeBillingUrl', + opts?.qp, + data, + opts, + ) + } + + createStripeCheckoutUrl( + data?: AppBskyPurchaseCreateStripeCheckoutUrl.InputSchema, + opts?: AppBskyPurchaseCreateStripeCheckoutUrl.CallOptions, + ): Promise { + return this._client.call( + 'app.bsky.purchase.createStripeCheckoutUrl', + opts?.qp, + data, + opts, + ) + } + getFeatures( params?: AppBskyPurchaseGetFeatures.QueryParams, opts?: AppBskyPurchaseGetFeatures.CallOptions, diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 022706d112b..b311019e7c9 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -9142,6 +9142,84 @@ export const schemaDict = { }, }, }, + AppBskyPurchaseCreateStripeBillingUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeBillingUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Billing Portal session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['redirectUrl'], + properties: { + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + billingUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, + AppBskyPurchaseCreateStripeCheckoutUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeCheckoutUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Checkout session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['email', 'priceId', 'redirectUrl'], + properties: { + email: { + type: 'string', + }, + priceId: { + type: 'string', + }, + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + checkoutUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, AppBskyPurchaseGetFeatures: { lexicon: 1, id: 'app.bsky.purchase.getFeatures', @@ -13878,6 +13956,10 @@ export const ids = { AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences', AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush', AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', + AppBskyPurchaseCreateStripeBillingUrl: + 'app.bsky.purchase.createStripeBillingUrl', + AppBskyPurchaseCreateStripeCheckoutUrl: + 'app.bsky.purchase.createStripeCheckoutUrl', AppBskyPurchaseGetFeatures: 'app.bsky.purchase.getFeatures', AppBskyPurchaseGetSubscriptionGroup: 'app.bsky.purchase.getSubscriptionGroup', AppBskyPurchaseGetSubscriptions: 'app.bsky.purchase.getSubscriptions', diff --git a/packages/api/src/client/types/app/bsky/purchase/createStripeBillingUrl.ts b/packages/api/src/client/types/app/bsky/purchase/createStripeBillingUrl.ts new file mode 100644 index 00000000000..1338e08a22b --- /dev/null +++ b/packages/api/src/client/types/app/bsky/purchase/createStripeBillingUrl.ts @@ -0,0 +1,37 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { HeadersMap, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export interface InputSchema { + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + billingUrl?: string + [k: string]: unknown +} + +export interface CallOptions { + signal?: AbortSignal + headers?: HeadersMap + qp?: QueryParams + encoding?: 'application/json' +} + +export interface Response { + success: boolean + headers: HeadersMap + data: OutputSchema +} + +export function toKnownErr(e: any) { + return e +} diff --git a/packages/api/src/client/types/app/bsky/purchase/createStripeCheckoutUrl.ts b/packages/api/src/client/types/app/bsky/purchase/createStripeCheckoutUrl.ts new file mode 100644 index 00000000000..b02328c9711 --- /dev/null +++ b/packages/api/src/client/types/app/bsky/purchase/createStripeCheckoutUrl.ts @@ -0,0 +1,39 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { HeadersMap, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams {} + +export interface InputSchema { + email: string + priceId: string + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + checkoutUrl?: string + [k: string]: unknown +} + +export interface CallOptions { + signal?: AbortSignal + headers?: HeadersMap + qp?: QueryParams + encoding?: 'application/json' +} + +export interface Response { + success: boolean + headers: HeadersMap + data: OutputSchema +} + +export function toKnownErr(e: any) { + return e +} diff --git a/packages/bsky/src/lexicon/index.ts b/packages/bsky/src/lexicon/index.ts index f17459e0e1d..8c56d0c6583 100644 --- a/packages/bsky/src/lexicon/index.ts +++ b/packages/bsky/src/lexicon/index.ts @@ -136,6 +136,8 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences' import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush' import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' +import * as AppBskyPurchaseCreateStripeBillingUrl from './types/app/bsky/purchase/createStripeBillingUrl' +import * as AppBskyPurchaseCreateStripeCheckoutUrl from './types/app/bsky/purchase/createStripeCheckoutUrl' import * as AppBskyPurchaseGetFeatures from './types/app/bsky/purchase/getFeatures' import * as AppBskyPurchaseGetSubscriptionGroup from './types/app/bsky/purchase/getSubscriptionGroup' import * as AppBskyPurchaseGetSubscriptions from './types/app/bsky/purchase/getSubscriptions' @@ -1807,6 +1809,28 @@ export class AppBskyPurchaseNS { this._server = server } + createStripeBillingUrl( + cfg: ConfigOf< + AV, + AppBskyPurchaseCreateStripeBillingUrl.Handler>, + AppBskyPurchaseCreateStripeBillingUrl.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.purchase.createStripeBillingUrl' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + createStripeCheckoutUrl( + cfg: ConfigOf< + AV, + AppBskyPurchaseCreateStripeCheckoutUrl.Handler>, + AppBskyPurchaseCreateStripeCheckoutUrl.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.purchase.createStripeCheckoutUrl' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + getFeatures( cfg: ConfigOf< AV, diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 87e961e2764..d1ee9a3248e 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -9142,6 +9142,84 @@ export const schemaDict = { }, }, }, + AppBskyPurchaseCreateStripeBillingUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeBillingUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Billing Portal session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['redirectUrl'], + properties: { + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + billingUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, + AppBskyPurchaseCreateStripeCheckoutUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeCheckoutUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Checkout session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['email', 'priceId', 'redirectUrl'], + properties: { + email: { + type: 'string', + }, + priceId: { + type: 'string', + }, + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + checkoutUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, AppBskyPurchaseGetFeatures: { lexicon: 1, id: 'app.bsky.purchase.getFeatures', @@ -11112,6 +11190,10 @@ export const ids = { AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences', AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush', AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', + AppBskyPurchaseCreateStripeBillingUrl: + 'app.bsky.purchase.createStripeBillingUrl', + AppBskyPurchaseCreateStripeCheckoutUrl: + 'app.bsky.purchase.createStripeCheckoutUrl', AppBskyPurchaseGetFeatures: 'app.bsky.purchase.getFeatures', AppBskyPurchaseGetSubscriptionGroup: 'app.bsky.purchase.getSubscriptionGroup', AppBskyPurchaseGetSubscriptions: 'app.bsky.purchase.getSubscriptions', diff --git a/packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts b/packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts new file mode 100644 index 00000000000..0cd9d3b97f1 --- /dev/null +++ b/packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts @@ -0,0 +1,49 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + billingUrl?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts b/packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts new file mode 100644 index 00000000000..5159604138c --- /dev/null +++ b/packages/bsky/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + email: string + priceId: string + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + checkoutUrl?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/index.ts b/packages/ozone/src/lexicon/index.ts index bd0a6ac3a20..98af3582921 100644 --- a/packages/ozone/src/lexicon/index.ts +++ b/packages/ozone/src/lexicon/index.ts @@ -136,6 +136,8 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences' import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush' import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' +import * as AppBskyPurchaseCreateStripeBillingUrl from './types/app/bsky/purchase/createStripeBillingUrl' +import * as AppBskyPurchaseCreateStripeCheckoutUrl from './types/app/bsky/purchase/createStripeCheckoutUrl' import * as AppBskyPurchaseGetFeatures from './types/app/bsky/purchase/getFeatures' import * as AppBskyPurchaseGetSubscriptionGroup from './types/app/bsky/purchase/getSubscriptionGroup' import * as AppBskyPurchaseGetSubscriptions from './types/app/bsky/purchase/getSubscriptions' @@ -1850,6 +1852,28 @@ export class AppBskyPurchaseNS { this._server = server } + createStripeBillingUrl( + cfg: ConfigOf< + AV, + AppBskyPurchaseCreateStripeBillingUrl.Handler>, + AppBskyPurchaseCreateStripeBillingUrl.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.purchase.createStripeBillingUrl' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + createStripeCheckoutUrl( + cfg: ConfigOf< + AV, + AppBskyPurchaseCreateStripeCheckoutUrl.Handler>, + AppBskyPurchaseCreateStripeCheckoutUrl.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.purchase.createStripeCheckoutUrl' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + getFeatures( cfg: ConfigOf< AV, diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index 022706d112b..b311019e7c9 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -9142,6 +9142,84 @@ export const schemaDict = { }, }, }, + AppBskyPurchaseCreateStripeBillingUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeBillingUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Billing Portal session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['redirectUrl'], + properties: { + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + billingUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, + AppBskyPurchaseCreateStripeCheckoutUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeCheckoutUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Checkout session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['email', 'priceId', 'redirectUrl'], + properties: { + email: { + type: 'string', + }, + priceId: { + type: 'string', + }, + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + checkoutUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, AppBskyPurchaseGetFeatures: { lexicon: 1, id: 'app.bsky.purchase.getFeatures', @@ -13878,6 +13956,10 @@ export const ids = { AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences', AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush', AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', + AppBskyPurchaseCreateStripeBillingUrl: + 'app.bsky.purchase.createStripeBillingUrl', + AppBskyPurchaseCreateStripeCheckoutUrl: + 'app.bsky.purchase.createStripeCheckoutUrl', AppBskyPurchaseGetFeatures: 'app.bsky.purchase.getFeatures', AppBskyPurchaseGetSubscriptionGroup: 'app.bsky.purchase.getSubscriptionGroup', AppBskyPurchaseGetSubscriptions: 'app.bsky.purchase.getSubscriptions', diff --git a/packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts b/packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts new file mode 100644 index 00000000000..0cd9d3b97f1 --- /dev/null +++ b/packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts @@ -0,0 +1,49 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + billingUrl?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts b/packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts new file mode 100644 index 00000000000..5159604138c --- /dev/null +++ b/packages/ozone/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + email: string + priceId: string + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + checkoutUrl?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/index.ts b/packages/pds/src/lexicon/index.ts index bd0a6ac3a20..98af3582921 100644 --- a/packages/pds/src/lexicon/index.ts +++ b/packages/pds/src/lexicon/index.ts @@ -136,6 +136,8 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences' import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush' import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' +import * as AppBskyPurchaseCreateStripeBillingUrl from './types/app/bsky/purchase/createStripeBillingUrl' +import * as AppBskyPurchaseCreateStripeCheckoutUrl from './types/app/bsky/purchase/createStripeCheckoutUrl' import * as AppBskyPurchaseGetFeatures from './types/app/bsky/purchase/getFeatures' import * as AppBskyPurchaseGetSubscriptionGroup from './types/app/bsky/purchase/getSubscriptionGroup' import * as AppBskyPurchaseGetSubscriptions from './types/app/bsky/purchase/getSubscriptions' @@ -1850,6 +1852,28 @@ export class AppBskyPurchaseNS { this._server = server } + createStripeBillingUrl( + cfg: ConfigOf< + AV, + AppBskyPurchaseCreateStripeBillingUrl.Handler>, + AppBskyPurchaseCreateStripeBillingUrl.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.purchase.createStripeBillingUrl' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + createStripeCheckoutUrl( + cfg: ConfigOf< + AV, + AppBskyPurchaseCreateStripeCheckoutUrl.Handler>, + AppBskyPurchaseCreateStripeCheckoutUrl.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.purchase.createStripeCheckoutUrl' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + getFeatures( cfg: ConfigOf< AV, diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 022706d112b..b311019e7c9 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -9142,6 +9142,84 @@ export const schemaDict = { }, }, }, + AppBskyPurchaseCreateStripeBillingUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeBillingUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Billing Portal session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['redirectUrl'], + properties: { + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + billingUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, + AppBskyPurchaseCreateStripeCheckoutUrl: { + lexicon: 1, + id: 'app.bsky.purchase.createStripeCheckoutUrl', + defs: { + main: { + type: 'procedure', + description: + 'Creates a Stripe Checkout session and returns the URL to access it. Requires auth.', + input: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['email', 'priceId', 'redirectUrl'], + properties: { + email: { + type: 'string', + }, + priceId: { + type: 'string', + }, + redirectUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + properties: { + checkoutUrl: { + type: 'string', + format: 'uri', + }, + }, + }, + }, + }, + }, + }, AppBskyPurchaseGetFeatures: { lexicon: 1, id: 'app.bsky.purchase.getFeatures', @@ -13878,6 +13956,10 @@ export const ids = { AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences', AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush', AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', + AppBskyPurchaseCreateStripeBillingUrl: + 'app.bsky.purchase.createStripeBillingUrl', + AppBskyPurchaseCreateStripeCheckoutUrl: + 'app.bsky.purchase.createStripeCheckoutUrl', AppBskyPurchaseGetFeatures: 'app.bsky.purchase.getFeatures', AppBskyPurchaseGetSubscriptionGroup: 'app.bsky.purchase.getSubscriptionGroup', AppBskyPurchaseGetSubscriptions: 'app.bsky.purchase.getSubscriptions', diff --git a/packages/pds/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts b/packages/pds/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts new file mode 100644 index 00000000000..0cd9d3b97f1 --- /dev/null +++ b/packages/pds/src/lexicon/types/app/bsky/purchase/createStripeBillingUrl.ts @@ -0,0 +1,49 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + billingUrl?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts b/packages/pds/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts new file mode 100644 index 00000000000..5159604138c --- /dev/null +++ b/packages/pds/src/lexicon/types/app/bsky/purchase/createStripeCheckoutUrl.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams {} + +export interface InputSchema { + email: string + priceId: string + redirectUrl: string + [k: string]: unknown +} + +export interface OutputSchema { + checkoutUrl?: string + [k: string]: unknown +} + +export interface HandlerInput { + encoding: 'application/json' + body: InputSchema +} + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput