Initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
@@ -0,0 +1,113 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# App
|
||||
temp
|
||||
# built
|
||||
|
||||
# Yarn
|
||||
.yarn/*
|
||||
.pnp.cjs
|
||||
.pnp.loader.mjs
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"dynamicImport": true,
|
||||
"decorators": true
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true,
|
||||
"decoratorMetadata": true
|
||||
},
|
||||
"target": "es2022"
|
||||
},
|
||||
"minify": false,
|
||||
"module": {
|
||||
"type": "commonjs",
|
||||
"strict": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# 0.0.14
|
||||
- remove needless Object.freeze()
|
||||
|
||||
# 0.0.13
|
||||
- expose ChannelConnection and Channels types
|
||||
|
||||
# 0.0.12
|
||||
- fix a bug that cannot connect to streaming
|
||||
|
||||
# 0.0.11
|
||||
- update user type
|
||||
- add missing main stream types
|
||||
|
||||
# 0.0.10
|
||||
- add consts
|
||||
|
||||
# 0.0.9
|
||||
- add list of api permission
|
||||
- Update Note type
|
||||
|
||||
# 0.0.8
|
||||
- add type definition for `messagingMessage` event to main stream channel
|
||||
- Update Note type
|
||||
|
||||
# 0.0.7
|
||||
- Notificationsの型を修正
|
||||
- MessagingMessageの型を修正
|
||||
- UserLiteの型を修正
|
||||
- apiでネイティブfetchを格納する際に無名関数でラップするように
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2022 syuilo and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,5 @@
|
||||
# iceshrimp-sdk
|
||||
|
||||
Fork of Misskey.js for Iceshrimp
|
||||
|
||||
To fully build, run `pnpm i && pnpm run render`.
|
||||
@@ -0,0 +1,364 @@
|
||||
/**
|
||||
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
|
||||
*/
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||
|
||||
/**
|
||||
* Optionally specifies another JSON config file that this file extends from. This provides a way for
|
||||
* standard settings to be shared across multiple projects.
|
||||
*
|
||||
* If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
|
||||
* the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
|
||||
* resolved using NodeJS require().
|
||||
*
|
||||
* SUPPORTED TOKENS: none
|
||||
* DEFAULT VALUE: ""
|
||||
*/
|
||||
// "extends": "./shared/api-extractor-base.json"
|
||||
// "extends": "my-package/include/api-extractor-base.json"
|
||||
|
||||
/**
|
||||
* Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
|
||||
* typically contains the tsconfig.json and package.json config files, but the path is user-defined.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting.
|
||||
*
|
||||
* The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
|
||||
* parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
|
||||
* that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
|
||||
* will be reported.
|
||||
*
|
||||
* SUPPORTED TOKENS: <lookup>
|
||||
* DEFAULT VALUE: "<lookup>"
|
||||
*/
|
||||
// "projectFolder": "..",
|
||||
|
||||
/**
|
||||
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
|
||||
* analyzes the symbols exported by this module.
|
||||
*
|
||||
* The file extension must be ".d.ts" and not ".ts".
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
*/
|
||||
"mainEntryPointFilePath": "<projectFolder>/built/index.d.ts",
|
||||
|
||||
/**
|
||||
* A list of NPM package names whose exports should be treated as part of this package.
|
||||
*
|
||||
* For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
|
||||
* and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
|
||||
* of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
|
||||
* imports library2. To avoid this, we can specify:
|
||||
*
|
||||
* "bundledPackages": [ "library2" ],
|
||||
*
|
||||
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
|
||||
* local files for library1.
|
||||
*/
|
||||
"bundledPackages": [],
|
||||
|
||||
/**
|
||||
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
|
||||
*/
|
||||
"compiler": {
|
||||
/**
|
||||
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* Note: This setting will be ignored if "overrideTsconfig" is used.
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
|
||||
*/
|
||||
// "tsconfigFilePath": "<projectFolder>/tsconfig.json",
|
||||
/**
|
||||
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
|
||||
* The object must conform to the TypeScript tsconfig schema:
|
||||
*
|
||||
* http://json.schemastore.org/tsconfig
|
||||
*
|
||||
* If omitted, then the tsconfig.json file will be read from the "projectFolder".
|
||||
*
|
||||
* DEFAULT VALUE: no overrideTsconfig section
|
||||
*/
|
||||
// "overrideTsconfig": {
|
||||
// . . .
|
||||
// }
|
||||
/**
|
||||
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
|
||||
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
|
||||
* dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
|
||||
* for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
|
||||
*
|
||||
* DEFAULT VALUE: false
|
||||
*/
|
||||
// "skipLibCheck": true,
|
||||
},
|
||||
|
||||
/**
|
||||
* Configures how the API report file (*.api.md) will be generated.
|
||||
*/
|
||||
"apiReport": {
|
||||
/**
|
||||
* (REQUIRED) Whether to generate an API report.
|
||||
*/
|
||||
"enabled": true
|
||||
|
||||
/**
|
||||
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
|
||||
* a full file path.
|
||||
*
|
||||
* The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
|
||||
*
|
||||
* SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<unscopedPackageName>.api.md"
|
||||
*/
|
||||
// "reportFileName": "<unscopedPackageName>.api.md",
|
||||
|
||||
/**
|
||||
* Specifies the folder where the API report file is written. The file name portion is determined by
|
||||
* the "reportFileName" setting.
|
||||
*
|
||||
* The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
|
||||
* e.g. for an API review.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<projectFolder>/etc/"
|
||||
*/
|
||||
// "reportFolder": "<projectFolder>/etc/",
|
||||
|
||||
/**
|
||||
* Specifies the folder where the temporary report file is written. The file name portion is determined by
|
||||
* the "reportFileName" setting.
|
||||
*
|
||||
* After the temporary file is written to disk, it is compared with the file in the "reportFolder".
|
||||
* If they are different, a production build will fail.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<projectFolder>/temp/"
|
||||
*/
|
||||
// "reportTempFolder": "<projectFolder>/temp/"
|
||||
},
|
||||
|
||||
/**
|
||||
* Configures how the doc model file (*.api.json) will be generated.
|
||||
*/
|
||||
"docModel": {
|
||||
/**
|
||||
* (REQUIRED) Whether to generate a doc model file.
|
||||
*/
|
||||
"enabled": true
|
||||
|
||||
/**
|
||||
* The output path for the doc model file. The file extension should be ".api.json".
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
|
||||
*/
|
||||
// "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
|
||||
},
|
||||
|
||||
/**
|
||||
* Configures how the .d.ts rollup file will be generated.
|
||||
*/
|
||||
"dtsRollup": {
|
||||
/**
|
||||
* (REQUIRED) Whether to generate the .d.ts rollup file.
|
||||
*/
|
||||
"enabled": false
|
||||
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
|
||||
* This file will include all declarations that are exported by the main entry point.
|
||||
*
|
||||
* If the path is an empty string, then this file will not be written.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
|
||||
*/
|
||||
// "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
|
||||
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
|
||||
* This file will include only declarations that are marked as "@public" or "@beta".
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: ""
|
||||
*/
|
||||
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
|
||||
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
|
||||
* This file will include only declarations that are marked as "@public".
|
||||
*
|
||||
* If the path is an empty string, then this file will not be written.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: ""
|
||||
*/
|
||||
// "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
|
||||
|
||||
/**
|
||||
* When a declaration is trimmed, by default it will be replaced by a code comment such as
|
||||
* "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
|
||||
* declaration completely.
|
||||
*
|
||||
* DEFAULT VALUE: false
|
||||
*/
|
||||
// "omitTrimmingComments": true
|
||||
},
|
||||
|
||||
/**
|
||||
* Configures how the tsdoc-metadata.json file will be generated.
|
||||
*/
|
||||
"tsdocMetadata": {
|
||||
/**
|
||||
* Whether to generate the tsdoc-metadata.json file.
|
||||
*
|
||||
* DEFAULT VALUE: true
|
||||
*/
|
||||
// "enabled": true,
|
||||
/**
|
||||
* Specifies where the TSDoc metadata file should be written.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as "<projectFolder>".
|
||||
*
|
||||
* The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
|
||||
* "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
|
||||
* falls back to "tsdoc-metadata.json" in the package folder.
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<lookup>"
|
||||
*/
|
||||
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
|
||||
},
|
||||
|
||||
/**
|
||||
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
|
||||
* will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
|
||||
* To use the OS's default newline kind, specify "os".
|
||||
*
|
||||
* DEFAULT VALUE: "crlf"
|
||||
*/
|
||||
// "newlineKind": "crlf",
|
||||
|
||||
/**
|
||||
* Configures how API Extractor reports error and warning messages produced during analysis.
|
||||
*
|
||||
* There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
|
||||
*/
|
||||
"messages": {
|
||||
/**
|
||||
* Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
|
||||
* the input .d.ts files.
|
||||
*
|
||||
* TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
|
||||
*
|
||||
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
|
||||
*/
|
||||
"compilerMessageReporting": {
|
||||
/**
|
||||
* Configures the default routing for messages that don't match an explicit rule in this table.
|
||||
*/
|
||||
"default": {
|
||||
/**
|
||||
* Specifies whether the message should be written to the the tool's output log. Note that
|
||||
* the "addToApiReportFile" property may supersede this option.
|
||||
*
|
||||
* Possible values: "error", "warning", "none"
|
||||
*
|
||||
* Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
|
||||
* and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
|
||||
* the "--local" option), the warning is displayed but the build will not fail.
|
||||
*
|
||||
* DEFAULT VALUE: "warning"
|
||||
*/
|
||||
"logLevel": "warning"
|
||||
|
||||
/**
|
||||
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
|
||||
* then the message will be written inside that file; otherwise, the message is instead logged according to
|
||||
* the "logLevel" option.
|
||||
*
|
||||
* DEFAULT VALUE: false
|
||||
*/
|
||||
// "addToApiReportFile": false
|
||||
}
|
||||
|
||||
// "TS2551": {
|
||||
// "logLevel": "warning",
|
||||
// "addToApiReportFile": true
|
||||
// },
|
||||
//
|
||||
// . . .
|
||||
},
|
||||
|
||||
/**
|
||||
* Configures handling of messages reported by API Extractor during its analysis.
|
||||
*
|
||||
* API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
|
||||
*
|
||||
* DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
|
||||
*/
|
||||
"extractorMessageReporting": {
|
||||
"default": {
|
||||
"logLevel": "none"
|
||||
// "addToApiReportFile": false
|
||||
}
|
||||
|
||||
// "ae-extra-release-tag": {
|
||||
// "logLevel": "warning",
|
||||
// "addToApiReportFile": true
|
||||
// },
|
||||
//
|
||||
// . . .
|
||||
},
|
||||
|
||||
/**
|
||||
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
|
||||
*
|
||||
* TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
|
||||
*
|
||||
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
|
||||
*/
|
||||
"tsdocMessageReporting": {
|
||||
"default": {
|
||||
"logLevel": "warning"
|
||||
// "addToApiReportFile": false
|
||||
}
|
||||
|
||||
// "tsdoc-link-tag-unescaped-text": {
|
||||
// "logLevel": "warning",
|
||||
// "addToApiReportFile": true
|
||||
// },
|
||||
//
|
||||
// . . .
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
codecov:
|
||||
token: d55e1270-f20a-4727-aa05-2bd57793315a
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Acct](./iceshrimp-sdk.acct.md)
|
||||
|
||||
## Acct type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Acct = {
|
||||
username: string;
|
||||
host: string | null;
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIClient](./iceshrimp-sdk.api.apiclient.md) > [(constructor)](./iceshrimp-sdk.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](./iceshrimp-sdk.api.apiclient.md)<!-- -->\["origin"\]; credential?: [APIClient](./iceshrimp-sdk.api.apiclient.md)<!-- -->\["credential"\]; fetch?: [APIClient](./iceshrimp-sdk.api.apiclient.md)<!-- -->\["fetch"\] \| null \| undefined; } | |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIClient](./iceshrimp-sdk.api.apiclient.md) > [credential](./iceshrimp-sdk.api.apiclient.credential.md)
|
||||
|
||||
## api.APIClient.credential property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
credential: string | null | undefined;
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIClient](./iceshrimp-sdk.api.apiclient.md) > [fetch](./iceshrimp-sdk.api.apiclient.fetch.md)
|
||||
|
||||
## api.APIClient.fetch property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
fetch: FetchLike;
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIClient](./iceshrimp-sdk.api.apiclient.md)
|
||||
|
||||
## api.APIClient class
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class APIClient
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(opts)](./iceshrimp-sdk.api.apiclient._constructor_.md) | | Constructs a new instance of the <code>APIClient</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [credential](./iceshrimp-sdk.api.apiclient.credential.md) | | string \| null \| undefined | |
|
||||
| [fetch](./iceshrimp-sdk.api.apiclient.fetch.md) | | [FetchLike](./iceshrimp-sdk.api.fetchlike.md) | |
|
||||
| [origin](./iceshrimp-sdk.api.apiclient.origin.md) | | string | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [request(endpoint, params, credential)](./iceshrimp-sdk.api.apiclient.request.md) | | |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIClient](./iceshrimp-sdk.api.apiclient.md) > [origin](./iceshrimp-sdk.api.apiclient.origin.md)
|
||||
|
||||
## api.APIClient.origin property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
origin: string;
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIClient](./iceshrimp-sdk.api.apiclient.md) > [request](./iceshrimp-sdk.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<[Endpoints](./iceshrimp-sdk.endpoints.md)<!-- -->\[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](./iceshrimp-sdk.endpoints.md)<!-- -->\[E\]\["res"\]\["$switch"\]\["$default"\] : [Endpoints](./iceshrimp-sdk.endpoints.md)<!-- -->\[E\]\["res"\]>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [APIError](./iceshrimp-sdk.api.apierror.md)
|
||||
|
||||
## api.APIError type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type APIError = {
|
||||
id: string;
|
||||
code: string;
|
||||
message: string;
|
||||
kind: "client" | "server";
|
||||
info: Record<string, any>;
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [FetchLike](./iceshrimp-sdk.api.fetchlike.md)
|
||||
|
||||
## api.FetchLike type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type FetchLike = (input: string, init?: {
|
||||
method?: string;
|
||||
body?: string;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
}) => Promise<{
|
||||
status: number;
|
||||
json(): Promise<any>;
|
||||
}>;
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md) > [isAPIError](./iceshrimp-sdk.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](./iceshrimp-sdk.api.apierror.md)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [api](./iceshrimp-sdk.api.md)
|
||||
|
||||
## api namespace
|
||||
|
||||
## Classes
|
||||
|
||||
| Class | Description |
|
||||
| --- | --- |
|
||||
| [APIClient](./iceshrimp-sdk.api.apiclient.md) | |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| --- | --- |
|
||||
| [isAPIError(reason)](./iceshrimp-sdk.api.isapierror.md) | |
|
||||
|
||||
## Type Aliases
|
||||
|
||||
| Type Alias | Description |
|
||||
| --- | --- |
|
||||
| [APIError](./iceshrimp-sdk.api.apierror.md) | |
|
||||
| [FetchLike](./iceshrimp-sdk.api.fetchlike.md) | |
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [(constructor)](./iceshrimp-sdk.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](./iceshrimp-sdk.stream.md) | |
|
||||
| channel | string | |
|
||||
| name | string | _(Optional)_ |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [channel](./iceshrimp-sdk.channelconnection.channel.md)
|
||||
|
||||
## ChannelConnection.channel property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
channel: string;
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [dispose](./iceshrimp-sdk.channelconnection.dispose.md)
|
||||
|
||||
## ChannelConnection.dispose() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
abstract dispose(): void;
|
||||
```
|
||||
**Returns:**
|
||||
|
||||
void
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [id](./iceshrimp-sdk.channelconnection.id.md)
|
||||
|
||||
## ChannelConnection.id property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
abstract id: string;
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [inCount](./iceshrimp-sdk.channelconnection.incount.md)
|
||||
|
||||
## ChannelConnection.inCount property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
inCount: number;
|
||||
```
|
||||
@@ -0,0 +1,37 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md)
|
||||
|
||||
## ChannelConnection class
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare abstract class Connection<Channel extends AnyOf<Channels> = any> extends EventEmitter<Channel["events"]>
|
||||
```
|
||||
**Extends:** EventEmitter<Channel\["events"\]>
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(stream, channel, name)](./iceshrimp-sdk.channelconnection._constructor_.md) | | Constructs a new instance of the <code>Connection</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [channel](./iceshrimp-sdk.channelconnection.channel.md) | | string | |
|
||||
| [id](./iceshrimp-sdk.channelconnection.id.md) | <code>abstract</code> | string | |
|
||||
| [inCount](./iceshrimp-sdk.channelconnection.incount.md) | | number | |
|
||||
| [name?](./iceshrimp-sdk.channelconnection.name.md) | | string | _(Optional)_ |
|
||||
| [outCount](./iceshrimp-sdk.channelconnection.outcount.md) | | number | |
|
||||
| [stream](./iceshrimp-sdk.channelconnection.stream.md) | <code>protected</code> | [Stream](./iceshrimp-sdk.stream.md) | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [dispose()](./iceshrimp-sdk.channelconnection.dispose.md) | <code>abstract</code> | |
|
||||
| [send(type, body)](./iceshrimp-sdk.channelconnection.send.md) | | |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [name](./iceshrimp-sdk.channelconnection.name.md)
|
||||
|
||||
## ChannelConnection.name property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
name?: string;
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [outCount](./iceshrimp-sdk.channelconnection.outcount.md)
|
||||
|
||||
## ChannelConnection.outCount property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
outCount: number;
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [send](./iceshrimp-sdk.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
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ChannelConnection](./iceshrimp-sdk.channelconnection.md) > [stream](./iceshrimp-sdk.channelconnection.stream.md)
|
||||
|
||||
## ChannelConnection.stream property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
protected stream: Stream;
|
||||
```
|
||||
@@ -0,0 +1,143 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Channels](./iceshrimp-sdk.channels.md)
|
||||
|
||||
## Channels type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.note.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)<!-- -->, [MeDetailed](./iceshrimp-sdk.entities.medetailed.md)<!-- -->, [PageEvent](./iceshrimp-sdk.entities.pageevent.md)<!-- -->, [DriveFile](./iceshrimp-sdk.entities.drivefile.md)<!-- -->, [MessagingMessage](./iceshrimp-sdk.entities.messagingmessage.md)<!-- -->, [Antenna](./iceshrimp-sdk.entities.antenna.md)<!-- -->, [UserGroup](./iceshrimp-sdk.entities.usergroup.md)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Announcement](./iceshrimp-sdk.entities.announcement.md)
|
||||
|
||||
## entities.Announcement type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Announcement = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
updatedAt: DateString | null;
|
||||
text: string;
|
||||
title: string;
|
||||
imageUrl: string | null;
|
||||
isRead?: boolean;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Antenna](./iceshrimp-sdk.entities.antenna.md)
|
||||
|
||||
## entities.Antenna type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [App](./iceshrimp-sdk.entities.app.md)
|
||||
|
||||
## entities.App type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type App = TODO;
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [AuthSession](./iceshrimp-sdk.entities.authsession.md)
|
||||
|
||||
## entities.AuthSession type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type AuthSession = {
|
||||
id: ID;
|
||||
app: App;
|
||||
token: string;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [App](./iceshrimp-sdk.entities.app.md)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Bite](./iceshrimp-sdk.entities.bite.md)
|
||||
|
||||
## entities.Bite type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Bite = {
|
||||
id: ID;
|
||||
user: UserLite;
|
||||
targetType: "user" | "bite" | "note";
|
||||
target: UserLite | Bite | Note;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [UserLite](./iceshrimp-sdk.entities.userlite.md)<!-- -->, [Bite](./iceshrimp-sdk.entities.bite.md)<!-- -->, [Note](./iceshrimp-sdk.entities.note.md)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Blocking](./iceshrimp-sdk.entities.blocking.md)
|
||||
|
||||
## entities.Blocking type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Blocking = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
blockeeId: User["id"];
|
||||
blockee: UserDetailed;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)<!-- -->, [UserDetailed](./iceshrimp-sdk.entities.userdetailed.md)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Channel](./iceshrimp-sdk.entities.channel.md)
|
||||
|
||||
## entities.Channel type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Channel = {
|
||||
id: ID;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Clip](./iceshrimp-sdk.entities.clip.md)
|
||||
|
||||
## entities.Clip type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Clip = TODO;
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [CustomEmoji](./iceshrimp-sdk.entities.customemoji.md)
|
||||
|
||||
## entities.CustomEmoji type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type CustomEmoji = {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
category: string;
|
||||
aliases: string[];
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [DateString](./iceshrimp-sdk.entities.datestring.md)
|
||||
|
||||
## entities.DateString type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type DateString = string;
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [DetailedInstanceMetadata](./iceshrimp-sdk.entities.detailedinstancemetadata.md)
|
||||
|
||||
## entities.DetailedInstanceMetadata type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type DetailedInstanceMetadata = LiteInstanceMetadata & {
|
||||
features: Record<string, any>;
|
||||
};
|
||||
```
|
||||
**References:** [LiteInstanceMetadata](./iceshrimp-sdk.entities.liteinstancemetadata.md)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [DriveFile](./iceshrimp-sdk.entities.drivefile.md)
|
||||
|
||||
## entities.DriveFile type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [DriveFolder](./iceshrimp-sdk.entities.drivefolder.md)
|
||||
|
||||
## entities.DriveFolder type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type DriveFolder = TODO;
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Following](./iceshrimp-sdk.entities.following.md)
|
||||
|
||||
## entities.Following type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Following = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
followerId: User["id"];
|
||||
followeeId: User["id"];
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [FollowingFolloweePopulated](./iceshrimp-sdk.entities.followingfolloweepopulated.md)
|
||||
|
||||
## entities.FollowingFolloweePopulated type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type FollowingFolloweePopulated = Following & {
|
||||
followee: UserDetailed;
|
||||
};
|
||||
```
|
||||
**References:** [Following](./iceshrimp-sdk.entities.following.md)<!-- -->, [UserDetailed](./iceshrimp-sdk.entities.userdetailed.md)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [FollowingFollowerPopulated](./iceshrimp-sdk.entities.followingfollowerpopulated.md)
|
||||
|
||||
## entities.FollowingFollowerPopulated type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type FollowingFollowerPopulated = Following & {
|
||||
follower: UserDetailed;
|
||||
};
|
||||
```
|
||||
**References:** [Following](./iceshrimp-sdk.entities.following.md)<!-- -->, [UserDetailed](./iceshrimp-sdk.entities.userdetailed.md)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [FollowRequest](./iceshrimp-sdk.entities.followrequest.md)
|
||||
|
||||
## entities.FollowRequest type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type FollowRequest = {
|
||||
id: ID;
|
||||
follower: User;
|
||||
followee: User;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [GalleryPost](./iceshrimp-sdk.entities.gallerypost.md)
|
||||
|
||||
## entities.GalleryPost type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type GalleryPost = TODO;
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [ID](./iceshrimp-sdk.entities.id.md)
|
||||
|
||||
## entities.ID type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type ID = string;
|
||||
```
|
||||
@@ -0,0 +1,40 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Instance](./iceshrimp-sdk.entities.instance.md)
|
||||
|
||||
## entities.Instance type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [InstanceMetadata](./iceshrimp-sdk.entities.instancemetadata.md)
|
||||
|
||||
## entities.InstanceMetadata type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
||||
```
|
||||
**References:** [LiteInstanceMetadata](./iceshrimp-sdk.entities.liteinstancemetadata.md)<!-- -->, [DetailedInstanceMetadata](./iceshrimp-sdk.entities.detailedinstancemetadata.md)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [LiteInstanceMetadata](./iceshrimp-sdk.entities.liteinstancemetadata.md)
|
||||
|
||||
## entities.LiteInstanceMetadata type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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;
|
||||
enableGithubIntegration: boolean;
|
||||
enableDiscordIntegration: boolean;
|
||||
searchEngine: string;
|
||||
emojis: CustomEmoji[];
|
||||
images: {
|
||||
error: string;
|
||||
notFound: string;
|
||||
info: string;
|
||||
};
|
||||
};
|
||||
```
|
||||
**References:** [CustomEmoji](./iceshrimp-sdk.entities.customemoji.md)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md)
|
||||
|
||||
## entities namespace
|
||||
|
||||
## Type Aliases
|
||||
|
||||
| Type Alias | Description |
|
||||
| --- | --- |
|
||||
| [Announcement](./iceshrimp-sdk.entities.announcement.md) | |
|
||||
| [Antenna](./iceshrimp-sdk.entities.antenna.md) | |
|
||||
| [App](./iceshrimp-sdk.entities.app.md) | |
|
||||
| [AuthSession](./iceshrimp-sdk.entities.authsession.md) | |
|
||||
| [Bite](./iceshrimp-sdk.entities.bite.md) | |
|
||||
| [Blocking](./iceshrimp-sdk.entities.blocking.md) | |
|
||||
| [Channel](./iceshrimp-sdk.entities.channel.md) | |
|
||||
| [Clip](./iceshrimp-sdk.entities.clip.md) | |
|
||||
| [CustomEmoji](./iceshrimp-sdk.entities.customemoji.md) | |
|
||||
| [DateString](./iceshrimp-sdk.entities.datestring.md) | |
|
||||
| [DetailedInstanceMetadata](./iceshrimp-sdk.entities.detailedinstancemetadata.md) | |
|
||||
| [DriveFile](./iceshrimp-sdk.entities.drivefile.md) | |
|
||||
| [DriveFolder](./iceshrimp-sdk.entities.drivefolder.md) | |
|
||||
| [Following](./iceshrimp-sdk.entities.following.md) | |
|
||||
| [FollowingFolloweePopulated](./iceshrimp-sdk.entities.followingfolloweepopulated.md) | |
|
||||
| [FollowingFollowerPopulated](./iceshrimp-sdk.entities.followingfollowerpopulated.md) | |
|
||||
| [FollowRequest](./iceshrimp-sdk.entities.followrequest.md) | |
|
||||
| [GalleryPost](./iceshrimp-sdk.entities.gallerypost.md) | |
|
||||
| [ID](./iceshrimp-sdk.entities.id.md) | |
|
||||
| [Instance](./iceshrimp-sdk.entities.instance.md) | |
|
||||
| [InstanceMetadata](./iceshrimp-sdk.entities.instancemetadata.md) | |
|
||||
| [LiteInstanceMetadata](./iceshrimp-sdk.entities.liteinstancemetadata.md) | |
|
||||
| [MeDetailed](./iceshrimp-sdk.entities.medetailed.md) | |
|
||||
| [MessagingMessage](./iceshrimp-sdk.entities.messagingmessage.md) | |
|
||||
| [Note](./iceshrimp-sdk.entities.note.md) | |
|
||||
| [NoteFavorite](./iceshrimp-sdk.entities.notefavorite.md) | |
|
||||
| [NoteReaction](./iceshrimp-sdk.entities.notereaction.md) | |
|
||||
| [Notification](./iceshrimp-sdk.entities.notification.md) | |
|
||||
| [OriginType](./iceshrimp-sdk.entities.origintype.md) | |
|
||||
| [Page](./iceshrimp-sdk.entities.page.md) | |
|
||||
| [PageEvent](./iceshrimp-sdk.entities.pageevent.md) | |
|
||||
| [ServerInfo](./iceshrimp-sdk.entities.serverinfo.md) | |
|
||||
| [Signin](./iceshrimp-sdk.entities.signin.md) | |
|
||||
| [Stats](./iceshrimp-sdk.entities.stats.md) | |
|
||||
| [User](./iceshrimp-sdk.entities.user.md) | |
|
||||
| [UserDetailed](./iceshrimp-sdk.entities.userdetailed.md) | |
|
||||
| [UserGroup](./iceshrimp-sdk.entities.usergroup.md) | |
|
||||
| [UserList](./iceshrimp-sdk.entities.userlist.md) | |
|
||||
| [UserLite](./iceshrimp-sdk.entities.userlite.md) | |
|
||||
| [UserSorting](./iceshrimp-sdk.entities.usersorting.md) | |
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [MeDetailed](./iceshrimp-sdk.entities.medetailed.md)
|
||||
|
||||
## entities.MeDetailed type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.userdetailed.md)<!-- -->, [DriveFile](./iceshrimp-sdk.entities.drivefile.md)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [MessagingMessage](./iceshrimp-sdk.entities.messagingmessage.md)
|
||||
|
||||
## entities.MessagingMessage type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [DriveFile](./iceshrimp-sdk.entities.drivefile.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)<!-- -->, [UserGroup](./iceshrimp-sdk.entities.usergroup.md)
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Note](./iceshrimp-sdk.entities.note.md)
|
||||
|
||||
## entities.Note type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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;
|
||||
isRenoted?: boolean;
|
||||
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;
|
||||
canBite?: boolean;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)<!-- -->, [Note](./iceshrimp-sdk.entities.note.md)<!-- -->, [DriveFile](./iceshrimp-sdk.entities.drivefile.md)<!-- -->, [Channel](./iceshrimp-sdk.entities.channel.md)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [NoteFavorite](./iceshrimp-sdk.entities.notefavorite.md)
|
||||
|
||||
## entities.NoteFavorite type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type NoteFavorite = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
noteId: Note["id"];
|
||||
note: Note;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [Note](./iceshrimp-sdk.entities.note.md)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [NoteReaction](./iceshrimp-sdk.entities.notereaction.md)
|
||||
|
||||
## entities.NoteReaction type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type NoteReaction = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
user: UserLite;
|
||||
type: string;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [UserLite](./iceshrimp-sdk.entities.userlite.md)
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Notification](./iceshrimp-sdk.entities.notification.md)
|
||||
|
||||
## entities.Notification type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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;
|
||||
} | {
|
||||
type: "bite";
|
||||
user: User;
|
||||
userId: User["id"];
|
||||
bite: Bite;
|
||||
});
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)<!-- -->, [Note](./iceshrimp-sdk.entities.note.md)<!-- -->, [UserGroup](./iceshrimp-sdk.entities.usergroup.md)<!-- -->, [Bite](./iceshrimp-sdk.entities.bite.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [OriginType](./iceshrimp-sdk.entities.origintype.md)
|
||||
|
||||
## entities.OriginType type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type OriginType = "combined" | "local" | "remote";
|
||||
```
|
||||
@@ -0,0 +1,33 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Page](./iceshrimp-sdk.entities.page.md)
|
||||
|
||||
## entities.Page type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)<!-- -->, [DriveFile](./iceshrimp-sdk.entities.drivefile.md)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [PageEvent](./iceshrimp-sdk.entities.pageevent.md)
|
||||
|
||||
## entities.PageEvent type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type PageEvent = {
|
||||
pageId: Page["id"];
|
||||
event: string;
|
||||
var: any;
|
||||
userId: User["id"];
|
||||
user: User;
|
||||
};
|
||||
```
|
||||
**References:** [Page](./iceshrimp-sdk.entities.page.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [ServerInfo](./iceshrimp-sdk.entities.serverinfo.md)
|
||||
|
||||
## entities.ServerInfo type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type ServerInfo = {
|
||||
machine: string;
|
||||
cpu: {
|
||||
model: string;
|
||||
cores: number;
|
||||
};
|
||||
mem: {
|
||||
total: number;
|
||||
};
|
||||
fs: {
|
||||
total: number;
|
||||
used: number;
|
||||
};
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Signin](./iceshrimp-sdk.entities.signin.md)
|
||||
|
||||
## entities.Signin type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Signin = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
ip: string;
|
||||
headers: Record<string, any>;
|
||||
success: boolean;
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [Stats](./iceshrimp-sdk.entities.stats.md)
|
||||
|
||||
## entities.Stats type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type Stats = {
|
||||
notesCount: number;
|
||||
originalNotesCount: number;
|
||||
usersCount: number;
|
||||
originalUsersCount: number;
|
||||
instances: number;
|
||||
driveUsageLocal: number;
|
||||
driveUsageRemote: number;
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [User](./iceshrimp-sdk.entities.user.md)
|
||||
|
||||
## entities.User type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type User = UserLite | UserDetailed;
|
||||
```
|
||||
**References:** [UserLite](./iceshrimp-sdk.entities.userlite.md)<!-- -->, [UserDetailed](./iceshrimp-sdk.entities.userdetailed.md)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [UserDetailed](./iceshrimp-sdk.entities.userdetailed.md)
|
||||
|
||||
## entities.UserDetailed type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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;
|
||||
verified?: boolean;
|
||||
}[];
|
||||
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;
|
||||
pronouns: Record<string, string>;
|
||||
canBite: "anyone" | "followers" | "nobody";
|
||||
};
|
||||
```
|
||||
**References:** [UserLite](./iceshrimp-sdk.entities.userlite.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [Note](./iceshrimp-sdk.entities.note.md)<!-- -->, [Page](./iceshrimp-sdk.entities.page.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [UserGroup](./iceshrimp-sdk.entities.usergroup.md)
|
||||
|
||||
## entities.UserGroup type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type UserGroup = TODO;
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [UserList](./iceshrimp-sdk.entities.userlist.md)
|
||||
|
||||
## entities.UserList type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type UserList = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
name: string;
|
||||
userIds: User["id"][];
|
||||
};
|
||||
```
|
||||
**References:** [ID](./iceshrimp-sdk.entities.id.md)<!-- -->, [DateString](./iceshrimp-sdk.entities.datestring.md)<!-- -->, [User](./iceshrimp-sdk.entities.user.md)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [UserLite](./iceshrimp-sdk.entities.userlite.md)
|
||||
|
||||
## entities.UserLite type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export 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](./iceshrimp-sdk.entities.id.md)<!-- -->, [Instance](./iceshrimp-sdk.entities.instance.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [entities](./iceshrimp-sdk.entities.md) > [UserSorting](./iceshrimp-sdk.entities.usersorting.md)
|
||||
|
||||
## entities.UserSorting type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export type UserSorting = "+follower" | "-follower" | "+createdAt" | "-createdAt" | "+updatedAt" | "-updatedAt";
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [ffVisibility](./iceshrimp-sdk.ffvisibility.md)
|
||||
|
||||
## ffVisibility variable
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
ffVisibility: readonly ["public", "followers", "private"]
|
||||
```
|
||||
@@ -0,0 +1,42 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md)
|
||||
|
||||
## iceshrimp-sdk package
|
||||
|
||||
## Classes
|
||||
|
||||
| Class | Description |
|
||||
| --- | --- |
|
||||
| [Stream](./iceshrimp-sdk.stream.md) | |
|
||||
|
||||
## Abstract Classes
|
||||
|
||||
| Abstract Class | Description |
|
||||
| --- | --- |
|
||||
| [ChannelConnection](./iceshrimp-sdk.channelconnection.md) | |
|
||||
|
||||
## Namespaces
|
||||
|
||||
| Namespace | Description |
|
||||
| --- | --- |
|
||||
| [api](./iceshrimp-sdk.api.md) | |
|
||||
| [entities](./iceshrimp-sdk.entities.md) | |
|
||||
|
||||
## Variables
|
||||
|
||||
| Variable | Description |
|
||||
| --- | --- |
|
||||
| [ffVisibility](./iceshrimp-sdk.ffvisibility.md) | |
|
||||
| [noteVisibilities](./iceshrimp-sdk.notevisibilities.md) | |
|
||||
| [notificationTypes](./iceshrimp-sdk.notificationtypes.md) | |
|
||||
| [permissions](./iceshrimp-sdk.permissions.md) | |
|
||||
|
||||
## Type Aliases
|
||||
|
||||
| Type Alias | Description |
|
||||
| --- | --- |
|
||||
| [Acct](./iceshrimp-sdk.acct.md) | |
|
||||
| [Channels](./iceshrimp-sdk.channels.md) | |
|
||||
| [Endpoints](./iceshrimp-sdk.endpoints.md) | |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [noteVisibilities](./iceshrimp-sdk.notevisibilities.md)
|
||||
|
||||
## noteVisibilities variable
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
noteVisibilities: readonly ["public", "home", "followers", "specified"]
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [notificationTypes](./iceshrimp-sdk.notificationtypes.md)
|
||||
|
||||
## notificationTypes variable
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
notificationTypes: readonly ["follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app", "bite"]
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [permissions](./iceshrimp-sdk.permissions.md)
|
||||
|
||||
## permissions variable
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
permissions: string[]
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [(constructor)](./iceshrimp-sdk.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)_ |
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [close](./iceshrimp-sdk.stream.close.md)
|
||||
|
||||
## Stream.close() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
close(): void;
|
||||
```
|
||||
**Returns:**
|
||||
|
||||
void
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [disconnectToChannel](./iceshrimp-sdk.stream.disconnecttochannel.md)
|
||||
|
||||
## Stream.disconnectToChannel() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
disconnectToChannel(connection: NonSharedConnection): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| connection | NonSharedConnection | |
|
||||
|
||||
**Returns:**
|
||||
|
||||
void
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md)
|
||||
|
||||
## Stream class
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export default class Stream extends EventEmitter<StreamEvents>
|
||||
```
|
||||
**Extends:** EventEmitter<StreamEvents>
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(origin, user, options)](./iceshrimp-sdk.stream._constructor_.md) | | Constructs a new instance of the <code>Stream</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [state](./iceshrimp-sdk.stream.state.md) | | "initializing" \| "reconnecting" \| "connected" | |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [close()](./iceshrimp-sdk.stream.close.md) | | |
|
||||
| [disconnectToChannel(connection)](./iceshrimp-sdk.stream.disconnecttochannel.md) | | |
|
||||
| [removeSharedConnection(connection)](./iceshrimp-sdk.stream.removesharedconnection.md) | | |
|
||||
| [removeSharedConnectionPool(pool)](./iceshrimp-sdk.stream.removesharedconnectionpool.md) | | |
|
||||
| [send(typeOrPayload, payload)](./iceshrimp-sdk.stream.send.md) | | |
|
||||
| [useChannel(channel, params, name)](./iceshrimp-sdk.stream.usechannel.md) | | |
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [removeSharedConnection](./iceshrimp-sdk.stream.removesharedconnection.md)
|
||||
|
||||
## Stream.removeSharedConnection() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
removeSharedConnection(connection: SharedConnection): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| connection | SharedConnection | |
|
||||
|
||||
**Returns:**
|
||||
|
||||
void
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [removeSharedConnectionPool](./iceshrimp-sdk.stream.removesharedconnectionpool.md)
|
||||
|
||||
## Stream.removeSharedConnectionPool() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
removeSharedConnectionPool(pool: Pool): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| pool | Pool | |
|
||||
|
||||
**Returns:**
|
||||
|
||||
void
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [send](./iceshrimp-sdk.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
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [state](./iceshrimp-sdk.stream.state.md)
|
||||
|
||||
## Stream.state property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
state: "initializing" | "reconnecting" | "connected";
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [iceshrimp-sdk](./iceshrimp-sdk.md) > [Stream](./iceshrimp-sdk.stream.md) > [useChannel](./iceshrimp-sdk.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](./iceshrimp-sdk.channels.md)<!-- -->\[C\]\["params"\] | _(Optional)_ |
|
||||
| name | string | _(Optional)_ |
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Connection](./iceshrimp-sdk.channelconnection.md)<!-- --><[Channels](./iceshrimp-sdk.channels.md)<!-- -->\[C\]>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md)
|
||||
|
||||
## API Reference
|
||||
|
||||
## Packages
|
||||
|
||||
| Package | Description |
|
||||
| --- | --- |
|
||||
| [iceshrimp-sdk](./iceshrimp-sdk.md) | |
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "iceshrimp-sdk",
|
||||
"version": "0.0.24",
|
||||
"description": "iceshrimp SDK for JavaScript",
|
||||
"main": "./built/index.js",
|
||||
"types": "./built/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsup --config tsup.config.ts",
|
||||
"build:dts": "tsc --emitDeclarationOnly",
|
||||
"render": "yarn build:dts && yarn api && yarn api-prod && cp temp/iceshrimp-sdk.api.json etc/ && yarn api-doc",
|
||||
"api": "api-extractor run --local --verbose",
|
||||
"api-prod": "api-extractor run --verbose",
|
||||
"api-doc": "api-documenter markdown -i ./etc/",
|
||||
"lint": "biome check --apply *.ts",
|
||||
"format": "biome format --write *.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://iceshrimp.dev/iceshrimp/iceshrimp.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/api-documenter": "^7.22.21",
|
||||
"@microsoft/api-extractor": "^7.36.0",
|
||||
"@types/node": "^22",
|
||||
"tsup": "^8.5.1",
|
||||
"typescript": "^6.0.3"
|
||||
},
|
||||
"files": [
|
||||
"built"
|
||||
],
|
||||
"dependencies": {
|
||||
"eventemitter3": "^4.0.7",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
"semver": "^7.3.8"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
export type Acct = {
|
||||
username: string;
|
||||
host: string | null;
|
||||
};
|
||||
|
||||
export function parse(acct: string): Acct {
|
||||
if (acct.startsWith("@")) acct = acct.slice(1);
|
||||
const split = acct.split("@", 2);
|
||||
return { username: split[0], host: split[1] || null };
|
||||
}
|
||||
|
||||
export function toString(acct: Acct): string {
|
||||
return acct.host == null ? acct.username : `${acct.username}@${acct.host}`;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
import { Endpoints } from "./api.types";
|
||||
|
||||
const MK_API_ERROR = Symbol();
|
||||
|
||||
export type APIError = {
|
||||
id: string;
|
||||
code: string;
|
||||
message: string;
|
||||
kind: "client" | "server";
|
||||
info: Record<string, any>;
|
||||
};
|
||||
|
||||
export function isAPIError(reason: any): reason is APIError {
|
||||
return reason[MK_API_ERROR] === true;
|
||||
}
|
||||
|
||||
export type FetchLike = (
|
||||
input: string,
|
||||
init?: {
|
||||
method?: string;
|
||||
body?: string;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
},
|
||||
) => Promise<{
|
||||
status: number;
|
||||
json(): Promise<any>;
|
||||
}>;
|
||||
|
||||
type IsNeverType<T> = [T] extends [never] ? true : false;
|
||||
|
||||
type StrictExtract<Union, Cond> = Cond extends Union ? Union : never;
|
||||
|
||||
type IsCaseMatched<
|
||||
E extends keyof Endpoints,
|
||||
P extends Endpoints[E]["req"],
|
||||
C extends number,
|
||||
> = IsNeverType<
|
||||
StrictExtract<Endpoints[E]["res"]["$switch"]["$cases"][C], [P, any]>
|
||||
> extends false
|
||||
? true
|
||||
: false;
|
||||
|
||||
type GetCaseResult<
|
||||
E extends keyof Endpoints,
|
||||
P extends Endpoints[E]["req"],
|
||||
C extends number,
|
||||
> = StrictExtract<Endpoints[E]["res"]["$switch"]["$cases"][C], [P, any]>[1];
|
||||
|
||||
export class APIClient {
|
||||
public origin: string;
|
||||
public credential: string | null | undefined;
|
||||
public fetch: FetchLike;
|
||||
|
||||
constructor(opts: {
|
||||
origin: APIClient["origin"];
|
||||
credential?: APIClient["credential"];
|
||||
fetch?: APIClient["fetch"] | null | undefined;
|
||||
}) {
|
||||
this.origin = opts.origin;
|
||||
this.credential = opts.credential;
|
||||
// ネイティブ関数をそのまま変数に代入して使おうとするとChromiumではIllegal invocationエラーが発生するため、
|
||||
// 環境で実装されているfetchを使う場合は無名関数でラップして使用する
|
||||
this.fetch = opts.fetch || ((...args) => fetch(...args));
|
||||
}
|
||||
|
||||
public request<E extends keyof Endpoints, P extends Endpoints[E]["req"]>(
|
||||
endpoint: E,
|
||||
params: P = {} as 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"]
|
||||
> {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
this.fetch(`${this.origin}/api/${endpoint}`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
...params,
|
||||
i: credential !== undefined ? credential : this.credential,
|
||||
}),
|
||||
credentials: "omit",
|
||||
cache: "no-cache",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const body = res.status === 204 ? null : await res.json();
|
||||
|
||||
if (res.status === 200) {
|
||||
resolve(body);
|
||||
} else if (res.status === 204) {
|
||||
resolve(null);
|
||||
} else {
|
||||
reject({
|
||||
[MK_API_ERROR]: true,
|
||||
...body.error,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
|
||||
return promise as any;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
export const notificationTypes = [
|
||||
"follow",
|
||||
"mention",
|
||||
"reply",
|
||||
"renote",
|
||||
"quote",
|
||||
"reaction",
|
||||
"pollVote",
|
||||
"pollEnded",
|
||||
"receiveFollowRequest",
|
||||
"followRequestAccepted",
|
||||
"groupInvited",
|
||||
"app",
|
||||
"bite",
|
||||
] as const;
|
||||
|
||||
export const noteVisibilities = [
|
||||
"public",
|
||||
"home",
|
||||
"followers",
|
||||
"specified",
|
||||
] as const;
|
||||
|
||||
export const ffVisibility = ["public", "followers", "private"] as const;
|
||||
|
||||
export const permissions = [
|
||||
"read:account",
|
||||
"write:account",
|
||||
"read:blocks",
|
||||
"write:blocks",
|
||||
"read:drive",
|
||||
"write:drive",
|
||||
"read:favorites",
|
||||
"write:favorites",
|
||||
"read:following",
|
||||
"write:following",
|
||||
"read:messaging",
|
||||
"write:messaging",
|
||||
"read:mutes",
|
||||
"write:mutes",
|
||||
"write:notes",
|
||||
"read:notifications",
|
||||
"write:notifications",
|
||||
"read:reactions",
|
||||
"write:reactions",
|
||||
"write:votes",
|
||||
"read:pages",
|
||||
"write:pages",
|
||||
"write:page-likes",
|
||||
"read:page-likes",
|
||||
"read:user-groups",
|
||||
"write:user-groups",
|
||||
"read:channels",
|
||||
"write:channels",
|
||||
"read:gallery",
|
||||
"write:gallery",
|
||||
"read:gallery-likes",
|
||||
"write:gallery-likes",
|
||||
];
|
||||
@@ -0,0 +1,538 @@
|
||||
export type ID = string;
|
||||
export type DateString = string;
|
||||
|
||||
type TODO = Record<string, any>;
|
||||
|
||||
// NOTE: 極力この型を使うのは避け、UserLite か UserDetailed か明示するように
|
||||
export type User = UserLite | UserDetailed;
|
||||
|
||||
export 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;
|
||||
}[];
|
||||
isAdmin: boolean;
|
||||
isModerator: boolean;
|
||||
isVerified: boolean;
|
||||
minorBadges: ["K" | "T" | "E"] | [];
|
||||
plans: Plan[];
|
||||
instance?: {
|
||||
name: Instance["name"];
|
||||
softwareName: Instance["softwareName"];
|
||||
softwareVersion: Instance["softwareVersion"];
|
||||
iconUrl: Instance["iconUrl"];
|
||||
faviconUrl: Instance["faviconUrl"];
|
||||
themeColor: Instance["themeColor"];
|
||||
};
|
||||
};
|
||||
|
||||
export type Plan = {
|
||||
id: ID;
|
||||
createdAt?: DateString;
|
||||
updatedAt?: DateString | null;
|
||||
name: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
export 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;
|
||||
verified?: boolean;
|
||||
}[];
|
||||
followersCount: number;
|
||||
followingCount: number;
|
||||
hasPendingFollowRequestFromYou: boolean;
|
||||
hasPendingFollowRequestToYou: boolean;
|
||||
isBlocked: boolean;
|
||||
isBlocking: boolean;
|
||||
isBot: boolean;
|
||||
isCat: boolean;
|
||||
isFollowed: boolean;
|
||||
isFollowing: boolean;
|
||||
isLocked: 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;
|
||||
pronouns: Record<string, string>;
|
||||
canBite: "anyone" | "followers" | "nobody";
|
||||
};
|
||||
|
||||
export type UserGroup = TODO;
|
||||
|
||||
export type UserList = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
name: string;
|
||||
userIds: User["id"][];
|
||||
};
|
||||
|
||||
export 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;
|
||||
};
|
||||
|
||||
export type DriveFile = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
isSensitive: boolean;
|
||||
allowDownload: boolean;
|
||||
isDatabase: boolean;
|
||||
name: string;
|
||||
thumbnailUrl: string;
|
||||
url: string;
|
||||
type: string;
|
||||
size: number;
|
||||
md5: string;
|
||||
blurhash: string;
|
||||
comment: string | null;
|
||||
properties: Record<string, any>;
|
||||
};
|
||||
|
||||
export type DriveFolder = TODO;
|
||||
|
||||
export type GalleryPost = TODO;
|
||||
|
||||
export type Note = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
text: string | null;
|
||||
cw: string | null;
|
||||
user: User;
|
||||
userId: User["id"];
|
||||
group: UserGroup | null;
|
||||
groupId: UserGroup["id"] | null;
|
||||
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;
|
||||
isRenoted?: boolean;
|
||||
reactions: Record<string, number>;
|
||||
renoteCount: number;
|
||||
repliesCount: number;
|
||||
viewCount?: 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;
|
||||
canBite?: boolean;
|
||||
};
|
||||
|
||||
export type NoteReaction = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
user: UserLite;
|
||||
type: string;
|
||||
};
|
||||
|
||||
export 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;
|
||||
}
|
||||
| {
|
||||
type: "bite";
|
||||
user: User;
|
||||
userId: User["id"];
|
||||
bite: Bite;
|
||||
}
|
||||
);
|
||||
|
||||
export 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;
|
||||
};
|
||||
|
||||
export type CustomEmoji = {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
category: string;
|
||||
aliases: string[];
|
||||
glyph?: boolean;
|
||||
glyphUrl?: string | null;
|
||||
};
|
||||
|
||||
export 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;
|
||||
lua4frozenDatabaseCapacityMb: number;
|
||||
enableHcaptcha: boolean;
|
||||
hcaptchaSiteKey: string | null;
|
||||
enableRecaptcha: boolean;
|
||||
recaptchaSiteKey: string | null;
|
||||
swPublickey: string | null;
|
||||
maxNoteTextLength: number;
|
||||
enableEmail: boolean;
|
||||
enableGithubIntegration: boolean;
|
||||
enableDiscordIntegration: boolean;
|
||||
searchEngine: string;
|
||||
emojis: CustomEmoji[];
|
||||
images: {
|
||||
error: string;
|
||||
notFound: string;
|
||||
info: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type DetailedInstanceMetadata = LiteInstanceMetadata & {
|
||||
features: Record<string, any>;
|
||||
};
|
||||
|
||||
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
||||
|
||||
export type ServerInfo = {
|
||||
machine: string;
|
||||
cpu: {
|
||||
model: string;
|
||||
cores: number;
|
||||
};
|
||||
mem: {
|
||||
total: number;
|
||||
};
|
||||
fs: {
|
||||
total: number;
|
||||
used: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type Stats = {
|
||||
notesCount: number;
|
||||
originalNotesCount: number;
|
||||
usersCount: number;
|
||||
originalUsersCount: number;
|
||||
instances: number;
|
||||
driveUsageLocal: number;
|
||||
driveUsageRemote: number;
|
||||
};
|
||||
|
||||
export 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;
|
||||
};
|
||||
|
||||
export type PageEvent = {
|
||||
pageId: Page["id"];
|
||||
event: string;
|
||||
var: any;
|
||||
userId: User["id"];
|
||||
user: User;
|
||||
};
|
||||
|
||||
export type Announcement = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
updatedAt: DateString | null;
|
||||
text: string;
|
||||
title: string;
|
||||
imageUrl: string | null;
|
||||
isRead?: boolean;
|
||||
};
|
||||
|
||||
export type Antenna = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
name: string;
|
||||
keywords: string[][]; // TODO
|
||||
excludeKeywords: string[][]; // TODO
|
||||
src: "home" | "all" | "users" | "list" | "group" | "instances";
|
||||
userListId: ID | null; // TODO
|
||||
userGroupId: ID | null; // TODO
|
||||
users: string[]; // TODO
|
||||
instances: string[];
|
||||
caseSensitive: boolean;
|
||||
notify: boolean;
|
||||
withReplies: boolean;
|
||||
withFile: boolean;
|
||||
hasUnreadNote: boolean;
|
||||
};
|
||||
|
||||
export type App = TODO;
|
||||
|
||||
export type AuthSession = {
|
||||
id: ID;
|
||||
app: App;
|
||||
token: string;
|
||||
};
|
||||
|
||||
export type Clip = TODO;
|
||||
|
||||
export type NoteFavorite = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
noteId: Note["id"];
|
||||
note: Note;
|
||||
};
|
||||
|
||||
export type FollowRequest = {
|
||||
id: ID;
|
||||
follower: User;
|
||||
followee: User;
|
||||
};
|
||||
|
||||
export type Channel = {
|
||||
id: ID;
|
||||
// TODO
|
||||
};
|
||||
|
||||
export type Following = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
followerId: User["id"];
|
||||
followeeId: User["id"];
|
||||
};
|
||||
|
||||
export type FollowingFolloweePopulated = Following & {
|
||||
followee: UserDetailed;
|
||||
};
|
||||
|
||||
export type FollowingFollowerPopulated = Following & {
|
||||
follower: UserDetailed;
|
||||
};
|
||||
|
||||
export type Blocking = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
blockeeId: User["id"];
|
||||
blockee: UserDetailed;
|
||||
};
|
||||
|
||||
export type Muting = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
expiresAt: DateString | null;
|
||||
muteeId: User["id"];
|
||||
mutee: UserDetailed;
|
||||
};
|
||||
|
||||
export 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;
|
||||
};
|
||||
|
||||
export type Signin = {
|
||||
id: ID;
|
||||
createdAt: DateString;
|
||||
ip: string;
|
||||
headers: Record<string, any>;
|
||||
success: boolean;
|
||||
};
|
||||
|
||||
export type UserSorting =
|
||||
| "+follower"
|
||||
| "-follower"
|
||||
| "+createdAt"
|
||||
| "-createdAt"
|
||||
| "+updatedAt"
|
||||
| "-updatedAt";
|
||||
export type OriginType = "combined" | "local" | "remote";
|
||||
|
||||
export type Bite = {
|
||||
id: ID;
|
||||
user: UserLite,
|
||||
targetType: "user" | "bite" | "note",
|
||||
target: UserLite | Bite | Note,
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Endpoints } from "./api.types";
|
||||
import Stream, { Connection } from "./streaming";
|
||||
import { Channels } from "./streaming.types";
|
||||
import { Acct } from "./acct";
|
||||
import * as consts from "./consts";
|
||||
|
||||
export { Endpoints, Stream, Connection as ChannelConnection, Channels, Acct };
|
||||
|
||||
export const permissions = consts.permissions;
|
||||
export const notificationTypes = consts.notificationTypes;
|
||||
export const noteVisibilities = consts.noteVisibilities;
|
||||
export const ffVisibility = consts.ffVisibility;
|
||||
|
||||
// api extractor not supported yet
|
||||
//export * as api from './api';
|
||||
//export * as entities from './entities';
|
||||
import * as api from "./api";
|
||||
import * as entities from "./entities";
|
||||
export { api, entities };
|
||||
@@ -0,0 +1,391 @@
|
||||
import { EventEmitter } from "eventemitter3";
|
||||
import ReconnectingWebsocket from "reconnecting-websocket";
|
||||
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(
|
||||
obj: Record<string, string | number | boolean | undefined>,
|
||||
): string {
|
||||
const params = Object.entries(obj)
|
||||
.filter(([, v]) => (Array.isArray(v) ? v.length : v !== undefined))
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
.reduce(
|
||||
(a, [k, v]) => ((a[k] = v!), a),
|
||||
{} as Record<string, string | number | boolean>,
|
||||
);
|
||||
|
||||
return Object.entries(params)
|
||||
.map((e) => `${e[0]}=${encodeURIComponent(e[1])}`)
|
||||
.join("&");
|
||||
}
|
||||
|
||||
type AnyOf<T extends Record<any, any>> = T[keyof T];
|
||||
|
||||
type StreamEvents = {
|
||||
_connected_: void;
|
||||
_disconnected_: void;
|
||||
} & BroadcastEvents;
|
||||
|
||||
/**
|
||||
* Misskey stream connection
|
||||
*/
|
||||
export default class Stream extends EventEmitter<StreamEvents> {
|
||||
private stream: ReconnectingWebsocket;
|
||||
public state: "initializing" | "reconnecting" | "connected" = "initializing";
|
||||
private sharedConnectionPools: Pool[] = [];
|
||||
private sharedConnections: SharedConnection[] = [];
|
||||
private nonSharedConnections: NonSharedConnection[] = [];
|
||||
private idCounter = 0;
|
||||
|
||||
constructor(
|
||||
origin: string,
|
||||
user: { token: string } | null,
|
||||
options?: {
|
||||
WebSocket?: any;
|
||||
},
|
||||
) {
|
||||
super();
|
||||
autobind(this);
|
||||
options = options || {};
|
||||
|
||||
const query = urlQuery({
|
||||
i: user?.token,
|
||||
|
||||
// To prevent cache of an HTML such as error screen
|
||||
_t: Date.now(),
|
||||
});
|
||||
|
||||
const wsOrigin = origin
|
||||
.replace("http://", "ws://")
|
||||
.replace("https://", "wss://");
|
||||
|
||||
this.stream = new ReconnectingWebsocket(
|
||||
`${wsOrigin}/streaming?${query}`,
|
||||
"",
|
||||
{
|
||||
minReconnectionDelay: 1, // https://github.com/pladaria/reconnecting-websocket/issues/91
|
||||
WebSocket: options.WebSocket,
|
||||
},
|
||||
);
|
||||
this.stream.addEventListener("open", this.onOpen);
|
||||
this.stream.addEventListener("close", this.onClose);
|
||||
this.stream.addEventListener("message", this.onMessage);
|
||||
}
|
||||
|
||||
private genId(): string {
|
||||
return (++this.idCounter).toString();
|
||||
}
|
||||
|
||||
public useChannel<C extends keyof Channels>(
|
||||
channel: C,
|
||||
params?: Channels[C]["params"],
|
||||
name?: string,
|
||||
): Connection<Channels[C]> {
|
||||
if (params) {
|
||||
return this.connectToChannel(channel, params);
|
||||
} else {
|
||||
return this.useSharedConnection(channel, name);
|
||||
}
|
||||
}
|
||||
|
||||
private useSharedConnection<C extends keyof Channels>(
|
||||
channel: C,
|
||||
name?: string,
|
||||
): SharedConnection<Channels[C]> {
|
||||
let pool = this.sharedConnectionPools.find((p) => p.channel === channel);
|
||||
|
||||
if (pool == null) {
|
||||
pool = new Pool(this, channel, this.genId());
|
||||
this.sharedConnectionPools.push(pool);
|
||||
}
|
||||
|
||||
const connection = new SharedConnection(this, channel, pool, name);
|
||||
this.sharedConnections.push(connection);
|
||||
return connection;
|
||||
}
|
||||
|
||||
public removeSharedConnection(connection: SharedConnection): void {
|
||||
this.sharedConnections = this.sharedConnections.filter(
|
||||
(c) => c !== connection,
|
||||
);
|
||||
}
|
||||
|
||||
public removeSharedConnectionPool(pool: Pool): void {
|
||||
this.sharedConnectionPools = this.sharedConnectionPools.filter(
|
||||
(p) => p !== pool,
|
||||
);
|
||||
}
|
||||
|
||||
private connectToChannel<C extends keyof Channels>(
|
||||
channel: C,
|
||||
params: Channels[C]["params"],
|
||||
): NonSharedConnection<Channels[C]> {
|
||||
const connection = new NonSharedConnection(
|
||||
this,
|
||||
channel,
|
||||
this.genId(),
|
||||
params,
|
||||
);
|
||||
this.nonSharedConnections.push(connection);
|
||||
return connection;
|
||||
}
|
||||
|
||||
public disconnectToChannel(connection: NonSharedConnection): void {
|
||||
this.nonSharedConnections = this.nonSharedConnections.filter(
|
||||
(c) => c !== connection,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback of when open connection
|
||||
*/
|
||||
private onOpen(): void {
|
||||
const isReconnect = this.state === "reconnecting";
|
||||
|
||||
this.state = "connected";
|
||||
this.emit("_connected_");
|
||||
|
||||
// チャンネル再接続
|
||||
if (isReconnect) {
|
||||
for (const p of this.sharedConnectionPools) p.connect();
|
||||
for (const c of this.nonSharedConnections) c.connect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback of when close connection
|
||||
*/
|
||||
private onClose(): void {
|
||||
if (this.state === "connected") {
|
||||
this.state = "reconnecting";
|
||||
this.emit("_disconnected_");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback of when received a message from connection
|
||||
*/
|
||||
private onMessage(message: { data: string }): void {
|
||||
const { type, body } = JSON.parse(message.data);
|
||||
|
||||
if (type === "channel") {
|
||||
const id = body.id;
|
||||
|
||||
let connections: Connection[];
|
||||
|
||||
connections = this.sharedConnections.filter((c) => c.id === id);
|
||||
|
||||
if (connections.length === 0) {
|
||||
const found = this.nonSharedConnections.find((c) => c.id === id);
|
||||
if (found) {
|
||||
connections = [found];
|
||||
}
|
||||
}
|
||||
|
||||
for (const c of connections) {
|
||||
c.emit(body.type, body.body);
|
||||
c.inCount++;
|
||||
}
|
||||
} else {
|
||||
this.emit(type, body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to connection
|
||||
*/
|
||||
public send(typeOrPayload: any, payload?: any): void {
|
||||
const data =
|
||||
payload === undefined
|
||||
? typeOrPayload
|
||||
: {
|
||||
type: typeOrPayload,
|
||||
body: payload,
|
||||
};
|
||||
|
||||
this.stream.send(JSON.stringify(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Close this connection
|
||||
*/
|
||||
public close(): void {
|
||||
this.stream.close();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: これらのクラスを Stream クラスの内部クラスにすれば余計なメンバをpublicにしないで済むかも?
|
||||
// もしくは @internal を使う? https://www.typescriptlang.org/tsconfig#stripInternal
|
||||
class Pool {
|
||||
public channel: string;
|
||||
public id: string;
|
||||
protected stream: Stream;
|
||||
public users = 0;
|
||||
private disposeTimerId: any;
|
||||
private isConnected = false;
|
||||
|
||||
constructor(stream: Stream, channel: string, id: string) {
|
||||
this.channel = channel;
|
||||
this.stream = stream;
|
||||
this.id = id;
|
||||
|
||||
this.stream.on("_disconnected_", this.onStreamDisconnected);
|
||||
}
|
||||
|
||||
private onStreamDisconnected(): void {
|
||||
this.isConnected = false;
|
||||
}
|
||||
|
||||
public inc(): void {
|
||||
if (this.users === 0 && !this.isConnected) {
|
||||
this.connect();
|
||||
}
|
||||
|
||||
this.users++;
|
||||
|
||||
// タイマー解除
|
||||
if (this.disposeTimerId) {
|
||||
clearTimeout(this.disposeTimerId);
|
||||
this.disposeTimerId = null;
|
||||
}
|
||||
}
|
||||
|
||||
public dec(): void {
|
||||
this.users--;
|
||||
|
||||
// そのコネクションの利用者が誰もいなくなったら
|
||||
if (this.users === 0) {
|
||||
// また直ぐに再利用される可能性があるので、一定時間待ち、
|
||||
// 新たな利用者が現れなければコネクションを切断する
|
||||
this.disposeTimerId = setTimeout(() => {
|
||||
this.disconnect();
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
public connect(): void {
|
||||
if (this.isConnected) return;
|
||||
this.isConnected = true;
|
||||
this.stream.send("connect", {
|
||||
channel: this.channel,
|
||||
id: this.id,
|
||||
});
|
||||
}
|
||||
|
||||
private disconnect(): void {
|
||||
this.stream.off("_disconnected_", this.onStreamDisconnected);
|
||||
this.stream.send("disconnect", { id: this.id });
|
||||
this.stream.removeSharedConnectionPool(this);
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class Connection<
|
||||
Channel extends AnyOf<Channels> = any,
|
||||
> extends EventEmitter<Channel["events"]> {
|
||||
public channel: string;
|
||||
protected stream: Stream;
|
||||
public abstract id: string;
|
||||
|
||||
public name?: string; // for debug
|
||||
public inCount = 0; // for debug
|
||||
public outCount = 0; // for debug
|
||||
|
||||
constructor(stream: Stream, channel: string, name?: string) {
|
||||
super();
|
||||
|
||||
this.stream = stream;
|
||||
this.channel = channel;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public send<T extends keyof Channel["receives"]>(
|
||||
type: T,
|
||||
body: Channel["receives"][T],
|
||||
): void {
|
||||
this.stream.send("ch", {
|
||||
id: this.id,
|
||||
type: type,
|
||||
body: body,
|
||||
});
|
||||
|
||||
this.outCount++;
|
||||
}
|
||||
|
||||
public abstract dispose(): void;
|
||||
}
|
||||
|
||||
class SharedConnection<
|
||||
Channel extends AnyOf<Channels> = any,
|
||||
> extends Connection<Channel> {
|
||||
private pool: Pool;
|
||||
|
||||
public get id(): string {
|
||||
return this.pool.id;
|
||||
}
|
||||
|
||||
constructor(stream: Stream, channel: string, pool: Pool, name?: string) {
|
||||
super(stream, channel, name);
|
||||
|
||||
this.pool = pool;
|
||||
this.pool.inc();
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.pool.dec();
|
||||
this.removeAllListeners();
|
||||
this.stream.removeSharedConnection(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NonSharedConnection<
|
||||
Channel extends AnyOf<Channels> = any,
|
||||
> extends Connection<Channel> {
|
||||
public id: string;
|
||||
protected params: Channel["params"];
|
||||
|
||||
constructor(
|
||||
stream: Stream,
|
||||
channel: string,
|
||||
id: string,
|
||||
params: Channel["params"],
|
||||
) {
|
||||
super(stream, channel);
|
||||
|
||||
this.params = params;
|
||||
this.id = id;
|
||||
|
||||
this.connect();
|
||||
}
|
||||
|
||||
public connect(): void {
|
||||
this.stream.send("connect", {
|
||||
channel: this.channel,
|
||||
id: this.id,
|
||||
params: this.params,
|
||||
});
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.removeAllListeners();
|
||||
this.stream.send("disconnect", { id: this.id });
|
||||
this.stream.disconnectToChannel(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
import type {
|
||||
Antenna,
|
||||
CustomEmoji,
|
||||
DriveFile,
|
||||
MeDetailed,
|
||||
MessagingMessage,
|
||||
Note,
|
||||
Notification,
|
||||
PageEvent,
|
||||
User,
|
||||
UserGroup,
|
||||
} from "./entities";
|
||||
|
||||
type FIXME = any;
|
||||
|
||||
export 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;
|
||||
callSignal: (payload: {
|
||||
fromUserId: User["id"];
|
||||
to: string;
|
||||
toUserId?: string;
|
||||
sessionId: string;
|
||||
kind: "audio" | "video";
|
||||
signal: any;
|
||||
}) => 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"];
|
||||
};
|
||||
};
|
||||
};
|
||||
reversi: {
|
||||
params: null;
|
||||
events: {
|
||||
invited: (payload: { user: User }) => void;
|
||||
matched: (payload: { game: any }) => void;
|
||||
};
|
||||
receives: null;
|
||||
};
|
||||
reversiGame: {
|
||||
params: {
|
||||
gameId: string;
|
||||
};
|
||||
events: {
|
||||
changeReadyStates: (payload: { user1: boolean; user2: boolean }) => void;
|
||||
updateSettings: (payload: { userId: User["id"]; key: string; value: any }) => void;
|
||||
started: (payload: { game: any }) => void;
|
||||
log: (payload: { time: number; player: boolean; operation: "put"; pos: number; id: string | null }) => void;
|
||||
ended: (payload: { winnerId: User["id"] | null; game: any }) => void;
|
||||
canceled: (payload: { userId: User["id"] }) => void;
|
||||
};
|
||||
receives: {
|
||||
ready: boolean;
|
||||
updateSettings: { key: string; value: any };
|
||||
cancel: null;
|
||||
putStone: { pos: number; id: string };
|
||||
claimTimeIsUp: null;
|
||||
};
|
||||
};
|
||||
shogi: {
|
||||
params: null;
|
||||
events: {
|
||||
invited: (payload: { user: User }) => void;
|
||||
matched: (payload: { game: any }) => void;
|
||||
};
|
||||
receives: null;
|
||||
};
|
||||
shogiGame: {
|
||||
params: {
|
||||
gameId: string;
|
||||
};
|
||||
events: {
|
||||
changeReadyStates: (payload: { user1: boolean; user2: boolean }) => void;
|
||||
started: (payload: { game: any }) => void;
|
||||
log: (payload: { id: string | null; at: number; userId: User["id"]; usi: string; sfen: string }) => void;
|
||||
ended: (payload: { winnerId: User["id"] | null; game: any }) => void;
|
||||
canceled: (payload: { userId: User["id"] }) => void;
|
||||
};
|
||||
receives: {
|
||||
ready: boolean;
|
||||
cancel: null;
|
||||
move: { usi: string; id: string };
|
||||
};
|
||||
};
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type NoteUpdatedEvent =
|
||||
| {
|
||||
id: Note["id"];
|
||||
type: "reacted";
|
||||
body: {
|
||||
reaction: string;
|
||||
userId: User["id"];
|
||||
groupId?: UserGroup["id"] | null;
|
||||
};
|
||||
}
|
||||
| {
|
||||
id: Note["id"];
|
||||
type: "unreacted";
|
||||
body: {
|
||||
reaction: string;
|
||||
userId: User["id"];
|
||||
groupId?: UserGroup["id"] | null;
|
||||
};
|
||||
}
|
||||
| {
|
||||
id: Note["id"];
|
||||
type: "deleted";
|
||||
body: {
|
||||
deletedAt: string;
|
||||
};
|
||||
}
|
||||
| {
|
||||
id: Note["id"];
|
||||
type: "pollVoted";
|
||||
body: {
|
||||
choice: number;
|
||||
userId: User["id"];
|
||||
};
|
||||
}
|
||||
| {
|
||||
id: Note["id"];
|
||||
type: "replied";
|
||||
body: {
|
||||
id: Note["id"];
|
||||
};
|
||||
}
|
||||
| {
|
||||
id: Note["id"];
|
||||
type: "updated";
|
||||
body: {
|
||||
updatedAt: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type BroadcastEvents = {
|
||||
noteUpdated: (payload: NoteUpdatedEvent) => void;
|
||||
emojiAdded: (payload: {
|
||||
emoji: CustomEmoji;
|
||||
}) => void;
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "./built/",
|
||||
"removeComments": true,
|
||||
"strict": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"experimentalDecorators": true,
|
||||
"noImplicitReturns": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "test/**/*"]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["src/*.ts"],
|
||||
outDir: "built",
|
||||
format: ["cjs"],
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
dts: false,
|
||||
});
|
||||
Reference in New Issue
Block a user