Skip to content

Commit

Permalink
Merge pull request #3196 from bluesky-social/bsky-bsync-subscription-…
Browse files Browse the repository at this point in the history
…endpoints
  • Loading branch information
rafaelbsky authored Jan 3, 2025
2 parents c76b12b + 4d8784d commit 529e52b
Show file tree
Hide file tree
Showing 70 changed files with 5,385 additions and 144 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsky-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- bsky-bsync-subscription-endpoints
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsky-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- bsky-bsync-subscription-endpoints
env:
REGISTRY: ghcr.io
USERNAME: ${{ github.actor }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsync-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- bsky-bsync-subscription-endpoints
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsync-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- bsky-bsync-subscription-endpoints
env:
REGISTRY: ghcr.io
USERNAME: ${{ github.actor }}
Expand Down
33 changes: 33 additions & 0 deletions lexicons/app/bsky/purchase/getFeatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"lexicon": 1,
"id": "app.bsky.purchase.getFeatures",
"defs": {
"main": {
"type": "query",
"description": "Enumerate unlocked paid feature flags for the requesting account. Requires auth.",
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["features"],
"properties": {
"features": {
"type": "ref",
"ref": "#features"
}
}
}
}
},
"features": {
"type": "object",
"required": [],
"properties": {
"customProfileColor": {
"type": "boolean",
"description": "Indicates to client apps to allow the requesting account to customize the profile color."
}
}
}
}
}
53 changes: 53 additions & 0 deletions lexicons/app/bsky/purchase/getSubscriptionGroup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"lexicon": 1,
"id": "app.bsky.purchase.getSubscriptionGroup",
"defs": {
"main": {
"type": "query",
"description": "Gets a subscription group and its offerings for the target platform. Requires auth.",
"parameters": {
"type": "params",
"required": ["group", "platform"],
"properties": {
"group": { "type": "string", "knownValues": ["core"] },
"platform": {
"type": "string",
"knownValues": ["android", "ios", "web"]
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": [],
"properties": {
"group": { "type": "string", "knownValues": ["core"] },
"offerings": {
"type": "array",
"items": {
"type": "ref",
"ref": "#offering"
}
}
}
}
}
},
"offering": {
"type": "object",
"required": [],
"properties": {
"id": {
"type": "string",
"knownValues": ["core:annual", "core:monthly"]
},
"platform": {
"type": "string",
"knownValues": ["android", "ios", "web"]
},
"product": { "type": "string" }
}
}
}
}
58 changes: 58 additions & 0 deletions lexicons/app/bsky/purchase/getSubscriptions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"lexicon": 1,
"id": "app.bsky.purchase.getSubscriptions",
"defs": {
"main": {
"type": "query",
"description": "Enumerate subscriptions for the requesting account, and the email used in the purchase. Requires auth.",
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["subscriptions"],
"properties": {
"email": { "type": "string" },
"subscriptions": {
"type": "array",
"items": {
"type": "ref",
"ref": "#subscription"
}
}
}
}
}
},
"subscription": {
"type": "object",
"required": [],
"properties": {
"status": {
"type": "string",
"knownValues": ["active", "expired", "paused", "unknown"]
},
"renewalStatus": {
"type": "string",
"knownValues": [
"unknown",
"will_not_renew",
"will_pause",
"will_renew"
]
},
"group": { "type": "string", "knownValues": ["core"] },
"platform": {
"type": "string",
"knownValues": ["android", "ios", "web"]
},
"offering": {
"type": "string",
"knownValues": ["core:annual", "core:monthly"]
},
"periodEndsAt": { "type": "string", "format": "datetime" },
"periodStartsAt": { "type": "string", "format": "datetime" },
"purchasedAt": { "type": "string", "format": "datetime" }
}
}
}
}
27 changes: 27 additions & 0 deletions lexicons/app/bsky/purchase/refreshCache.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"lexicon": 1,
"id": "app.bsky.purchase.refreshCache",
"defs": {
"main": {
"type": "procedure",
"description": "Refresh the purchase cache for the requesting account or for another account if the role authorizes it. Requires auth.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did"],
"properties": {
"did": { "type": "string", "format": "did" }
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"properties": {}
}
}
}
}
}
66 changes: 66 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ 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 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'
import * as AppBskyPurchaseRefreshCache from './types/app/bsky/purchase/refreshCache'
import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
Expand Down Expand Up @@ -388,6 +392,10 @@ 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 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'
export * as AppBskyPurchaseRefreshCache from './types/app/bsky/purchase/refreshCache'
export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
export * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
Expand Down Expand Up @@ -1486,6 +1494,7 @@ export class AppBskyNS {
graph: AppBskyGraphNS
labeler: AppBskyLabelerNS
notification: AppBskyNotificationNS
purchase: AppBskyPurchaseNS
richtext: AppBskyRichtextNS
unspecced: AppBskyUnspeccedNS
video: AppBskyVideoNS
Expand All @@ -1498,6 +1507,7 @@ export class AppBskyNS {
this.graph = new AppBskyGraphNS(client)
this.labeler = new AppBskyLabelerNS(client)
this.notification = new AppBskyNotificationNS(client)
this.purchase = new AppBskyPurchaseNS(client)
this.richtext = new AppBskyRichtextNS(client)
this.unspecced = new AppBskyUnspeccedNS(client)
this.video = new AppBskyVideoNS(client)
Expand Down Expand Up @@ -3026,6 +3036,62 @@ export class AppBskyNotificationNS {
}
}

export class AppBskyPurchaseNS {
_client: XrpcClient

constructor(client: XrpcClient) {
this._client = client
}

getFeatures(
params?: AppBskyPurchaseGetFeatures.QueryParams,
opts?: AppBskyPurchaseGetFeatures.CallOptions,
): Promise<AppBskyPurchaseGetFeatures.Response> {
return this._client.call(
'app.bsky.purchase.getFeatures',
params,
undefined,
opts,
)
}

getSubscriptionGroup(
params?: AppBskyPurchaseGetSubscriptionGroup.QueryParams,
opts?: AppBskyPurchaseGetSubscriptionGroup.CallOptions,
): Promise<AppBskyPurchaseGetSubscriptionGroup.Response> {
return this._client.call(
'app.bsky.purchase.getSubscriptionGroup',
params,
undefined,
opts,
)
}

getSubscriptions(
params?: AppBskyPurchaseGetSubscriptions.QueryParams,
opts?: AppBskyPurchaseGetSubscriptions.CallOptions,
): Promise<AppBskyPurchaseGetSubscriptions.Response> {
return this._client.call(
'app.bsky.purchase.getSubscriptions',
params,
undefined,
opts,
)
}

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

export class AppBskyRichtextNS {
_client: XrpcClient

Expand Down
Loading

0 comments on commit 529e52b

Please sign in to comment.