docs: 📝 API documentation generation

This commit is contained in:
ThatOneCalculator 2023-06-23 21:13:03 -07:00
parent 0625bcbec3
commit 0e4a4b09c9
No known key found for this signature in database
GPG key ID: 8703CACD01000000
92 changed files with 16417 additions and 13506 deletions

View file

@ -4,4 +4,6 @@ Fork of Misskey.js for Calckey
https://www.npmjs.com/package/calckey-js https://www.npmjs.com/package/calckey-js
To fully build, run `pnpm i && pnpm run render`.
![Parody of the Javascript logo with "CK" instead of "JS"](https://codeberg.org/repo-avatars/80771-4d86135f67b9a460cdd1be9e91648e5f) ![Parody of the Javascript logo with "CK" instead of "JS"](https://codeberg.org/repo-avatars/80771-4d86135f67b9a460cdd1be9e91648e5f)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Acct](./calckey-js.acct.md)
## Acct type
**Signature:**
```typescript
export declare type Acct = {
username: string;
host: string | null;
};
```

View file

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIClient](./calckey-js.api.apiclient.md) &gt; [(constructor)](./calckey-js.api.apiclient._constructor_.md)
## api.APIClient.(constructor)
Constructs a new instance of the `APIClient` class
**Signature:**
```typescript
constructor(opts: {
origin: APIClient["origin"];
credential?: APIClient["credential"];
fetch?: APIClient["fetch"] | null | undefined;
});
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| opts | { origin: [APIClient](./calckey-js.api.apiclient.md)<!-- -->\["origin"\]; credential?: [APIClient](./calckey-js.api.apiclient.md)<!-- -->\["credential"\]; fetch?: [APIClient](./calckey-js.api.apiclient.md)<!-- -->\["fetch"\] \| null \| undefined; } | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIClient](./calckey-js.api.apiclient.md) &gt; [credential](./calckey-js.api.apiclient.credential.md)
## api.APIClient.credential property
**Signature:**
```typescript
credential: string | null | undefined;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIClient](./calckey-js.api.apiclient.md) &gt; [fetch](./calckey-js.api.apiclient.fetch.md)
## api.APIClient.fetch property
**Signature:**
```typescript
fetch: FetchLike;
```

View file

@ -0,0 +1,32 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIClient](./calckey-js.api.apiclient.md)
## api.APIClient class
**Signature:**
```typescript
export declare class APIClient
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(opts)](./calckey-js.api.apiclient._constructor_.md) | | Constructs a new instance of the <code>APIClient</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [credential](./calckey-js.api.apiclient.credential.md) | | string \| null \| undefined | |
| [fetch](./calckey-js.api.apiclient.fetch.md) | | [FetchLike](./calckey-js.api.fetchlike.md) | |
| [origin](./calckey-js.api.apiclient.origin.md) | | string | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [request(endpoint, params, credential)](./calckey-js.api.apiclient.request.md) | | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIClient](./calckey-js.api.apiclient.md) &gt; [origin](./calckey-js.api.apiclient.origin.md)
## api.APIClient.origin property
**Signature:**
```typescript
origin: string;
```

View file

@ -0,0 +1,57 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIClient](./calckey-js.api.apiclient.md) &gt; [request](./calckey-js.api.apiclient.request.md)
## api.APIClient.request() method
**Signature:**
```typescript
request<E extends keyof Endpoints, P extends Endpoints[E]["req"]>(
endpoint: E,
params?: P,
credential?: string | null | undefined,
): Promise<
Endpoints[E]["res"] extends {
$switch: {
$cases: [any, any][];
$default: any;
};
}
? IsCaseMatched<E, P, 0> extends true
? GetCaseResult<E, P, 0>
: IsCaseMatched<E, P, 1> extends true
? GetCaseResult<E, P, 1>
: IsCaseMatched<E, P, 2> extends true
? GetCaseResult<E, P, 2>
: IsCaseMatched<E, P, 3> extends true
? GetCaseResult<E, P, 3>
: IsCaseMatched<E, P, 4> extends true
? GetCaseResult<E, P, 4>
: IsCaseMatched<E, P, 5> extends true
? GetCaseResult<E, P, 5>
: IsCaseMatched<E, P, 6> extends true
? GetCaseResult<E, P, 6>
: IsCaseMatched<E, P, 7> extends true
? GetCaseResult<E, P, 7>
: IsCaseMatched<E, P, 8> extends true
? GetCaseResult<E, P, 8>
: IsCaseMatched<E, P, 9> extends true
? GetCaseResult<E, P, 9>
: Endpoints[E]["res"]["$switch"]["$default"]
: Endpoints[E]["res"]
>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| endpoint | E | |
| params | P | _(Optional)_ |
| credential | string \| null \| undefined | _(Optional)_ |
**Returns:**
Promise&lt; [Endpoints](./calckey-js.endpoints.md)<!-- -->\[E\]\["res"\] extends { $switch: { $cases: \[any, any\]\[\]; $default: any; }; } ? IsCaseMatched&lt;E, P, 0&gt; extends true ? GetCaseResult&lt;E, P, 0&gt; : IsCaseMatched&lt;E, P, 1&gt; extends true ? GetCaseResult&lt;E, P, 1&gt; : IsCaseMatched&lt;E, P, 2&gt; extends true ? GetCaseResult&lt;E, P, 2&gt; : IsCaseMatched&lt;E, P, 3&gt; extends true ? GetCaseResult&lt;E, P, 3&gt; : IsCaseMatched&lt;E, P, 4&gt; extends true ? GetCaseResult&lt;E, P, 4&gt; : IsCaseMatched&lt;E, P, 5&gt; extends true ? GetCaseResult&lt;E, P, 5&gt; : IsCaseMatched&lt;E, P, 6&gt; extends true ? GetCaseResult&lt;E, P, 6&gt; : IsCaseMatched&lt;E, P, 7&gt; extends true ? GetCaseResult&lt;E, P, 7&gt; : IsCaseMatched&lt;E, P, 8&gt; extends true ? GetCaseResult&lt;E, P, 8&gt; : IsCaseMatched&lt;E, P, 9&gt; extends true ? GetCaseResult&lt;E, P, 9&gt; : [Endpoints](./calckey-js.endpoints.md)<!-- -->\[E\]\["res"\]\["$switch"\]\["$default"\] : [Endpoints](./calckey-js.endpoints.md)<!-- -->\[E\]\["res"\] &gt;

View file

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [APIError](./calckey-js.api.apierror.md)
## api.APIError type
**Signature:**
```typescript
export declare type APIError = {
id: string;
code: string;
message: string;
kind: "client" | "server";
info: Record<string, any>;
};
```

View file

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [FetchLike](./calckey-js.api.fetchlike.md)
## api.FetchLike type
**Signature:**
```typescript
export declare type FetchLike = (
input: string,
init?: {
method?: string;
body?: string;
credentials?: RequestCredentials;
cache?: RequestCache;
},
) => Promise<{
status: number;
json(): Promise<any>;
}>;
```

