Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add purchase lexicons #3263

Open
wants to merge 1 commit into
base: bsky-bsync-subscription-endpoints
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions lexicons/app/bsky/purchase/createStripeBillingUrl.json
Original file line number Diff line number Diff line change
@@ -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" }
}
}
}
}
}
}
31 changes: 31 additions & 0 deletions lexicons/app/bsky/purchase/createStripeCheckoutUrl.json
Original file line number Diff line number Diff line change
@@ -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" }
}
}
}
}
}
}
28 changes: 28 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -3043,6 +3047,30 @@ export class AppBskyPurchaseNS {
this._client = client
}

createStripeBillingUrl(
data?: AppBskyPurchaseCreateStripeBillingUrl.InputSchema,
opts?: AppBskyPurchaseCreateStripeBillingUrl.CallOptions,
): Promise<AppBskyPurchaseCreateStripeBillingUrl.Response> {
return this._client.call(
'app.bsky.purchase.createStripeBillingUrl',
opts?.qp,
data,
opts,
)
}

createStripeCheckoutUrl(
data?: AppBskyPurchaseCreateStripeCheckoutUrl.InputSchema,
opts?: AppBskyPurchaseCreateStripeCheckoutUrl.CallOptions,
): Promise<AppBskyPurchaseCreateStripeCheckoutUrl.Response> {
return this._client.call(
'app.bsky.purchase.createStripeCheckoutUrl',
opts?.qp,
data,
opts,
)
}

getFeatures(
params?: AppBskyPurchaseGetFeatures.QueryParams,
opts?: AppBskyPurchaseGetFeatures.CallOptions,
Expand Down
82 changes: 82 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
}
24 changes: 24 additions & 0 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -1807,6 +1809,28 @@ export class AppBskyPurchaseNS {
this._server = server
}

createStripeBillingUrl<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
AppBskyPurchaseCreateStripeBillingUrl.Handler<ExtractAuth<AV>>,
AppBskyPurchaseCreateStripeBillingUrl.HandlerReqCtx<ExtractAuth<AV>>
>,
) {
const nsid = 'app.bsky.purchase.createStripeBillingUrl' // @ts-ignore
return this._server.xrpc.method(nsid, cfg)
}

createStripeCheckoutUrl<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
AppBskyPurchaseCreateStripeCheckoutUrl.Handler<ExtractAuth<AV>>,
AppBskyPurchaseCreateStripeCheckoutUrl.HandlerReqCtx<ExtractAuth<AV>>
>,
) {
const nsid = 'app.bsky.purchase.createStripeCheckoutUrl' // @ts-ignore
return this._server.xrpc.method(nsid, cfg)
}

getFeatures<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
Loading
Loading