mirror of
https://github.com/versia-pub/api.git
synced 2026-03-13 04:09:15 +01:00
refactor: 🚚 Rename Lysand to Versia
This commit is contained in:
parent
5b119949dc
commit
c9f4885c72
27 changed files with 112 additions and 112 deletions
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Lysand
|
||||
Copyright (c) 2024 Versia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
<a href="https://lysand.org"><img src="https://cdn.lysand.org/logo-long-dark.webp" alt="Lysand Logo" height="110"></a>
|
||||
</p>
|
||||
|
||||
<center><h1><code>@lysand-org/client</code></h1></center>
|
||||
<center><h1><code>@versia/client</code></h1></center>
|
||||
|
||||
TypeScript client API for Lysand and Mastodon servers.
|
||||
TypeScript client API for Versia and Mastodon servers.
|
||||
|
||||
## Efficiency
|
||||
|
||||
The built output of the package is not even `32 KB` in size, making it a lightweight and efficient solution for your Lysand needs. Installing the package adds around `5 MB` to your `node_modules` folder, but this does not affect the final bundle size.
|
||||
The built output of the package is not even `32 KB` in size, making it a lightweight and efficient solution for your Versia needs. Installing the package adds around `5 MB` to your `node_modules` folder, but this does not affect the final bundle size.
|
||||
|
||||
Compilation (bundling/minifying) time is a few seconds, almost all of which is spent on type-checking. The actual compilation time is less than a tenth of a second.
|
||||
|
||||
|
|
@ -19,12 +19,12 @@ This application may be used in the same was as [`megalodon`](https://github.com
|
|||
Initialize the client with the following code:
|
||||
|
||||
```typescript
|
||||
import { LysandClient } from "@lysand-org/client";
|
||||
import { Client } from "@versia/client";
|
||||
|
||||
const baseUrl = new URL("https://social.lysand.org");
|
||||
const baseUrl = new URL("https://versia.social");
|
||||
const accessToken = "...";
|
||||
|
||||
const client = new LysandClient(baseUrl, accessToken);
|
||||
const client = new Client(baseUrl, accessToken);
|
||||
```
|
||||
|
||||
The client can then be used to interact with the server:
|
||||
|
|
@ -98,18 +98,18 @@ We strongly recommend using JSR over NPM for all your packages that are availabl
|
|||
|
||||
```bash
|
||||
# NPM version
|
||||
deno add npm:@lysand-org/client # For Deno
|
||||
npm install @lysand-org/client # For NPM
|
||||
yarn add @lysand-org/client # For Yarn
|
||||
pnpm add @lysand-org/client # For PNPM
|
||||
bun add @lysand-org/client # For Bun
|
||||
deno add npm:@versia/client # For Deno
|
||||
npm install @versia/client # For NPM
|
||||
yarn add @versia/client # For Yarn
|
||||
pnpm add @versia/client # For PNPM
|
||||
bun add @versia/client # For Bun
|
||||
|
||||
# JSR version
|
||||
deno add @lysand-org/client # For Deno
|
||||
npx jsr add @lysand-org/client # For JSR
|
||||
yarn dlx jsr add @lysand-org/client # For Yarn
|
||||
pnpm dlx jsr add @lysand-org/client # For PNPM
|
||||
bunx jsr add @lysand-org/client # For Bun
|
||||
deno add @versia/client # For Deno
|
||||
npx jsr add @versia/client # For JSR
|
||||
yarn dlx jsr add @versia/client # For Yarn
|
||||
pnpm dlx jsr add @versia/client # For PNPM
|
||||
bunx jsr add @versia/client # For Bun
|
||||
```
|
||||
|
||||
#### From Source
|
||||
|
|
@ -138,4 +138,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|||
|
||||
### People
|
||||
|
||||
- [**April John**](https://github.com/cutestnekoaqua): Creator and maintainer of the Lysand Server ActivityPub bridge.
|
||||
- [**April John**](https://github.com/cutestnekoaqua): Creator and maintainer of the Versia Server ActivityPub bridge.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { type Output, ResponseError } from "./lysand/base";
|
||||
import { LysandClient } from "./lysand/lysand";
|
||||
import type { Token } from "./types/token";
|
||||
import { type Output, ResponseError } from "./versia/base";
|
||||
import { Client } from "./versia/client";
|
||||
|
||||
export { LysandClient, ResponseError, type Output, type Token };
|
||||
export { Client, ResponseError, type Output, type Token };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://jsr.io/schema/config-file.v1.json",
|
||||
"name": "@lysand-org/client",
|
||||
"name": "@versia/client",
|
||||
"version": "0.0.0",
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lysand-org/client",
|
||||
"displayName": "Lysand Client",
|
||||
"name": "@versia/client",
|
||||
"displayName": "Versia Client",
|
||||
"version": "0.0.0",
|
||||
"author": {
|
||||
"email": "jesse.wierzbinski@lysand.org",
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
"url": "https://cpluspatch.com"
|
||||
}
|
||||
],
|
||||
"description": "Client for Mastodon and Lysand API",
|
||||
"description": "Client for Mastodon and Versia API",
|
||||
"categories": ["Other"],
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
|
@ -53,8 +53,8 @@
|
|||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/lysand"
|
||||
},
|
||||
"homepage": "https://lysand.org",
|
||||
"keywords": ["lysand", "mastodon", "api", "typescript", "rest"],
|
||||
"homepage": "https://versia.pub",
|
||||
"keywords": ["versia", "mastodon", "api", "typescript", "rest"],
|
||||
"packageManager": "bun@1.1.8",
|
||||
"dependencies": {
|
||||
"@badgateway/oauth2-client": "^2.3.0"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import type {
|
|||
InstanceRule,
|
||||
} from "./types/instance";
|
||||
import type { List, RepliesPolicy } from "./types/list";
|
||||
import { type LysandRole, RolePermission } from "./types/lysand";
|
||||
import type { Marker } from "./types/marker";
|
||||
import type { Mention } from "./types/mention";
|
||||
import type { Notification, NotificationType } from "./types/notification";
|
||||
|
|
@ -45,6 +44,7 @@ import type { StatusSource } from "./types/status_source";
|
|||
import type { Tag } from "./types/tag";
|
||||
import type { Token } from "./types/token";
|
||||
import type { URLs } from "./types/urls";
|
||||
import { RolePermission, type VersiaRole } from "./types/versia";
|
||||
|
||||
export type {
|
||||
Account,
|
||||
|
|
@ -75,7 +75,7 @@ export type {
|
|||
Instance,
|
||||
InstanceRule,
|
||||
List,
|
||||
LysandRole,
|
||||
VersiaRole,
|
||||
Marker,
|
||||
Mention,
|
||||
Meta,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
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";
|
||||
import type { VersiaRole } from "./versia";
|
||||
|
||||
export type Account = {
|
||||
id: string;
|
||||
|
|
@ -32,6 +32,6 @@ export type Account = {
|
|||
bot: boolean | null;
|
||||
source?: Source;
|
||||
role?: Role;
|
||||
roles: LysandRole[];
|
||||
roles: VersiaRole[];
|
||||
mute_expires_at?: string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ export type Instance = {
|
|||
domain: string;
|
||||
title: string;
|
||||
version: string;
|
||||
lysand_version: string;
|
||||
versia_version: string;
|
||||
source_url: string;
|
||||
description: string;
|
||||
usage: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export type LysandRole = {
|
||||
export type VersiaRole = {
|
||||
id: string;
|
||||
name: string;
|
||||
permissions: RolePermission[];
|
||||
|
|
@ -15,7 +15,6 @@ import type {
|
|||
FeaturedTag,
|
||||
Instance,
|
||||
List,
|
||||
LysandRole,
|
||||
Marker,
|
||||
Notification,
|
||||
Poll,
|
||||
|
|
@ -28,6 +27,7 @@ import type {
|
|||
StatusVisibility,
|
||||
Tag,
|
||||
Token,
|
||||
VersiaRole,
|
||||
} from "../types";
|
||||
import { BaseClient, type Output } from "./base";
|
||||
import { DEFAULT_SCOPE, NO_REDIRECT } from "./constants";
|
||||
|
|
@ -39,17 +39,17 @@ type StatusContentType =
|
|||
| "text/x.misskeymarkdown";
|
||||
|
||||
/**
|
||||
* LysandClient is a client for interacting with the Lysand API.
|
||||
* Client is a client for interacting with the Versia API.
|
||||
*
|
||||
* @extends BaseClient
|
||||
* @example
|
||||
* const client = new LysandClient(new URL("https://example.com"));
|
||||
* const client = new Client(new URL("https://example.com"));
|
||||
*
|
||||
* const { data } = await client.getInstance();
|
||||
*
|
||||
* console.log(data);
|
||||
*/
|
||||
export class LysandClient extends BaseClient {
|
||||
export class Client extends BaseClient {
|
||||
/**
|
||||
* POST /api/v1/follow_requests/:id/authorize
|
||||
*
|
||||
|
|
@ -106,7 +106,7 @@ export class LysandClient extends BaseClient {
|
|||
/**
|
||||
* POST /api/v1/roles/:roleId
|
||||
*
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @param roleId ID of the role to add to the requesting account.
|
||||
*/
|
||||
public addRole(
|
||||
|
|
@ -549,7 +549,7 @@ export class LysandClient extends BaseClient {
|
|||
/**
|
||||
* GET /api/v1/accounts/id
|
||||
*
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @param username The username.
|
||||
* @return An account.
|
||||
*/
|
||||
|
|
@ -1164,7 +1164,7 @@ export class LysandClient extends BaseClient {
|
|||
/**
|
||||
* GET /api/v1/instance/privacy_policy
|
||||
*
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @returns
|
||||
*/
|
||||
public getInstancePrivacyPolicy(
|
||||
|
|
@ -1179,7 +1179,7 @@ export class LysandClient extends BaseClient {
|
|||
/**
|
||||
* GET /api/v1/instance/tos
|
||||
*
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @returns
|
||||
*/
|
||||
public getInstanceTermsOfService(
|
||||
|
|
@ -1575,18 +1575,18 @@ export class LysandClient extends BaseClient {
|
|||
public getRole(
|
||||
id: string,
|
||||
extra?: RequestInit,
|
||||
): Promise<Output<LysandRole>> {
|
||||
return this.get<LysandRole>(`/api/v1/roles/${id}`, extra);
|
||||
): Promise<Output<VersiaRole>> {
|
||||
return this.get<VersiaRole>(`/api/v1/roles/${id}`, extra);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/roles
|
||||
*
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @returns Array of roles.
|
||||
*/
|
||||
public getRoles(extra?: RequestInit): Promise<Output<LysandRole[]>> {
|
||||
return this.get<LysandRole[]>("/api/v1/roles", extra);
|
||||
public getRoles(extra?: RequestInit): Promise<Output<VersiaRole[]>> {
|
||||
return this.get<VersiaRole[]>("/api/v1/roles", extra);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2052,7 +2052,7 @@ export class LysandClient extends BaseClient {
|
|||
* POST /api/v1/accounts/:id/refetch
|
||||
*
|
||||
* Starts a refetch of an account from a remote source.
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @param id The account ID.
|
||||
* @return Account with updated data.
|
||||
*/
|
||||
|
|
@ -2181,7 +2181,7 @@ export class LysandClient extends BaseClient {
|
|||
/**
|
||||
* DELETE /api/v1/roles/:roleId
|
||||
*
|
||||
* Lysand API only.
|
||||
* Versia API only.
|
||||
* @param roleId Role ID to remove from requesting account.
|
||||
* @returns
|
||||
*/
|
||||
|
|
@ -2,4 +2,4 @@ import pkg from "../package.json" with { type: "json" };
|
|||
|
||||
export const NO_REDIRECT = "urn:ietf:wg:oauth:2.0:oob";
|
||||
export const DEFAULT_SCOPE = ["read", "write", "follow"];
|
||||
export const DEFAULT_UA = `LysandClient/${pkg.version} (+${pkg.homepage})`;
|
||||
export const DEFAULT_UA = `VersiaClient/${pkg.version} (+${pkg.homepage})`;
|
||||
Loading…
Add table
Add a link
Reference in a new issue