View file

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md) &gt; [isAPIError](./calckey-js.api.isapierror.md)
## api.isAPIError() function
**Signature:**
```typescript
export declare function isAPIError(reason: any): reason is APIError;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| reason | any | |
**Returns:**
reason is [APIError](./calckey-js.api.apierror.md)

View file

@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [api](./calckey-js.api.md)
## api namespace
## Classes
| Class | Description |
| --- | --- |
| [APIClient](./calckey-js.api.apiclient.md) | |
## Functions
| Function | Description |
| --- | --- |
| [isAPIError(reason)](./calckey-js.api.isapierror.md) | |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [APIError](./calckey-js.api.apierror.md) | |
| [FetchLike](./calckey-js.api.fetchlike.md) | |

View file

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [(constructor)](./calckey-js.channelconnection._constructor_.md)
## ChannelConnection.(constructor)
Constructs a new instance of the `Connection` class
**Signature:**
```typescript
constructor(stream: Stream, channel: string, name?: string);
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| stream | [Stream](./calckey-js.stream.md) | |
| channel | string | |
| name | string | _(Optional)_ |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [channel](./calckey-js.channelconnection.channel.md)
## ChannelConnection.channel property
**Signature:**
```typescript
channel: string;
```

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [dispose](./calckey-js.channelconnection.dispose.md)
## ChannelConnection.dispose() method
**Signature:**
```typescript
abstract dispose(): void;
```
**Returns:**
void

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [id](./calckey-js.channelconnection.id.md)
## ChannelConnection.id property
**Signature:**
```typescript
abstract id: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [inCount](./calckey-js.channelconnection.incount.md)
## ChannelConnection.inCount property
**Signature:**
```typescript
inCount: number;
```

View file

@ -0,0 +1,39 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md)
## ChannelConnection class
**Signature:**
```typescript
export declare abstract class Connection<
Channel extends AnyOf<Channels> = any,
> extends EventEmitter<Channel["events"]>
```
**Extends:** EventEmitter&lt;Channel\["events"\]&gt;
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(stream, channel, name)](./calckey-js.channelconnection._constructor_.md) | | Constructs a new instance of the <code>Connection</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [channel](./calckey-js.channelconnection.channel.md) | | string | |
| [id](./calckey-js.channelconnection.id.md) | <code>abstract</code> | string | |
| [inCount](./calckey-js.channelconnection.incount.md) | | number | |
| [name?](./calckey-js.channelconnection.name.md) | | string | _(Optional)_ |
| [outCount](./calckey-js.channelconnection.outcount.md) | | number | |
| [stream](./calckey-js.channelconnection.stream.md) | <code>protected</code> | [Stream](./calckey-js.stream.md) | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [dispose()](./calckey-js.channelconnection.dispose.md) | <code>abstract</code> | |
| [send(type, body)](./calckey-js.channelconnection.send.md) | | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [name](./calckey-js.channelconnection.name.md)
## ChannelConnection.name property
**Signature:**
```typescript
name?: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [outCount](./calckey-js.channelconnection.outcount.md)
## ChannelConnection.outCount property
**Signature:**
```typescript
outCount: number;
```

View file

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [send](./calckey-js.channelconnection.send.md)
## ChannelConnection.send() method
**Signature:**
```typescript
send<T extends keyof Channel["receives"]>(
type: T,
body: Channel["receives"][T],
): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | T | |
| body | Channel\["receives"\]\[T\] | |
**Returns:**
void

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ChannelConnection](./calckey-js.channelconnection.md) &gt; [stream](./calckey-js.channelconnection.stream.md)
## ChannelConnection.stream property
**Signature:**
```typescript
protected stream: Stream;
```

View file

@ -0,0 +1,143 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Channels](./calckey-js.channels.md)
## Channels type
**Signature:**
```typescript
export declare type Channels = {
main: {
params: null;
events: {
notification: (payload: Notification) => void;
mention: (payload: Note) => void;
reply: (payload: Note) => void;
renote: (payload: Note) => void;
follow: (payload: User) => void;
followed: (payload: User) => void;
unfollow: (payload: User) => void;
meUpdated: (payload: MeDetailed) => void;
pageEvent: (payload: PageEvent) => void;
urlUploadFinished: (payload: {
marker: string;
file: DriveFile;
}) => void;
readAllNotifications: () => void;
unreadNotification: (payload: Notification) => void;
unreadMention: (payload: Note["id"]) => void;
readAllUnreadMentions: () => void;
unreadSpecifiedNote: (payload: Note["id"]) => void;
readAllUnreadSpecifiedNotes: () => void;
readAllMessagingMessages: () => void;
messagingMessage: (payload: MessagingMessage) => void;
unreadMessagingMessage: (payload: MessagingMessage) => void;
readAllAntennas: () => void;
unreadAntenna: (payload: Antenna) => void;
readAllAnnouncements: () => void;
readAllChannels: () => void;
unreadChannel: (payload: Note["id"]) => void;
myTokenRegenerated: () => void;
reversiNoInvites: () => void;
reversiInvited: (payload: FIXME) => void;
signin: (payload: FIXME) => void;
registryUpdated: (payload: {
scope?: string[];
key: string;
value: any | null;
}) => void;
driveFileCreated: (payload: DriveFile) => void;
readAntenna: (payload: Antenna) => void;
};
receives: null;
};
homeTimeline: {
params: null;
events: {
note: (payload: Note) => void;
};
receives: null;
};
localTimeline: {
params: null;
events: {
note: (payload: Note) => void;
};
receives: null;
};
hybridTimeline: {
params: null;
events: {
note: (payload: Note) => void;
};
receives: null;
};
recommendedTimeline: {
params: null;
events: {
note: (payload: Note) => void;
};
receives: null;
};
globalTimeline: {
params: null;
events: {
note: (payload: Note) => void;
};
receives: null;
};
antenna: {
params: {
antennaId: Antenna["id"];
};
events: {
note: (payload: Note) => void;
};
receives: null;
};
messaging: {
params: {
otherparty?: User["id"] | null;
group?: UserGroup["id"] | null;
};
events: {
message: (payload: MessagingMessage) => void;
deleted: (payload: MessagingMessage["id"]) => void;
read: (payload: MessagingMessage["id"][]) => void;
typers: (payload: User[]) => void;
};
receives: {
read: {
id: MessagingMessage["id"];
};
};
};
serverStats: {
params: null;
events: {
stats: (payload: FIXME) => void;
};
receives: {
requestLog: {
id: string | number;
length: number;
};
};
};
queueStats: {
params: null;
events: {
stats: (payload: FIXME) => void;
};
receives: {
requestLog: {
id: string | number;
length: number;
};
};
};
};
```
**References:** [Note](./calckey-js.entities.note.md)<!-- -->, [User](./calckey-js.entities.user.md)<!-- -->, [MeDetailed](./calckey-js.entities.medetailed.md)<!-- -->, [PageEvent](./calckey-js.entities.pageevent.md)<!-- -->, [DriveFile](./calckey-js.entities.drivefile.md)<!-- -->, [MessagingMessage](./calckey-js.entities.messagingmessage.md)<!-- -->, [Antenna](./calckey-js.entities.antenna.md)<!-- -->, [UserGroup](./calckey-js.entities.usergroup.md)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Ad](./calckey-js.entities.ad.md)
## entities.Ad type
**Signature:**
```typescript
export declare type Ad = TODO;
```

View file

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Announcement](./calckey-js.entities.announcement.md)
## entities.Announcement type
**Signature:**
```typescript
export declare type Announcement = {
id: ID;
createdAt: DateString;
updatedAt: DateString | null;
text: string;
title: string;
imageUrl: string | null;
isRead?: boolean;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)

View file

