From 6f717fcccdfb122036cb6a3d7c97f550a9555716 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Tue, 11 Jun 2024 14:54:21 -1000 Subject: [PATCH] chore(client): :label: Update client types, add TOS and Privacy Policy APIs --- .github/workflows/publish.yml | 7 ++++--- client/lysand/lysand.ts | 27 +++++++++++++++++++++++++++ client/types/account.ts | 2 ++ client/types/relationship.ts | 1 + 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3a92deb..0f557d7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,7 +29,8 @@ on: options: - npm - jsr - default: "npm" + - both + default: "both" permissions: contents: read @@ -60,11 +61,11 @@ jobs: run: 'sed -i ''s/"version": ".*"/"version": "${{ github.event.inputs.version }}"/'' package.json ${{ github.event.inputs.package }}/package.json ${{ github.event.inputs.package }}/jsr.jsonc' - name: Publish to NPM - if: ${{ github.event.inputs.registry == 'npm' }} + if: ${{ github.event.inputs.registry == 'npm' }} || ${{ github.event.inputs.registry == 'both' }} run: cd ${{ github.event.inputs.package }} && npm publish --provenance --tag ${{ github.event.inputs.tag }} --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publish to JSR - if: ${{ github.event.inputs.registry == 'jsr' }} + if: ${{ github.event.inputs.registry == 'jsr' }} || ${{ github.event.inputs.registry == 'both' }} run: cd ${{ github.event.inputs.package }} && bun install --frozen-lockfile && bunx jsr publish --allow-slow-types --allow-dirty diff --git a/client/lysand/lysand.ts b/client/lysand/lysand.ts index 9b69045..b37a48b 100644 --- a/client/lysand/lysand.ts +++ b/client/lysand/lysand.ts @@ -1039,6 +1039,33 @@ export class LysandClient extends BaseClient { return this.get("/api/v1/instance/peers", extra); } + /** + * GET /api/v1/instance/privacy_policy + * + * Lysand API only. + * @returns + */ + public getInstancePrivacyPolicy( + extra?: RequestInit, + ): Promise> { + return this.get( + "/api/v1/instance/privacy_policy", + extra, + ); + } + + /** + * GET /api/v1/instance/tos + * + * Lysand API only. + * @returns + */ + public getInstanceTermsOfService( + extra?: RequestInit, + ): Promise> { + return this.get("/api/v1/instance/tos", extra); + } + /** * GET /api/v1/trends * diff --git a/client/types/account.ts b/client/types/account.ts index 9d796c8..3e8366b 100644 --- a/client/types/account.ts +++ b/client/types/account.ts @@ -1,5 +1,6 @@ import type { Emoji } from "./emoji"; import type { Field } from "./field"; +import type { LysandRole } from "./lysand"; import type { Role } from "./role"; import type { Source } from "./source"; @@ -30,5 +31,6 @@ export type Account = { bot: boolean | null; source?: Source; role?: Role; + roles: LysandRole[]; mute_expires_at?: string; }; diff --git a/client/types/relationship.ts b/client/types/relationship.ts index 1d5540d..c2bb9c2 100644 --- a/client/types/relationship.ts +++ b/client/types/relationship.ts @@ -7,6 +7,7 @@ export type Relationship = { muting: boolean; muting_notifications: boolean; requested: boolean; + requested_by: boolean; domain_blocking: boolean; showing_reblogs: boolean; endorsed: boolean;