@ -0,0 +1,29 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Antenna](./calckey-js.entities.antenna.md)
## entities.Antenna type
**Signature:**
```typescript
export declare type Antenna = {
id: ID;
createdAt: DateString;
name: string;
keywords: string[][];
excludeKeywords: string[][];
src: "home" | "all" | "users" | "list" | "group" | "instances";
userListId: ID | null;
userGroupId: ID | null;
users: string[];
instances: string[];
caseSensitive: boolean;
notify: boolean;
withReplies: boolean;
withFile: boolean;
hasUnreadNote: boolean;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [App](./calckey-js.entities.app.md)
## entities.App type
**Signature:**
```typescript
export declare type App = TODO;
```

View file

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [AuthSession](./calckey-js.entities.authsession.md)
## entities.AuthSession type
**Signature:**
```typescript
export declare type AuthSession = {
id: ID;
app: App;
token: string;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [App](./calckey-js.entities.app.md)

View file

@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Blocking](./calckey-js.entities.blocking.md)
## entities.Blocking type
**Signature:**
```typescript
export declare type Blocking = {
id: ID;
createdAt: DateString;
blockeeId: User["id"];
blockee: UserDetailed;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [User](./calckey-js.entities.user.md)<!-- -->, [UserDetailed](./calckey-js.entities.userdetailed.md)

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Channel](./calckey-js.entities.channel.md)
## entities.Channel type
**Signature:**
```typescript
export declare type Channel = {
id: ID;
};
```
**References:** [ID](./calckey-js.entities.id.md)

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Clip](./calckey-js.entities.clip.md)
## entities.Clip type
**Signature:**
```typescript
export declare type Clip = TODO;
```

View file

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [CustomEmoji](./calckey-js.entities.customemoji.md)
## entities.CustomEmoji type
**Signature:**
```typescript
export declare type CustomEmoji = {
id: string;
name: string;
url: string;
category: string;
aliases: string[];
};
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [DateString](./calckey-js.entities.datestring.md)
## entities.DateString type
**Signature:**
```typescript
export declare type DateString = string;
```

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [DetailedInstanceMetadata](./calckey-js.entities.detailedinstancemetadata.md)
## entities.DetailedInstanceMetadata type
**Signature:**
```typescript
export declare type DetailedInstanceMetadata = LiteInstanceMetadata & {
features: Record<string, any>;
};
```
**References:** [LiteInstanceMetadata](./calckey-js.entities.liteinstancemetadata.md)

View file

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [DriveFile](./calckey-js.entities.drivefile.md)
## entities.DriveFile type
**Signature:**
```typescript
export declare type DriveFile = {
id: ID;
createdAt: DateString;
isSensitive: boolean;
name: string;
thumbnailUrl: string;
url: string;
type: string;
size: number;
md5: string;
blurhash: string;
comment: string | null;
properties: Record<string, any>;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [DriveFolder](./calckey-js.entities.drivefolder.md)
## entities.DriveFolder type
**Signature:**
```typescript
export declare type DriveFolder = TODO;
```

View file

@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Following](./calckey-js.entities.following.md)
## entities.Following type
**Signature:**
```typescript
export declare type Following = {
id: ID;
createdAt: DateString;
followerId: User["id"];
followeeId: User["id"];
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [User](./calckey-js.entities.user.md)

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [FollowingFolloweePopulated](./calckey-js.entities.followingfolloweepopulated.md)
## entities.FollowingFolloweePopulated type
**Signature:**
```typescript
export declare type FollowingFolloweePopulated = Following & {
followee: UserDetailed;
};
```
**References:** [Following](./calckey-js.entities.following.md)<!-- -->, [UserDetailed](./calckey-js.entities.userdetailed.md)

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [FollowingFollowerPopulated](./calckey-js.entities.followingfollowerpopulated.md)
## entities.FollowingFollowerPopulated type
**Signature:**
```typescript
export declare type FollowingFollowerPopulated = Following & {
follower: UserDetailed;
};
```
**References:** [Following](./calckey-js.entities.following.md)<!-- -->, [UserDetailed](./calckey-js.entities.userdetailed.md)

View file

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [FollowRequest](./calckey-js.entities.followrequest.md)
## entities.FollowRequest type
**Signature:**
```typescript
export declare type FollowRequest = {
id: ID;
follower: User;
followee: User;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [User](./calckey-js.entities.user.md)

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [GalleryPost](./calckey-js.entities.gallerypost.md)
## entities.GalleryPost type
**Signature:**
```typescript
export declare type GalleryPost = TODO;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [ID](./calckey-js.entities.id.md)
## entities.ID type
**Signature:**
```typescript
export declare type ID = string;
```

View file

@ -0,0 +1,40 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Instance](./calckey-js.entities.instance.md)
## entities.Instance type
**Signature:**
```typescript
export declare type Instance = {
id: ID;
caughtAt: DateString;
host: string;
usersCount: number;
notesCount: number;
followingCount: number;
followersCount: number;
driveUsage: number;
driveFiles: number;
latestRequestSentAt: DateString | null;
latestStatus: number | null;
latestRequestReceivedAt: DateString | null;
lastCommunicatedAt: DateString;
isNotResponding: boolean;
isSuspended: boolean;
softwareName: string | null;
softwareVersion: string | null;
openRegistrations: boolean | null;
name: string | null;
description: string | null;
maintainerName: string | null;
maintainerEmail: string | null;
iconUrl: string | null;
faviconUrl: string | null;
themeColor: string | null;
infoUpdatedAt: DateString | null;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [InstanceMetadata](./calckey-js.entities.instancemetadata.md)
## entities.InstanceMetadata type
**Signature:**
```typescript
export declare type InstanceMetadata =
| LiteInstanceMetadata
| DetailedInstanceMetadata;
```
**References:** [LiteInstanceMetadata](./calckey-js.entities.liteinstancemetadata.md)<!-- -->, [DetailedInstanceMetadata](./calckey-js.entities.detailedinstancemetadata.md)

View file

@ -0,0 +1,46 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [LiteInstanceMetadata](./calckey-js.entities.liteinstancemetadata.md)
## entities.LiteInstanceMetadata type
**Signature:**
```typescript
export declare type LiteInstanceMetadata = {
maintainerName: string | null;
maintainerEmail: string | null;
version: string;
name: string | null;
uri: string;
description: string | null;
tosUrl: string | null;
disableRegistration: boolean;
disableLocalTimeline: boolean;
disableRecommendedTimeline: boolean;
disableGlobalTimeline: boolean;
driveCapacityPerLocalUserMb: number;
driveCapacityPerRemoteUserMb: number;
enableHcaptcha: boolean;
hcaptchaSiteKey: string | null;
enableRecaptcha: boolean;
recaptchaSiteKey: string | null;
swPublickey: string | null;
maxNoteTextLength: number;
enableEmail: boolean;
enableTwitterIntegration: boolean;
enableGithubIntegration: boolean;
enableDiscordIntegration: boolean;
enableServiceWorker: boolean;
emojis: CustomEmoji[];
ads: {
id: ID;
ratio: number;
place: string;
url: string;
imageUrl: string;
}[];
};
```
**References:** [CustomEmoji](./calckey-js.entities.customemoji.md)<!-- -->, [ID](./calckey-js.entities.id.md)

View file

@ -0,0 +1,51 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md)
## entities namespace
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [Ad](./calckey-js.entities.ad.md) | |
| [Announcement](./calckey-js.entities.announcement.md) | |
| [Antenna](./calckey-js.entities.antenna.md) | |
| [App](./calckey-js.entities.app.md) | |
| [AuthSession](./calckey-js.entities.authsession.md) | |
| [Blocking](./calckey-js.entities.blocking.md) | |
| [Channel](./calckey-js.entities.channel.md) | |
| [Clip](./calckey-js.entities.clip.md) | |
| [CustomEmoji](./calckey-js.entities.customemoji.md) | |
| [DateString](./calckey-js.entities.datestring.md) | |
| [DetailedInstanceMetadata](./calckey-js.entities.detailedinstancemetadata.md) | |
| [DriveFile](./calckey-js.entities.drivefile.md) | |
| [DriveFolder](./calckey-js.entities.drivefolder.md) | |
| [Following](./calckey-js.entities.following.md) | |
| [FollowingFolloweePopulated](./calckey-js.entities.followingfolloweepopulated.md) | |
| [FollowingFollowerPopulated](./calckey-js.entities.followingfollowerpopulated.md) | |
| [FollowRequest](./calckey-js.entities.followrequest.md) | |
| [GalleryPost](./calckey-js.entities.gallerypost.md) | |
| [ID](./calckey-js.entities.id.md) | |
| [Instance](./calckey-js.entities.instance.md) | |
| [InstanceMetadata](./calckey-js.entities.instancemetadata.md) | |
| [LiteInstanceMetadata](./calckey-js.entities.liteinstancemetadata.md) | |
| [MeDetailed](./calckey-js.entities.medetailed.md) | |
| [MessagingMessage](./calckey-js.entities.messagingmessage.md) | |
| [Note](./calckey-js.entities.note.md) | |
| [NoteFavorite](./calckey-js.entities.notefavorite.md) | |
| [NoteReaction](./calckey-js.entities.notereaction.md) | |
| [Notification](./calckey-js.entities.notification.md) | |
| [OriginType](./calckey-js.entities.origintype.md) | |
| [Page](./calckey-js.entities.page.md) | |
| [PageEvent](./calckey-js.entities.pageevent.md) | |
| [ServerInfo](./calckey-js.entities.serverinfo.md) | |
| [Signin](./calckey-js.entities.signin.md) | |
| [Stats](./calckey-js.entities.stats.md) | |
| [User](./calckey-js.entities.user.md) | |
| [UserDetailed](./calckey-js.entities.userdetailed.md) | |
| [UserGroup](./calckey-js.entities.usergroup.md) | |
| [UserList](./calckey-js.entities.userlist.md) | |
| [UserLite](./calckey-js.entities.userlite.md) | |
| [UserSorting](./calckey-js.entities.usersorting.md) | |

View file

@ -0,0 +1,40 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [MeDetailed](./calckey-js.entities.medetailed.md)
## entities.MeDetailed type
**Signature:**
```typescript
export declare type MeDetailed = UserDetailed & {
avatarId: DriveFile["id"];
bannerId: DriveFile["id"];
autoAcceptFollowed: boolean;
alwaysMarkNsfw: boolean;
carefulBot: boolean;
emailNotificationTypes: string[];
hasPendingReceivedFollowRequest: boolean;
hasUnreadAnnouncement: boolean;
hasUnreadAntenna: boolean;
hasUnreadChannel: boolean;
hasUnreadMentions: boolean;
hasUnreadMessagingMessage: boolean;
hasUnreadNotification: boolean;
hasUnreadSpecifiedNotes: boolean;
hideOnlineStatus: boolean;
injectFeaturedNote: boolean;
integrations: Record<string, any>;
isDeleted: boolean;
isExplorable: boolean;
mutedWords: string[][];
mutingNotificationTypes: string[];
noCrawle: boolean;
preventAiLearning: boolean;
receiveAnnouncementEmail: boolean;
usePasswordLessLogin: boolean;
[other: string]: any;
};
```
**References:** [UserDetailed](./calckey-js.entities.userdetailed.md)<!-- -->, [DriveFile](./calckey-js.entities.drivefile.md)

View file

@ -0,0 +1,27 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [MessagingMessage](./calckey-js.entities.messagingmessage.md)
## entities.MessagingMessage type
**Signature:**
```typescript
export declare type MessagingMessage = {
id: ID;
createdAt: DateString;
file: DriveFile | null;
fileId: DriveFile["id"] | null;
isRead: boolean;
reads: User["id"][];
text: string | null;
user: User;
userId: User["id"];
recipient?: User | null;
recipientId: User["id"] | null;
group?: UserGroup | null;
groupId: UserGroup["id"] | null;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [DriveFile](./calckey-js.entities.drivefile.md)<!-- -->, [User](./calckey-js.entities.user.md)<!-- -->, [UserGroup](./calckey-js.entities.usergroup.md)

View file

@ -0,0 +1,51 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Note](./calckey-js.entities.note.md)
## entities.Note type
**Signature:**
```typescript
export declare type Note = {
id: ID;
createdAt: DateString;
text: string | null;
cw: string | null;
user: User;
userId: User["id"];
reply?: Note;
replyId: Note["id"];
renote?: Note;
renoteId: Note["id"];
files: DriveFile[];
fileIds: DriveFile["id"][];
visibility: "public" | "home" | "followers" | "specified";
visibleUserIds?: User["id"][];
localOnly?: boolean;
channel?: Channel["id"];
myReaction?: string;
reactions: Record<string, number>;
renoteCount: number;
repliesCount: number;
poll?: {
expiresAt: DateString | null;
multiple: boolean;
choices: {
isVoted: boolean;
text: string;
votes: number;
}[];
};
emojis: {
name: string;
url: string;
}[];
uri?: string;
url?: string;
updatedAt?: DateString;
isHidden?: boolean;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [User](./calckey-js.entities.user.md)<!-- -->, [Note](./calckey-js.entities.note.md)<!-- -->, [DriveFile](./calckey-js.entities.drivefile.md)<!-- -->, [Channel](./calckey-js.entities.channel.md)

View file

@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [NoteFavorite](./calckey-js.entities.notefavorite.md)
## entities.NoteFavorite type
**Signature:**
```typescript
export declare type NoteFavorite = {
id: ID;
createdAt: DateString;
noteId: Note["id"];
note: Note;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [Note](./calckey-js.entities.note.md)

View file

@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [NoteReaction](./calckey-js.entities.notereaction.md)
## entities.NoteReaction type
**Signature:**
```typescript
export declare type NoteReaction = {
id: ID;
createdAt: DateString;
user: UserLite;
type: string;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [UserLite](./calckey-js.entities.userlite.md)

View file

@ -0,0 +1,82 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Notification](./calckey-js.entities.notification.md)
## entities.Notification type
**Signature:**
```typescript
export declare type Notification = {
id: ID;
createdAt: DateString;
isRead: boolean;
} & (
| {
type: "reaction";
reaction: string;
user: User;
userId: User["id"];
note: Note;
}
| {
type: "reply";
user: User;
userId: User["id"];
note: Note;
}
| {
type: "renote";
user: User;
userId: User["id"];
note: Note;
}
| {
type: "quote";
user: User;
userId: User["id"];
note: Note;
}
| {
type: "mention";
user: User;
userId: User["id"];
note: Note;
}
| {
type: "pollVote";
user: User;
userId: User["id"];
note: Note;
}
| {
type: "follow";
user: User;
userId: User["id"];
}
| {
type: "followRequestAccepted";
user: User;
userId: User["id"];
}
| {
type: "receiveFollowRequest";
user: User;
userId: User["id"];
}
| {
type: "groupInvited";
invitation: UserGroup;
user: User;
userId: User["id"];
}
| {
type: "app";
header?: string | null;
body: string;
icon?: string | null;
}
);
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [User](./calckey-js.entities.user.md)<!-- -->, [Note](./calckey-js.entities.note.md)<!-- -->, [UserGroup](./calckey-js.entities.usergroup.md)

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [OriginType](./calckey-js.entities.origintype.md)
## entities.OriginType type
**Signature:**
```typescript
export declare type OriginType = "combined" | "local" | "remote";
```

View file

@ -0,0 +1,33 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Page](./calckey-js.entities.page.md)
## entities.Page type
**Signature:**
```typescript
export declare type Page = {
id: ID;
createdAt: DateString;
updatedAt: DateString;
userId: User["id"];
user: User;
content: Record<string, any>[];
variables: Record<string, any>[];
title: string;
name: string;
summary: string | null;
hideTitleWhenPinned: boolean;
alignCenter: boolean;
font: string;
script: string;
eyeCatchingImageId: DriveFile["id"] | null;
eyeCatchingImage: DriveFile | null;
attachedFiles: any;
likedCount: number;
isLiked?: boolean;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [User](./calckey-js.entities.user.md)<!-- -->, [DriveFile](./calckey-js.entities.drivefile.md)

View file

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [PageEvent](./calckey-js.entities.pageevent.md)
## entities.PageEvent type
**Signature:**
```typescript
export declare type PageEvent = {
pageId: Page["id"];
event: string;
var: any;
userId: User["id"];
user: User;
};
```
**References:** [Page](./calckey-js.entities.page.md)<!-- -->, [User](./calckey-js.entities.user.md)

View file

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [ServerInfo](./calckey-js.entities.serverinfo.md)
## entities.ServerInfo type
**Signature:**
```typescript
export declare type ServerInfo = {
machine: string;
cpu: {
model: string;
cores: number;
};
mem: {
total: number;
};
fs: {
total: number;
used: number;
};
};
```

View file

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Signin](./calckey-js.entities.signin.md)
## entities.Signin type
**Signature:**
```typescript
export declare type Signin = {
id: ID;
createdAt: DateString;
ip: string;
headers: Record<string, any>;
success: boolean;
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)

View file

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [Stats](./calckey-js.entities.stats.md)
## entities.Stats type
**Signature:**
```typescript
export declare type Stats = {
notesCount: number;
originalNotesCount: number;
usersCount: number;
originalUsersCount: number;
instances: number;
driveUsageLocal: number;
driveUsageRemote: number;
};
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [User](./calckey-js.entities.user.md)
## entities.User type
**Signature:**
```typescript
export declare type User = UserLite | UserDetailed;
```
**References:** [UserLite](./calckey-js.entities.userlite.md)<!-- -->, [UserDetailed](./calckey-js.entities.userdetailed.md)

View file

@ -0,0 +1,56 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [UserDetailed](./calckey-js.entities.userdetailed.md)
## entities.UserDetailed type
**Signature:**
```typescript
export declare type UserDetailed = UserLite & {
bannerBlurhash: string | null;
bannerColor: string | null;
bannerUrl: string | null;
birthday: string | null;
createdAt: DateString;
description: string | null;
ffVisibility: "public" | "followers" | "private";
fields: {
name: string;
value: string;
}[];
followersCount: number;
followingCount: number;
hasPendingFollowRequestFromYou: boolean;
hasPendingFollowRequestToYou: boolean;
isAdmin: boolean;
isBlocked: boolean;
isBlocking: boolean;
isBot: boolean;
isCat: boolean;
isFollowed: boolean;
isFollowing: boolean;
isLocked: boolean;
isModerator: boolean;
isMuted: boolean;
isRenoteMuted: boolean;
isSilenced: boolean;
isSuspended: boolean;
lang: string | null;
lastFetchedAt?: DateString;
location: string | null;
notesCount: number;
pinnedNoteIds: ID[];
pinnedNotes: Note[];
pinnedPage: Page | null;
pinnedPageId: string | null;
publicReactions: boolean;
securityKeys: boolean;
twoFactorEnabled: boolean;
updatedAt: DateString | null;
uri: string | null;
url: string | null;
};
```
**References:** [UserLite](./calckey-js.entities.userlite.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [ID](./calckey-js.entities.id.md)<!-- -->, [Note](./calckey-js.entities.note.md)<!-- -->, [Page](./calckey-js.entities.page.md)

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [UserGroup](./calckey-js.entities.usergroup.md)
## entities.UserGroup type
**Signature:**
```typescript
export declare type UserGroup = TODO;
```

View file

@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [UserList](./calckey-js.entities.userlist.md)
## entities.UserList type
**Signature:**
```typescript
export declare type UserList = {
id: ID;
createdAt: DateString;
name: string;
userIds: User["id"][];
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [DateString](./calckey-js.entities.datestring.md)<!-- -->, [User](./calckey-js.entities.user.md)

View file

@ -0,0 +1,35 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [UserLite](./calckey-js.entities.userlite.md)
## entities.UserLite type
**Signature:**
```typescript
export declare type UserLite = {
id: ID;
username: string;
host: string | null;
name: string;
onlineStatus: "online" | "active" | "offline" | "unknown";
avatarUrl: string;
avatarBlurhash: string;
alsoKnownAs: string[];
movedToUri: any;
emojis: {
name: string;
url: string;
}[];
instance?: {
name: Instance["name"];
softwareName: Instance["softwareName"];
softwareVersion: Instance["softwareVersion"];
iconUrl: Instance["iconUrl"];
faviconUrl: Instance["faviconUrl"];
themeColor: Instance["themeColor"];
};
};
```
**References:** [ID](./calckey-js.entities.id.md)<!-- -->, [Instance](./calckey-js.entities.instance.md)

View file

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [entities](./calckey-js.entities.md) &gt; [UserSorting](./calckey-js.entities.usersorting.md)
## entities.UserSorting type
**Signature:**
```typescript
export declare type UserSorting =
| "+follower"
| "-follower"
| "+createdAt"
| "-createdAt"
| "+updatedAt"
| "-updatedAt";
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [ffVisibility](./calckey-js.ffvisibility.md)
## ffVisibility variable
**Signature:**
```typescript
ffVisibility: readonly ["public", "followers", "private"]
```

View file

@ -0,0 +1,43 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md)
## calckey-js package
## Classes
| Class | Description |
| --- | --- |
| [Stream](./calckey-js.stream.md) | |
## Abstract Classes
| Abstract Class | Description |
| --- | --- |
| [ChannelConnection](./calckey-js.channelconnection.md) | |
## Namespaces
| Namespace | Description |
| --- | --- |
| [api](./calckey-js.api.md) | |
| [entities](./calckey-js.entities.md) | |
## Variables
| Variable | Description |
| --- | --- |
| [ffVisibility](./calckey-js.ffvisibility.md) | |
| [mutedNoteReasons](./calckey-js.mutednotereasons.md) | |
| [noteVisibilities](./calckey-js.notevisibilities.md) | |
| [notificationTypes](./calckey-js.notificationtypes.md) | |
| [permissions](./calckey-js.permissions.md) | |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [Acct](./calckey-js.acct.md) | |
| [Channels](./calckey-js.channels.md) | |
| [Endpoints](./calckey-js.endpoints.md) | |

View file

@ -0,0 +1,16 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [mutedNoteReasons](./calckey-js.mutednotereasons.md)
## mutedNoteReasons variable
**Signature:**
```typescript
mutedNoteReasons: readonly [
"word",
"manual",
"spam",
"other",
]
```

View file

@ -0,0 +1,16 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [noteVisibilities](./calckey-js.notevisibilities.md)
## noteVisibilities variable
**Signature:**
```typescript
noteVisibilities: readonly [
"public",
"home",
"followers",
"specified",
]
```

View file

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [notificationTypes](./calckey-js.notificationtypes.md)
## notificationTypes variable
**Signature:**
```typescript
notificationTypes: readonly [
"follow",
"mention",
"reply",
"renote",
"quote",
"reaction",
"pollVote",
"pollEnded",
"receiveFollowRequest",
"followRequestAccepted",
"groupInvited",
"app",
]
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [permissions](./calckey-js.permissions.md)
## permissions variable
**Signature:**
```typescript
permissions: string[]
```

View file

@ -0,0 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [(constructor)](./calckey-js.stream._constructor_.md)
## Stream.(constructor)
Constructs a new instance of the `Stream` class
**Signature:**
```typescript
constructor(
origin: string,
user: {
token: string;
} | null,
options?: {
WebSocket?: any;
},
);
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| origin | string | |
| user | { token: string; } \| null | |
| options | { WebSocket?: any; } | _(Optional)_ |

View file

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [close](./calckey-js.stream.close.md)
## Stream.close() method
**Signature:**
```typescript
close(): void;
```
**Returns:**
void

View file

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [disconnectToChannel](./calckey-js.stream.disconnecttochannel.md)
## Stream.disconnectToChannel() method
**Signature:**
```typescript
disconnectToChannel(connection: NonSharedConnection): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| connection | NonSharedConnection | |
**Returns:**
void

View file

@ -0,0 +1,36 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md)
## Stream class
**Signature:**
```typescript
export default class Stream extends EventEmitter<StreamEvents>
```
**Extends:** EventEmitter&lt;StreamEvents&gt;
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(origin, user, options)](./calckey-js.stream._constructor_.md) | | Constructs a new instance of the <code>Stream</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [state](./calckey-js.stream.state.md) | | "initializing" \| "reconnecting" \| "connected" | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [close()](./calckey-js.stream.close.md) | | |
| [disconnectToChannel(connection)](./calckey-js.stream.disconnecttochannel.md) | | |
| [removeSharedConnection(connection)](./calckey-js.stream.removesharedconnection.md) | | |
| [removeSharedConnectionPool(pool)](./calckey-js.stream.removesharedconnectionpool.md) | | |
| [send(typeOrPayload, payload)](./calckey-js.stream.send.md) | | |
| [useChannel(channel, params, name)](./calckey-js.stream.usechannel.md) | | |

View file

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [removeSharedConnection](./calckey-js.stream.removesharedconnection.md)
## Stream.removeSharedConnection() method
**Signature:**
```typescript
removeSharedConnection(connection: SharedConnection): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| connection | SharedConnection | |
**Returns:**
void

View file

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [removeSharedConnectionPool](./calckey-js.stream.removesharedconnectionpool.md)
## Stream.removeSharedConnectionPool() method
**Signature:**
```typescript
removeSharedConnectionPool(pool: Pool): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| pool | Pool | |
**Returns:**
void

View file

@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [send](./calckey-js.stream.send.md)
## Stream.send() method
**Signature:**
```typescript
send(typeOrPayload: any, payload?: any): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| typeOrPayload | any | |
| payload | any | _(Optional)_ |
**Returns:**
void

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [state](./calckey-js.stream.state.md)
## Stream.state property
**Signature:**
```typescript
state: "initializing" | "reconnecting" | "connected";
```

View file

@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [calckey-js](./calckey-js.md) &gt; [Stream](./calckey-js.stream.md) &gt; [useChannel](./calckey-js.stream.usechannel.md)
## Stream.useChannel() method
**Signature:**
```typescript
useChannel<C extends keyof Channels>(
channel: C,
params?: Channels[C]["params"],
name?: string,
): Connection<Channels[C]>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| channel | C | |
| params | [Channels](./calckey-js.channels.md)<!-- -->\[C\]\["params"\] | _(Optional)_ |
| name | string | _(Optional)_ |
**Returns:**
[Connection](./calckey-js.channelconnection.md)<!-- -->&lt;[Channels](./calckey-js.channels.md)<!-- -->\[C\]&gt;

View file

@ -0,0 +1,12 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md)
## API Reference
## Packages
| Package | Description |
| --- | --- |
| [calckey-js](./calckey-js.md) | |

File diff suppressed because it is too large Load diff

View file

@ -1,16 +1,18 @@
{ {
"name": "calckey-js", "name": "calckey-js",
"version": "0.0.22", "version": "0.0.23",
"description": "Calckey SDK for JavaScript", "description": "Calckey SDK for JavaScript",
"main": "./built/index.js", "main": "./built/index.js",
"types": "./built/index.d.ts", "types": "./built/index.d.ts",
"scripts": { "scripts": {
"build": "tsc", "build": "pnpm swc src -d built -D && pnpm tsd",
"render": "pnpm run build && pnpm run api && pnpm run api-prod && cp temp/calckey-js.api.json etc/ && pnpm run api-doc",
"tsd": "tsd", "tsd": "tsd",
"api": "pnpm api-extractor run --local --verbose", "api": "pnpm api-extractor run --local --verbose",
"api-prod": "pnpm api-extractor run --verbose", "api-prod": "pnpm api-extractor run --verbose",
"typecheck": "tsc --noEmit", "api-doc": "pnpm api-documenter markdown -i ./etc/",
"lint": "pnpm typecheck && pnpm rome check \"src/*.ts\"", "lint": "pnpm rome check --apply * && pnpm rome check --apply 'src/*.ts'",
"format": "pnpm rome format --write '*' ; pnpm rome format --write '**/*.ts'",
"jest": "jest --coverage --detectOpenHandles", "jest": "jest --coverage --detectOpenHandles",
"test": "pnpm jest && pnpm tsd" "test": "pnpm jest && pnpm tsd"
}, },
@ -19,26 +21,30 @@
"url": "https://codeberg.org/calckey/calckey.js" "url": "https://codeberg.org/calckey/calckey.js"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.19.3", "@microsoft/api-extractor": "^7.36.0",
"@microsoft/api-documenter": "^7.22.21",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.62",
"@types/jest": "^27.4.0", "@types/jest": "^27.4.0",
"@types/node": "17.0.5", "@types/node": "20.3.1",
"@typescript-eslint/eslint-plugin": "5.8.1",
"@typescript-eslint/parser": "5.8.1",
"eslint": "8.6.0",
"jest": "^27.4.5", "jest": "^27.4.5",
"jest-fetch-mock": "^3.0.3", "jest-fetch-mock": "^3.0.3",
"jest-websocket-mock": "^2.2.1", "jest-websocket-mock": "^2.2.1",
"mock-socket": "^9.0.8", "mock-socket": "^9.0.8",
"ts-jest": "^27.1.2", "ts-jest": "^27.1.2",
"ts-node": "10.4.0", "ts-node": "10.4.0",
"tsd": "^0.19.1", "tsd": "^0.28.1",
"typescript": "4.5.4" "typescript": "5.1.3"
}, },
"files": ["built"], "files": [
"built"
],
"dependencies": { "dependencies": {
"autobind-decorator": "^2.4.0",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"reconnecting-websocket": "^4.4.0", "reconnecting-websocket": "^4.4.0",
"semver": "^7.3.8" "semver": "^7.3.8"
},
"optionalDependencies": {
"@swc/core-android-arm64": "1.3.11"
} }
} }

View file

@ -1,8 +1,26 @@
import autobind from "autobind-decorator";
import { EventEmitter } from "eventemitter3"; import { EventEmitter } from "eventemitter3";
import ReconnectingWebsocket from "reconnecting-websocket"; import ReconnectingWebsocket from "reconnecting-websocket";
import { BroadcastEvents, Channels } from "./streaming.types"; import { BroadcastEvents, Channels } from "./streaming.types";
function autobind(instance: any): void {
const prototype = Object.getPrototypeOf(instance);
const propertyNames = Object.getOwnPropertyNames(prototype);
for (const key of propertyNames) {
const descriptor = Object.getOwnPropertyDescriptor(prototype, key);
if (typeof descriptor?.value === "function" && key !== "constructor") {
Object.defineProperty(instance, key, {
value: instance[key].bind(instance),
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
});
}
}
}
export function urlQuery( export function urlQuery(
obj: Record<string, string | number | boolean | undefined>, obj: Record<string, string | number | boolean | undefined>,
): string { ): string {
@ -45,6 +63,7 @@ export default class Stream extends EventEmitter<StreamEvents> {
}, },
) { ) {
super(); super();
autobind(this);
options = options || {}; options = options || {};
const query = urlQuery({ const query = urlQuery({
@ -71,12 +90,10 @@ export default class Stream extends EventEmitter<StreamEvents> {
this.stream.addEventListener("message", this.onMessage); this.stream.addEventListener("message", this.onMessage);
} }
@autobind
private genId(): string { private genId(): string {
return (++this.idCounter).toString(); return (++this.idCounter).toString();
} }
@autobind
public useChannel<C extends keyof Channels>( public useChannel<C extends keyof Channels>(
channel: C, channel: C,
params?: Channels[C]["params"], params?: Channels[C]["params"],
@ -89,7 +106,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
} }
} }
@autobind
private useSharedConnection<C extends keyof Channels>( private useSharedConnection<C extends keyof Channels>(
channel: C, channel: C,
name?: string, name?: string,
@ -106,21 +122,18 @@ export default class Stream extends EventEmitter<StreamEvents> {
return connection; return connection;
} }
@autobind
public removeSharedConnection(connection: SharedConnection): void { public removeSharedConnection(connection: SharedConnection): void {
this.sharedConnections = this.sharedConnections.filter( this.sharedConnections = this.sharedConnections.filter(
(c) => c !== connection, (c) => c !== connection,
); );
} }
@autobind
public removeSharedConnectionPool(pool: Pool): void { public removeSharedConnectionPool(pool: Pool): void {
this.sharedConnectionPools = this.sharedConnectionPools.filter( this.sharedConnectionPools = this.sharedConnectionPools.filter(
(p) => p !== pool, (p) => p !== pool,
); );
} }
@autobind
private connectToChannel<C extends keyof Channels>( private connectToChannel<C extends keyof Channels>(
channel: C, channel: C,
params: Channels[C]["params"], params: Channels[C]["params"],
@ -135,7 +148,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
return connection; return connection;
} }
@autobind
public disconnectToChannel(connection: NonSharedConnection): void { public disconnectToChannel(connection: NonSharedConnection): void {
this.nonSharedConnections = this.nonSharedConnections.filter( this.nonSharedConnections = this.nonSharedConnections.filter(
(c) => c !== connection, (c) => c !== connection,
@ -145,7 +157,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Callback of when open connection * Callback of when open connection
*/ */
@autobind
private onOpen(): void { private onOpen(): void {
const isReconnect = this.state === "reconnecting"; const isReconnect = this.state === "reconnecting";
@ -162,7 +173,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Callback of when close connection * Callback of when close connection
*/ */
@autobind
private onClose(): void { private onClose(): void {
if (this.state === "connected") { if (this.state === "connected") {
this.state = "reconnecting"; this.state = "reconnecting";
@ -173,7 +183,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Callback of when received a message from connection * Callback of when received a message from connection
*/ */
@autobind
private onMessage(message: { data: string }): void { private onMessage(message: { data: string }): void {
const { type, body } = JSON.parse(message.data); const { type, body } = JSON.parse(message.data);
@ -203,7 +212,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Send a message to connection * Send a message to connection
*/ */
@autobind
public send(typeOrPayload: any, payload?: any): void { public send(typeOrPayload: any, payload?: any): void {
const data = const data =
payload === undefined payload === undefined
@ -219,7 +227,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Close this connection * Close this connection
*/ */
@autobind
public close(): void { public close(): void {
this.stream.close(); this.stream.close();
} }
@ -243,12 +250,10 @@ class Pool {
this.stream.on("_disconnected_", this.onStreamDisconnected); this.stream.on("_disconnected_", this.onStreamDisconnected);
} }
@autobind
private onStreamDisconnected(): void { private onStreamDisconnected(): void {
this.isConnected = false; this.isConnected = false;
} }
@autobind
public inc(): void { public inc(): void {
if (this.users === 0 && !this.isConnected) { if (this.users === 0 && !this.isConnected) {
this.connect(); this.connect();
@ -263,7 +268,6 @@ class Pool {
} }
} }
@autobind
public dec(): void { public dec(): void {
this.users--; this.users--;
@ -277,7 +281,6 @@ class Pool {
} }
} }
@autobind
public connect(): void { public connect(): void {
if (this.isConnected) return; if (this.isConnected) return;
this.isConnected = true; this.isConnected = true;
@ -287,7 +290,6 @@ class Pool {
}); });
} }
@autobind
private disconnect(): void { private disconnect(): void {
this.stream.off("_disconnected_", this.onStreamDisconnected); this.stream.off("_disconnected_", this.onStreamDisconnected);
this.stream.send("disconnect", { id: this.id }); this.stream.send("disconnect", { id: this.id });
@ -314,7 +316,6 @@ export abstract class Connection<
this.name = name; this.name = name;
} }
@autobind
public send<T extends keyof Channel["receives"]>( public send<T extends keyof Channel["receives"]>(
type: T, type: T,
body: Channel["receives"][T], body: Channel["receives"][T],
@ -347,7 +348,6 @@ class SharedConnection<
this.pool.inc(); this.pool.inc();
} }
@autobind
public dispose(): void { public dispose(): void {
this.pool.dec(); this.pool.dec();
this.removeAllListeners(); this.removeAllListeners();
@ -375,7 +375,6 @@ class NonSharedConnection<
this.connect(); this.connect();
} }
@autobind
public connect(): void { public connect(): void {
this.stream.send("connect", { this.stream.send("connect", {
channel: this.channel, channel: this.channel,
@ -384,7 +383,6 @@ class NonSharedConnection<
}); });
} }
@autobind
public dispose(): void { public dispose(): void {
this.removeAllListeners(); this.removeAllListeners();
this.stream.send("disconnect", { id: this.id }); this.stream.send("disconnect", { id: this.id });

View file

@ -98,7 +98,7 @@ export type Channels = {
note: (payload: Note) => void; note: (payload: Note) => void;
}; };
receives: null; receives: null;
} };
messaging: { messaging: {
params: { params: {
otherparty?: User["id"] | null; otherparty?: User["id"] | null;

View file

@ -4,7 +4,7 @@ import * as Misskey from "../src";
describe("API", () => { describe("API", () => {
test("success", async () => { test("success", async () => {
const cli = new Misskey.api.APIClient({ const cli = new Misskey.api.APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
const res = await cli.request("meta", { detail: true }); const res = await cli.request("meta", { detail: true });
@ -13,7 +13,7 @@ describe("API", () => {
test("conditional respose type (meta)", async () => { test("conditional respose type (meta)", async () => {
const cli = new Misskey.api.APIClient({ const cli = new Misskey.api.APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -35,7 +35,7 @@ describe("API", () => {
test("conditional respose type (users/show)", async () => { test("conditional respose type (users/show)", async () => {
const cli = new Misskey.api.APIClient({ const cli = new Misskey.api.APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });

View file

@ -3,7 +3,7 @@ import * as Misskey from "../src";
describe("Streaming", () => { describe("Streaming", () => {
test("emit type", async () => { test("emit type", async () => {
const stream = new Misskey.Stream("https://misskey.test", { const stream = new Misskey.Stream("https://calckey.test", {
token: "TOKEN", token: "TOKEN",
}); });
const mainChannel = stream.useChannel("main"); const mainChannel = stream.useChannel("main");
@ -13,7 +13,7 @@ describe("Streaming", () => {
}); });
test("params type", async () => { test("params type", async () => {
const stream = new Misskey.Stream("https://misskey.test", { const stream = new Misskey.Stream("https://calckey.test", {
token: "TOKEN", token: "TOKEN",
}); });
// TODO: 「stream.useChannel の第二引数として受け入れる型が // TODO: 「stream.useChannel の第二引数として受け入れる型が

View file

@ -5,7 +5,7 @@ enableFetchMocks();
function getFetchCall(call: any[]) { function getFetchCall(call: any[]) {
const { body, method } = call[1]; const { body, method } = call[1];
if (body != null && typeof body != "string") { if (body != null && typeof body !== "string") {
throw new Error("invalid body"); throw new Error("invalid body");
} }
return { return {
@ -20,7 +20,7 @@ describe("API", () => {
fetchMock.resetMocks(); fetchMock.resetMocks();
fetchMock.mockResponse(async (req) => { fetchMock.mockResponse(async (req) => {
const body = await req.json(); const body = await req.json();
if (req.method == "POST" && req.url == "https://misskey.test/api/i") { if (req.method === "POST" && req.url === "https://calckey.test/api/i") {
if (body.i === "TOKEN") { if (body.i === "TOKEN") {
return JSON.stringify({ id: "foo" }); return JSON.stringify({ id: "foo" });
} else { } else {
@ -32,7 +32,7 @@ describe("API", () => {
}); });
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -43,7 +43,7 @@ describe("API", () => {
}); });
expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({ expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({
url: "https://misskey.test/api/i", url: "https://calckey.test/api/i",
method: "POST", method: "POST",
body: { i: "TOKEN" }, body: { i: "TOKEN" },
}); });
@ -54,8 +54,8 @@ describe("API", () => {
fetchMock.mockResponse(async (req) => { fetchMock.mockResponse(async (req) => {
const body = await req.json(); const body = await req.json();
if ( if (
req.method == "POST" && req.method === "POST" &&
req.url == "https://misskey.test/api/notes/show" req.url === "https://calckey.test/api/notes/show"
) { ) {
if (body.i === "TOKEN" && body.noteId === "aaaaa") { if (body.i === "TOKEN" && body.noteId === "aaaaa") {
return JSON.stringify({ id: "foo" }); return JSON.stringify({ id: "foo" });
@ -68,7 +68,7 @@ describe("API", () => {
}); });
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -79,7 +79,7 @@ describe("API", () => {
}); });
expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({ expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({
url: "https://misskey.test/api/notes/show", url: "https://calckey.test/api/notes/show",
method: "POST", method: "POST",
body: { i: "TOKEN", noteId: "aaaaa" }, body: { i: "TOKEN", noteId: "aaaaa" },
}); });
@ -89,8 +89,8 @@ describe("API", () => {
fetchMock.resetMocks(); fetchMock.resetMocks();
fetchMock.mockResponse(async (req) => { fetchMock.mockResponse(async (req) => {
if ( if (
req.method == "POST" && req.method === "POST" &&
req.url == "https://misskey.test/api/reset-password" req.url === "https://calckey.test/api/reset-password"
) { ) {
return { status: 204 }; return { status: 204 };
} else { } else {
@ -99,7 +99,7 @@ describe("API", () => {
}); });
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -111,7 +111,7 @@ describe("API", () => {
expect(res).toEqual(null); expect(res).toEqual(null);
expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({ expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({
url: "https://misskey.test/api/reset-password", url: "https://calckey.test/api/reset-password",
method: "POST", method: "POST",
body: { i: "TOKEN", token: "aaa", password: "aaa" }, body: { i: "TOKEN", token: "aaa", password: "aaa" },
}); });
@ -121,7 +121,7 @@ describe("API", () => {
fetchMock.resetMocks(); fetchMock.resetMocks();
fetchMock.mockResponse(async (req) => { fetchMock.mockResponse(async (req) => {
const body = await req.json(); const body = await req.json();
if (req.method == "POST" && req.url == "https://misskey.test/api/i") { if (req.method === "POST" && req.url === "https://calckey.test/api/i") {
if (typeof body.i === "string") { if (typeof body.i === "string") {
return JSON.stringify({ id: "foo" }); return JSON.stringify({ id: "foo" });
} else { } else {
@ -143,7 +143,7 @@ describe("API", () => {
try { try {
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -172,7 +172,7 @@ describe("API", () => {
try { try {
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -189,7 +189,7 @@ describe("API", () => {
try { try {
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });
@ -210,7 +210,7 @@ describe("API", () => {
try { try {
const cli = new APIClient({ const cli = new APIClient({
origin: "https://misskey.test", origin: "https://calckey.test",
credential: "TOKEN", credential: "TOKEN",
}); });

View file

@ -3,8 +3,8 @@ import Stream from "../src/streaming";
describe("Streaming", () => { describe("Streaming", () => {
test("useChannel", async () => { test("useChannel", async () => {
const server = new WS("wss://misskey.test/streaming"); const server = new WS("wss://calckey.test/streaming");
const stream = new Stream("https://misskey.test", { token: "TOKEN" }); const stream = new Stream("https://calckey.test", { token: "TOKEN" });
const mainChannelReceived: any[] = []; const mainChannelReceived: any[] = [];
const main = stream.useChannel("main"); const main = stream.useChannel("main");
main.on("meUpdated", (payload) => { main.on("meUpdated", (payload) => {
@ -44,8 +44,8 @@ describe("Streaming", () => {
}); });
test("useChannel with parameters", async () => { test("useChannel with parameters", async () => {
const server = new WS("wss://misskey.test/streaming"); const server = new WS("wss://calckey.test/streaming");
const stream = new Stream("https://misskey.test", { token: "TOKEN" }); const stream = new Stream("https://calckey.test", { token: "TOKEN" });
const messagingChannelReceived: any[] = []; const messagingChannelReceived: any[] = [];
const messaging = stream.useChannel("messaging", { otherparty: "aaa" }); const messaging = stream.useChannel("messaging", { otherparty: "aaa" });
messaging.on("message", (payload) => { messaging.on("message", (payload) => {
@ -86,8 +86,8 @@ describe("Streaming", () => {
}); });
test("ちゃんとチャンネルごとにidが異なる", async () => { test("ちゃんとチャンネルごとにidが異なる", async () => {
const server = new WS("wss://misskey.test/streaming"); const server = new WS("wss://calckey.test/streaming");
const stream = new Stream("https://misskey.test", { token: "TOKEN" }); const stream = new Stream("https://calckey.test", { token: "TOKEN" });
stream.useChannel("messaging", { otherparty: "aaa" }); stream.useChannel("messaging", { otherparty: "aaa" });
stream.useChannel("messaging", { otherparty: "bbb" }); stream.useChannel("messaging", { otherparty: "bbb" });
@ -111,8 +111,8 @@ describe("Streaming", () => {
}); });
test("Connection#send", async () => { test("Connection#send", async () => {
const server = new WS("wss://misskey.test/streaming"); const server = new WS("wss://calckey.test/streaming");
const stream = new Stream("https://misskey.test", { token: "TOKEN" }); const stream = new Stream("https://calckey.test", { token: "TOKEN" });
const messaging = stream.useChannel("messaging", { otherparty: "aaa" }); const messaging = stream.useChannel("messaging", { otherparty: "aaa" });
messaging.send("read", { id: "aaa" }); messaging.send("read", { id: "aaa" });
@ -136,8 +136,8 @@ describe("Streaming", () => {
}); });
test("Connection#dispose", async () => { test("Connection#dispose", async () => {
const server = new WS("wss://misskey.test/streaming"); const server = new WS("wss://calckey.test/streaming");
const stream = new Stream("https://misskey.test", { token: "TOKEN" }); const stream = new Stream("https://calckey.test", { token: "TOKEN" });
const mainChannelReceived: any[] = []; const mainChannelReceived: any[] = [];
const main = stream.useChannel("main"); const main = stream.useChannel("main");
main.on("meUpdated", (payload) => { main.on("meUpdated", (payload) => {

File diff suppressed because it is too large Load diff