Add pl-api to workspace

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-08-28 13:43:23 +02:00
parent 966b04fdf0
commit 036fa32cd3
114 changed files with 11923 additions and 1 deletions

View File

@@ -0,0 +1,67 @@
import type { LanguageParam, OnlyEventsParam, OnlyMediaParam, PaginationParams, WithMutedParam, WithRelationshipsParam } from './common';
type GetAccountParams = WithMutedParam;
interface GetAccountStatusesParams extends PaginationParams, WithMutedParam, OnlyEventsParam, OnlyMediaParam, LanguageParam {
/** Boolean. Filter out statuses in reply to a different account. */
exclude_replies?: boolean;
/** Boolean. Filter for pinned statuses only. Defaults to false, which includes all statuses. Pinned statuses do not receive special priority in the order of the returned results. */
pinned?: boolean;
/** String. Filter for statuses using a specific hashtag. */
tagged?: string;
}
type GetAccountFollowersParams = PaginationParams & WithRelationshipsParam;
type GetAccountFollowingParams = PaginationParams & WithRelationshipsParam;
interface FollowAccountParams {
/** Boolean. Receive this accounts reblogs in home timeline? Defaults to true. */
reblogs?: boolean;
/** Boolean. Receive notifications when this account posts a status? Defaults to false. */
notify?: boolean;
/**
* Array of String (ISO 639-1 language two-letter code). Filter received statuses for these languages. If not provided, you will receive this accounts posts in all languages.
* Requires `features.followAccountLangugaes`.
*/
languages?: string[];
}
interface GetRelationshipsParams {
/** Boolean. Whether relationships should be returned for suspended users, defaults to false. */
with_suspended?: boolean;
}
interface SearchAccountParams {
/** Integer. Maximum number of results. Defaults to 40 accounts. Max 80 accounts. */
limit?: number;
/** Integer. Skip the first n results. */
offset?: number;
/** Boolean. Attempt WebFinger lookup. Defaults to false. Use this when `q` is an exact address. */
resolve?: boolean;
/** Boolean. Limit the search to users you are following. Defaults to false. */
following?: boolean;
}
interface ReportAccountParams {
status_ids?: string[];
comment?: string;
forward?: boolean;
category?: 'spam' | 'legal' | 'violation' | 'other';
rule_ids?: string[];
}
type GetAccountEndorsementsParams = WithRelationshipsParam;
type GetAccountFavouritesParams = PaginationParams;
export type {
GetAccountParams,
GetAccountStatusesParams,
GetAccountFollowersParams,
GetAccountFollowingParams,
FollowAccountParams,
GetRelationshipsParams,
SearchAccountParams,
ReportAccountParams,
GetAccountEndorsementsParams,
GetAccountFavouritesParams,
};

View File

@@ -0,0 +1,200 @@
import type { PaginationParams } from './common';
interface AdminGetAccountsParams extends PaginationParams {
/** String. Filter for `local` or `remote` accounts. */
origin?: 'local' | 'remote';
/** String. Filter for `active`, `pending`, `disabled`, `silenced`, or suspended accounts. */
status?: 'active' | 'pending' | 'disabled' | 'silenced' | 'suspended';
/** String. Filter for accounts with `staff` permissions (users that can manage reports). */
permissions?: 'staff';
/** Array of String. Filter for users with these roles. */
role_ids?: string[];
/** String. Lookup users invited by the account with this ID. */
invited_by?: string;
/** String. Search for the given username. */
username?: string;
/** String. Search for the given display name */
display_name?: string;
/** String. Filter by the given domain */
by_domain?: string;
/** String. Lookup a user with this email */
email?: string;
/** String. Lookup users with this IP address */
ip?: string;
}
type AdminAccountAction = 'none' | 'sensitive' | 'disable' | 'silence' | 'suspend';
interface AdminPerformAccountActionParams {
/** String. The ID of an associated report that caused this action to be taken. */
report_id?: string;
/** String. The ID of a preset warning. */
warning_preset_id?: string;
/** String. Additional clarification for why this action was taken. */
text?: string;
/** Boolean. Should an email be sent to the user with the above information? */
send_email_notification?: boolean;
}
type AdminGetDomainBlocksParams = PaginationParams;
interface AdminCreateDomainBlockParams {
/** String. Whether to apply a `silence`, `suspend`, or `noop` to the domain. Defaults to `silence` */
severity?: 'silence' | 'suspend' | 'noop';
/** Boolean. Whether media attachments should be rejected. Defaults to false */
reject_media?: boolean;
/** Boolean. Whether reports from this domain should be rejected. Defaults to false */
reject_reports?: boolean;
/** String. A private note about this domain block, visible only to admins. */
private_comment?: string;
/** String. A public note about this domain block, optionally shown on the about page. */
public_comment?: string;
/** Boolean. Whether to partially censor the domain when shown in public. Defaults to false */
obfuscate?: boolean;
}
type AdminUpdateDomainBlockParams = AdminCreateDomainBlockParams;
interface AdminGetReportsParams extends PaginationParams {
/** Boolean. Filter for resolved reports? */
resolved?: boolean;
/** String. Filter for reports filed by this account. */
account_id?: string;
/** String. Filter for reports targeting this account. */
target_account_id?: string;
}
interface AdminUpdateReportParams {
/** String. Change the classification of the report to `spam`, `violation`, or `other`. */
category?: 'spam' | 'violation' | 'other';
/** Array of Integer. For `violation` category reports, specify the ID of the exact rules broken. Rules and their IDs are available via [GET /api/v1/instance/rules](https://docs.joinmastodon.org/methods/instance/#rules) and [GET /api/v1/instance](https://docs.joinmastodon.org/methods/instance/#get). */
rule_ids?: string[];
}
interface AdminGetStatusesParams {
limit?: number;
local_only?: boolean;
with_reblogs?: boolean;
with_private?: boolean;
}
interface AdminUpdateStatusParams {
sensitive?: boolean;
visibility?: 'public' | 'private' | 'unlisted';
}
type AdminGetCanonicalEmailBlocks = PaginationParams;
type AdminDimensionKey = 'languages' | 'sources' | 'servers' | 'space_usage' | 'software_versions' | 'tag_servers' | 'tag_languages' | 'instance_accounts' | 'instance_languages';
interface AdminGetDimensionsParams {
/** String (ISO 8601 Datetime). The start date for the time period. If a time is provided, it will be ignored. */
start_at?: string;
/** String (ISO 8601 Datetime). The end date for the time period. If a time is provided, it will be ignored. */
end_at?: string;
/** Integer. The maximum number of results to return for sources, servers, languages, tag or instance dimensions. */
limit?: number;
tag_servers?: {
/** String. When tag_servers is one of the requested keys, you must provide a trending tag ID to obtain information about which servers are posting the tag. */
id?: string;
};
tag_languages?: {
/** String. When tag_languages is one of the requested keys, you must provide a trending tag ID to obtain information about which languages are posting the tag. */
id?: string;
};
instance_accounts?: {
/** String. When instance_accounts is one of the requested keys, you must provide a domain to obtain information about popular accounts from that server. */
domain?: string;
};
instance_languages?: {
/** String. When instance_accounts is one of the requested keys, you must provide a domain to obtain information about popular languages from that server. */
domain?: string;
};
}
type AdminGetDomainAllowsParams = PaginationParams;
type AdminGetEmailDomainBlocksParams = PaginationParams;
type AdminGetIpBlocksParams = PaginationParams;
interface AdminCreateIpBlockParams {
/** String. The IP address and prefix to block. Defaults to 0.0.0.0/32 */
ip?: string;
/** String. The policy to apply to this IP range: sign_up_requires_approval, sign_up_block, or no_access */
severity: string;
/** String. The reason for this IP block. */
comment?: string;
/** Integer. The number of seconds in which this IP block will expire. */
expires_in?: number;
}
type AdminUpdateIpBlockParams = Partial<AdminCreateIpBlockParams>;
type AdminMeasureKey = 'active_users' | 'new_users' | 'interactions' | 'opened_reports' | 'resolved_reports' | 'tag_accounts' | 'tag_uses' | 'tag_servers' | 'instance_accounts' | 'instance_media_attachments' | 'instance_reports' | 'instance_statuses' | 'instance_follows' | 'instance_followers';
interface AdminGetMeasuresParams {
tag_accounts?: {
/** String. When `tag_accounts` is one of the requested keys, you must provide a tag ID to obtain the measure of how many accounts used that hashtag in at least one status within the given time period. */
id?: string;
};
tag_uses?: {
/** String. When `tag_uses` is one of the requested keys, you must provide a tag ID to obtain the measure of how many statuses used that hashtag within the given time period. */
id?: string;
};
tag_servers?: {
/** String. When `tag_servers` is one of the requested keys, you must provide a tag ID to obtain the measure of how many servers used that hashtag in at least one status within the given time period. */
id?: string;
};
instance_accounts?: {
/** String. When `instance_accounts` is one of the requested keys, you must provide a remote domain to obtain the measure of how many accounts have been discovered from that server within the given time period. */
domain?: string;
};
instance_media_attachments?: {
/** String. When `instance_media_attachments` is one of the requested keys, you must provide a remote domain to obtain the measure of how much space is used by media attachments from that server within the given time period. */
domain?: string;
};
instance_reports?: {
/** String. When `instance_reports` is one of the requested keys, you must provide a remote domain to obtain the measure of how many reports have been filed against accounts from that server within the given time period. */
domain?: string;
};
instance_statuses?: {
/** String. When `instance_statuses` is one of the requested keys, you must provide a remote domain to obtain the measure of how many statuses originate from that server within the given time period. */
domain?: string;
};
instance_follows?: {
/** String. When `instance_follows` is one of the requested keys, you must provide a remote domain to obtain the measure of how many follows were performed on accounts from that server by local accounts within the given time period. */
domain?: string;
};
instance_followers?: {
/** String. When `instance_followers` is one of the requested keys, you must provide a remote domain to obtain the measure of how many follows were performed by accounts from that server on local accounts within the given time period. */
domain?: string;
};
}
interface AdminGetGroupsParams {
}
export type {
AdminGetAccountsParams,
AdminAccountAction,
AdminPerformAccountActionParams,
AdminGetDomainBlocksParams,
AdminCreateDomainBlockParams,
AdminUpdateDomainBlockParams,
AdminGetReportsParams,
AdminUpdateReportParams,
AdminGetStatusesParams,
AdminUpdateStatusParams,
AdminGetCanonicalEmailBlocks,
AdminDimensionKey,
AdminGetDimensionsParams,
AdminGetDomainAllowsParams,
AdminGetEmailDomainBlocksParams,
AdminGetIpBlocksParams,
AdminCreateIpBlockParams,
AdminUpdateIpBlockParams,
AdminMeasureKey,
AdminGetMeasuresParams,
AdminGetGroupsParams,
};

View File

@@ -0,0 +1,14 @@
interface CreateApplicationParams {
/** String. A name for your application */
client_name: string;
/** String. Where the user should be redirected after authorization. To display the authorization code to the user instead of redirecting to a web page, use `urn:ietf:wg:oauth:2.0:oob` in this parameter. */
redirect_uris: string;
/** String. Space separated list of scopes. If none is provided, defaults to `read`. See [OAuth Scopes](https://docs.joinmastodon.org/api/oauth-scopes/) for a list of possible scopes. */
scopes?: string;
/** String. A URL to the homepage of your app */
website?: string;
}
export type {
CreateApplicationParams,
};

View File

@@ -0,0 +1,18 @@
import { PaginationParams, WithMutedParam } from './common';
type GetChatsParams = PaginationParams & WithMutedParam;
type GetChatMessagesParams = PaginationParams;
type CreateChatMessageParams = {
content?: string;
media_id: string;
} | {
content: string;
media_id?: string;
};
export type {
GetChatsParams,
GetChatMessagesParams,
CreateChatMessageParams,
};

View File

@@ -0,0 +1,59 @@
interface PaginationParams {
/** String. All results returned will be lesser than this ID. In effect, sets an upper bound on results. */
max_id?: string;
/** String. All results returned will be greater than this ID. In effect, sets a lower bound on results. */
since_id?: string;
/** Integer. Maximum number of results to return. */
limit?: number;
/** String. Returns results immediately newer than this ID. In effect, sets a cursor at this ID and paginates forward. */
min_id?: string;
}
interface WithMutedParam {
/**
* Boolean. Also show statuses from muted users. Default to false.
*
* Requires `features.timelinesWithMuted`.
*/
with_muted?: boolean;
}
interface WithRelationshipsParam {
/**
* Embed relationships into accounts.
* Supported by Pleroma.
*/
with_relationships?: boolean;
}
interface OnlyMediaParam {
/** Boolean. Show only statuses with media attached? Defaults to false. */
only_media?: boolean;
}
interface OnlyEventsParam {
/**
* Boolean. Filter out statuses without events.
*
* Requires `features.events`.
*/
only_events?: boolean;
}
interface LanguageParam {
/**
* Fetch a translation in given language
*
* Requires `features.fetchStatusesWithTranslation`.
*/
language?: string;
}
export type {
PaginationParams,
WithMutedParam,
WithRelationshipsParam,
OnlyMediaParam,
OnlyEventsParam,
LanguageParam,
};

View File

@@ -0,0 +1,33 @@
import { PaginationParams } from './common';
interface CreateEventParams {
/** name of the event */
name: string;
/** optional, description of the event */
status?: string;
/** optional, event banner attachment ID */
banner_id?: string;
/** start time of the event */
start_time?: string;
/** optional, end time of the event */
end_time?: string;
/** optional, event join mode, either free or restricted, defaults to free */
join_mode?: 'free' | 'restricted';
/** optional, location ID from the location provider used by server */
location_id?: string;
/** string, contain the MIME type of the status. */
content_type?: string;
}
type EditEventParams = Partial<Omit<CreateEventParams, 'join_mode'>>;
type GetJoinedEventsParams = PaginationParams;
type GetEventParticipationsParams = PaginationParams;
type GetEventParticipationRequestsParams = PaginationParams;
export type {
CreateEventParams,
EditEventParams,
GetJoinedEventsParams,
GetEventParticipationsParams,
GetEventParticipationRequestsParams,
};

View File

@@ -0,0 +1,48 @@
import type { PaginationParams, WithRelationshipsParam } from './common';
interface MuteAccountParams {
/** Boolean. Mute notifications in addition to statuses? Defaults to true. */
notifications?: boolean;
/** Number. How long the mute should last, in seconds. Defaults to 0 (indefinite). */
duration?: number;
}
type GetMutesParams = Omit<PaginationParams, 'min_id'> & WithRelationshipsParam;
type GetBlocksParams = PaginationParams & WithRelationshipsParam;
type GetDomainBlocksParams = PaginationParams;
type FilterContext = 'home' | 'notifications' | 'public' | 'thread' | 'account';
interface CreateFilterParams {
title: string;
context: Array<FilterContext>;
filter_action?: 'warn' | 'hide';
expires_in?: number;
keywords_attributes: Array<{
keyword: string;
whole_word?: boolean;
}>;
}
interface UpdateFilterParams {
title?: string;
context?: Array<FilterContext>;
filter_action?: 'warn' | 'hide';
expires_in?: number;
keywords_attributes?: Array<{
keyword: string;
whole_word?: boolean;
id?: string;
_destroy?: boolean;
}>;
}
export type {
MuteAccountParams,
GetMutesParams,
GetBlocksParams,
GetDomainBlocksParams,
FilterContext,
CreateFilterParams,
UpdateFilterParams,
};

View File

@@ -0,0 +1,27 @@
import type { PaginationParams } from './common';
interface CreateGroupParams {
display_name: string;
note?: string;
avatar?: File;
header?: File;
}
interface UpdateGroupParams {
display_name?: string;
note?: string;
avatar?: File | '';
header?: File | '';
}
type GetGroupMembershipsParams = Omit<PaginationParams, 'min_id'>;
type GetGroupMembershipRequestsParams = Omit<PaginationParams, 'min_id'>;
type GetGroupBlocksParams = Omit<PaginationParams, 'min_id'>;
export type {
CreateGroupParams,
UpdateGroupParams,
GetGroupMembershipsParams,
GetGroupMembershipRequestsParams,
GetGroupBlocksParams,
};

View File

@@ -0,0 +1,21 @@
export * from './accounts';
export * from './admin';
export * from './apps';
export * from './chats';
export * from './events';
export * from './filtering';
export * from './groups';
export * from './instance';
export * from './interaction-requests';
export * from './lists';
export * from './media';
export * from './my-account';
export * from './notifications';
export * from './oauth';
export * from './push-notifications';
export * from './scheduled-statuses';
export * from './search';
export * from './settings';
export * from './statuses';
export * from './timelines';
export * from './trends';

View File

@@ -0,0 +1,14 @@
interface ProfileDirectoryParams {
/** Number. Skip the first n results. */
offset?: number;
/** Number. How many accounts to load. Defaults to 40 accounts. Max 80 accounts. */
limit?: number;
/** String. Use active to sort by most recently posted statuses (default) or new to sort by most recently created profiles. */
order?: string;
/** Boolean. If true, returns only local accounts. */
local?: boolean;
}
export type {
ProfileDirectoryParams,
};

View File

@@ -0,0 +1,16 @@
import { PaginationParams } from './common';
interface GetInteractionRequestsParams extends PaginationParams {
/** If set, then only interactions targeting the given status_id will be included in the results. */
status_id?: string;
/** If true or not set, pending favourites will be included in the results. At least one of favourites, replies, and reblogs must be true. */
favourites?: boolean;
/** If true or not set, pending replies will be included in the results. At least one of favourites, replies, and reblogs must be true. */
replies?: boolean;
/** If true or not set, pending reblogs will be included in the results. At least one of favourites, replies, and reblogs must be true. */
reblogs?: boolean;
}
export type {
GetInteractionRequestsParams,
};

View File

@@ -0,0 +1,19 @@
import type { PaginationParams } from './common';
interface CreateListParams {
/** String. The title of the list to be created. */
title: string;
/** String. One of followed, list, or none. Defaults to list. */
replies_policy?: 'followed' | 'list' | 'none';
/** Boolean. Whether members of this list need to get removed from the “Home” feed */
exclusive?: boolean;
}
type UpdateListParams = CreateListParams;
type GetListAccountsParams = PaginationParams;
export type {
CreateListParams,
UpdateListParams,
GetListAccountsParams,
};

View File

@@ -0,0 +1,30 @@
interface UploadMediaParams {
/** Object. The file to be attached, encoded using multipart form data. The file must have a MIME type. */
file: File;
/** Object. The custom thumbnail of the media to be attached, encoded using multipart form data. */
thumbnail?: File;
/** String. A plain-text description of the media, for accessibility purposes. */
description?: string;
/**
* String. Two floating points (x,y), comma-delimited, ranging from -1.0 to 1.0. See Focal points for cropping media thumbnails for more information.
* @see {@link https://docs.joinmastodon.org/api/guidelines/#focal-points}
*/
focus?: string;
}
interface UpdateMediaParams {
/** Object. The custom thumbnail of the media to be attached, encoded using multipart form data. */
thumbnail?: File;
/** String. A plain-text description of the media, for accessibility purposes. */
description?: string;
/**
* String. Two floating points (x,y), comma-delimited, ranging from -1.0 to 1.0. See Focal points for cropping media thumbnails for more information.
* @see {@link https://docs.joinmastodon.org/api/guidelines/#focal-points}
*/
focus?: string;
}
export type {
UploadMediaParams,
UpdateMediaParams,
};

View File

@@ -0,0 +1,31 @@
import type { PaginationParams } from './common';
interface GetBookmarksParams extends PaginationParams {
/**
* Bookmark folder ID
* Requires `features.bookmarkFolders`.
*/
folder_id?: string;
}
type GetFavouritesParams = PaginationParams;
type GetFollowRequestsParams = Omit<PaginationParams, 'min_id'>;
type GetEndorsementsParams = Omit<PaginationParams, 'min_id'>;
type GetFollowedTagsParams = PaginationParams;
interface CreateBookmarkFolderParams {
name: string;
emoji?: string;
}
type UpdateBookmarkFolderParams = Partial<CreateBookmarkFolderParams>;
export type {
GetBookmarksParams,
GetFavouritesParams,
GetFollowRequestsParams,
GetEndorsementsParams,
GetFollowedTagsParams,
CreateBookmarkFolderParams,
UpdateBookmarkFolderParams,
};

View File

@@ -0,0 +1,34 @@
import type { PaginationParams } from './common';
interface GetNotificationParams extends PaginationParams {
/** Array of String. Types to include in the result. */
types?: string[];
/** Array of String. Types to exclude from the results. */
exclude_types?: string[];
/** String. Return only notifications received from the specified account. */
account_id?: string;
/**
* will exclude the notifications for activities with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`).
* Requires `features.notificationsExcludeVisibilities`.
*/
exclude_visibilities?: string[];
}
interface UpdateNotificationPolicyRequest {
/** Boolean. Whether to filter notifications from accounts the user is not following. */
filter_not_following?: boolean;
/** Boolean. Whether to filter notifications from accounts that are not following the user. */
filter_not_followers?: boolean;
/** Boolean. Whether to filter notifications from accounts created in the past 30 days. */
filter_new_accounts?: boolean;
/** Boolean. Whether to filter notifications from private mentions. Replies to private mentions initiated by the user, as well as accounts the user follows, are never filtered. */
filter_private_mentions?: boolean;
}
type GetNotificationRequestsParams = PaginationParams;
export type {
GetNotificationParams,
UpdateNotificationPolicyRequest,
GetNotificationRequestsParams,
};

View File

@@ -0,0 +1,54 @@
interface OauthAuthorizeParams {
/** String. Should be set equal to `code`. */
response_type: string;
/** String. The client ID, obtained during app registration. */
client_id: string;
/** String. Set a URI to redirect the user to. If this parameter is set to `urn:ietf:wg:oauth:2.0:oob` then the authorization code will be shown instead. Must match one of the `redirect_uris` declared during app registration. */
redirect_uri: string;
/** String. List of requested OAuth scopes, separated by spaces (or by pluses, if using query parameters). Must be a subset of `scopes` declared during app registration. If not provided, defaults to `read`. */
scope?: string;
/** Boolean. Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance. */
force_login?: boolean;
/** String. The ISO 639-1 two-letter language code to use while rendering the authorization form. */
lang?: string;
}
interface GetTokenParams {
/** String. Set equal to `authorization_code` if `code` is provided in order to gain user-level access. Otherwise, set equal to `client_credentials` to obtain app-level access only. */
grant_type: string;
/** String. A user authorization code, obtained via [GET /oauth/authorize](https://docs.joinmastodon.org/methods/oauth/#authorize). */
code?: string;
/** String. The client ID, obtained during app registration. */
client_id: string;
/** String. The client secret, obtained during app registration. */
client_secret: string;
/** String. Set a URI to redirect the user to. If this parameter is set to urn:ietf:wg:oauth:2.0:oob then the token will be shown instead. Must match one of the `redirect_uris` declared during app registration. */
redirect_uri: string;
/** String. List of requested OAuth scopes, separated by spaces (or by pluses, if using query parameters). If `code` was provided, then this must be equal to the `scope` requested from the user. Otherwise, it must be a subset of `scopes` declared during app registration. If not provided, defaults to `read`. */
scope?: string;
}
interface RevokeTokenParams {
/** String. The client ID, obtained during app registration. */
client_id: string;
/** String. The client secret, obtained during app registration. */
client_secret: string;
/** String. The previously obtained token, to be invalidated. */
token: string;
}
interface MfaChallengeParams {
client_id: string;
client_secret: string;
/** access token to check second step of mfa */
mfa_token: string;
challenge_type: 'totp' | 'recovery';
code: string;
}
export type {
OauthAuthorizeParams,
GetTokenParams,
RevokeTokenParams,
MfaChallengeParams,
};

View File

@@ -0,0 +1,30 @@
interface CreatePushNotificationsSubscriptionParams {
subscription: {
/** String. The endpoint URL that is called when a notification event occurs. */
endpoint: string;
keys?: {
/** String. User agent public key. Base64 encoded string of a public key from a ECDH keypair using the prime256v1 curve. */
p256dh: string;
/** String. Auth secret. Base64 encoded string of 16 bytes of random data. */
auth: string;
};
};
data?: {
alerts?: Record<string, boolean>;
/** String. Specify whether to receive push notifications from `all`, `followed`, `follower`, or `none` users. */
policy?: string;
};
}
interface UpdatePushNotificationsSubscriptionParams {
data?: {
alerts?: Record<string, boolean>;
};
/** String. Specify whether to receive push notifications from `all`, `followed`, `follower`, or `none` users. */
policy?: string;
}
export type {
CreatePushNotificationsSubscriptionParams,
UpdatePushNotificationsSubscriptionParams,
};

View File

@@ -0,0 +1,7 @@
import type { PaginationParams } from './common';
type GetScheduledStatusesParams = PaginationParams;
export type {
GetScheduledStatusesParams,
};

View File

@@ -0,0 +1,20 @@
import type { PaginationParams, WithRelationshipsParam } from './common';
interface SearchParams extends Exclude<PaginationParams, 'since_id'>, WithRelationshipsParam {
/** String. Specify whether to search for only `accounts`, `hashtags`, `statuses` */
type?: 'accounts' | 'hashtags' | 'statuses' | 'groups';
/** Boolean. Only relevant if `type` includes `accounts`. If `true` and (a) the search query is for a remote account (e.g., `someaccount@someother.server`) and (b) the local server does not know about the account, WebFinger is used to try and resolve the account at `someother.server`. This provides the best recall at higher latency. If `false` only accounts the server knows about are returned. */
resolve?: boolean;
/** Boolean. Only include accounts that the user is following? Defaults to false. */
following?: boolean;
/** String. If provided, will only return statuses authored by this account. */
account_id?: string;
/** Boolean. Filter out unreviewed tags? Defaults to false. Use true when trying to find trending tags. */
exclude_unreviewed?: boolean;
/** Integer. Skip the first n results. */
offset?: number;
}
export type {
SearchParams,
};

View File

@@ -0,0 +1,146 @@
interface CreateAccountParams {
/** String. The desired username for the account */
username: string;
/** String. The email address to be used for login */
email: string;
/** String. The password to be used for login */
password: string;
/** Whether the user agrees to the local rules, terms, and policies. These should be presented to the user in order to allow them to consent before setting this parameter to TRUE. */
agreement: boolean;
/** String. The language of the confirmation email that will be sent. */
locale: string;
/** String. If registrations require manual approval, this text will be reviewed by moderators. */
reason?: string;
fullname?: string;
bio?: string;
/** optional, contains provider-specific captcha solution */
captcha_solution?: string;
/** optional, contains provider-specific captcha token */
captcha_token?: string;
/** optional, contains provider-specific captcha data */
captcha_answer_data?: string;
/** invite token required when the registrations aren't public. */
token?: string;
birthday?: string;
/** optional, domain id, if multitenancy is enabled. */
domain?: string;
accepts_email_list?: boolean;
}
interface UpdateCredentialsParams {
/** String. The display name to use for the profile. */
display_name?: string;
/** String. The account bio. */
note?: string;
/** Avatar image encoded using `multipart/form-data` */
avatar?: File | '';
/** Header image encoded using `multipart/form-data` */
header?: File | '';
/** Boolean. Whether manual approval of follow requests is required. */
locked?: boolean;
/** Boolean. Whether the account has a bot flag. */
bot?: boolean;
/** Boolean. Whether the account should be shown in the profile directory. */
discoverable?: boolean;
/** Boolean. Whether to hide followers and followed accounts. */
hide_collections?: boolean;
/** Boolean. Whether public posts should be searchable to anyone. */
indexable?: boolean;
/** Hash. The profile fields to be set. Inside this hash, the key is an integer cast to a string (although the exact integer does not matter), and the value is another hash including name and value. By default, max 4 fields. */
fields_attributes?: Array<{
/** String. The name of the profile field. By default, max 255 characters. */
name: string;
/** String. The value of the profile field. By default, max 255 characters. */
value: string;
}>;
source?: {
/** String. Default post privacy for authored statuses. Can be public, unlisted, or private. */
privacy?: string;
/** Boolean. Whether to mark authored statuses as sensitive by default. */
sensitive?: string;
/** String. Default language to use for authored statuses (ISO 6391) */
language?: string;
};
/** if true, html tags are stripped from all statuses requested from the API */
no_rich_text?: boolean;
/** if true, user's followers will be hidden*/
hide_followers?: boolean;
/** if true, user's follows will be hidden */
hide_follows?: boolean;
/** if true, user's follower count will be hidden */
hide_followers_count?: boolean;
/** if true, user's follow count will be hidden */
hide_follows_count?: boolean;
/** if true, user's favorites timeline will be hidden */
hide_favorites?: boolean;
/** if true, user's role (e.g admin, moderator) will be exposed to anyone in the API */
show_role?: boolean;
/** the scope returned under privacy key in Source subentity */
default_scope?: string;
/** Opaque user settings to be saved on the backend. */
settings_store?: Record<string, any>;
/** if true, skip filtering out broken threads */
skip_thread_containment?: boolean;
/** if true, allows automatically follow moved following accounts */
allow_following_move?: boolean;
/** array of ActivityPub IDs, needed for following move */
also_known_as?: string[];
/** sets the background image of the user. Can be set to "" (an empty string) to reset. */
background_image?: string;
/** the type of this account. */
actor_type?: string;
/** if false, this account will reject all chat messages. */
accepts_chat_messages?: boolean;
/** user's preferred language for receiving emails (digest, confirmation, etc.) */
language?: string;
/**
* Description of avatar image, for alt-text.
* Requires `features.accountAvatarDescription`.
*/
avatar_description?: boolean;
/**
* Description of header image, for alt-text.
* Requires `features.accountAvatarDescription`.
*/
header_description?: boolean;
/**
* Enable RSS feed for this account's Public posts at `/[username]/feed.rss`
* Requires `features.accountEnableRss`.
*/
enable_rss?: boolean;
}
interface UpdateNotificationSettingsParams {
/**
* blocks notifications from accounts you do not follow
*/
block_from_strangers?: boolean;
/**
* When set to true, it removes the contents of a message from the push notification.
*/
hide_notification_contents?: boolean;
}
type UpdateInteractionPoliciesParams = Record<
'public' | 'unlisted' | 'private' | 'direct',
Record<
'can_favourite' | 'can_reblog' | 'can_reply',
Record<
'always' | 'with_approval',
Array<'public' | 'followers' | 'following' | 'mutuals' | 'mentioned' | 'author' | 'me' | string>
>
>
>;
export type {
CreateAccountParams,
UpdateCredentialsParams,
UpdateNotificationSettingsParams,
UpdateInteractionPoliciesParams,
};

View File

@@ -0,0 +1,124 @@
import type { PaginationParams } from './common';
interface CreateStatusWithContent {
/** The text content of the status. If `media_ids` is provided, this becomes optional. Attaching a `poll` is optional while `status` is provided. */
status: string;
/** Array of String. Include Attachment IDs to be attached as media. If provided, `status` becomes optional, and `poll` cannot be used. */
media_ids?: string[];
}
interface CreateStatusWithMedia {
/** The text content of the status. If `media_ids` is provided, this becomes optional. Attaching a `poll` is optional while `status` is provided. */
status?: string;
/** Array of String. Include Attachment IDs to be attached as media. If provided, `status` becomes optional, and `poll` cannot be used. */
media_ids: string[];
}
interface CreateStatusOptionalParams {
poll?: {
/** Array of String. Possible answers to the poll. If provided, `media_ids` cannot be used, and poll[expires_in] must be provided. */
options: string[];
/** Integer. Duration that the poll should be open, in seconds. If provided, media_ids cannot be used, and poll[options] must be provided. */
expires_in: number;
/** Boolean. Allow multiple choices? Defaults to false. */
multiple?: boolean;
/** Boolean. Hide vote counts until the poll ends? Defaults to false. */
hide_totals?: boolean;
options_map?: Array<Record<string, string>>;
};
/** String. ID of the status being replied to, if status is a reply. */
in_reply_to_id?: string;
/** Boolean. Mark status and attached media as sensitive? Defaults to false. */
sensitive?: boolean;
/** String. Text to be shown as a warning or subject before the actual content. Statuses are generally collapsed behind this field. */
spoiler_text?: string;
/**
* String. Sets the visibility of the posted status to `public`, `unlisted`, `private`, `direct`.
* `local` — requires `features.createStatusLocalScope`.
* `list:LIST_ID` — requires `features.createStatusListScope`.
*/
visibility?: string;
/** String. ISO 639 language code for this status. */
language?: string;
/** String. ISO 8601 Datetime at which to schedule a status. Providing this parameter will cause ScheduledStatus to be returned instead of Status. Must be at least 5 minutes in the future. */
scheduled_at?: string;
/**
* boolean, if set to true the post won't be actually posted, but the status entity would still be rendered back. This could be useful for previewing rich text/custom emoji, for example.
* Requires `features.createStatusPreview`.
*/
preview?: boolean;
/**
* string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the `/api/v1/instance` endpoint.
*/
content_type?: string;
/**
* A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for post visibility are not affected by this and will still apply.
* Requires `features.createStatusExplicitAddressing`.
*/
to?: string[];
/**
* The number of seconds the posted activity should expire in. When a posted activity expires it will be deleted from the server, and a delete request for it will be federated. This needs to be longer than an hour.
* Requires `features.createStatusExpiration`.
*/
expires_in?: number;
/**
* Will reply to a given conversation, addressing only the people who are part of the recipient set of that conversation. Sets the visibility to `direct`.
* Requires `features.createStatusReplyToConversation`.
*/
in_reply_to_conversation_id?: string;
/**
* ID of the status being quoted, if any.
* Requires `features.quotePosts`.
*/
quote_id?: string;
/**
* If set to true, this status will be "local only" and will NOT be federated beyond the local timeline(s). If set to false (default), this status will be federated to your followers beyond the local timeline(s).
*/
local_only?: boolean;
group_id?: string;
status_map?: Record<string, string>;
spoiler_text_map?: Record<string, string>;
}
type CreateStatusParams = (CreateStatusWithContent | CreateStatusWithMedia) & CreateStatusOptionalParams;
interface LanguageParam {
/** Attach translated version of a post. Requires `features.autoTranslate`. */
language?: string;
}
type GetStatusParams = LanguageParam;
type GetStatusesParams = LanguageParam;
type GetStatusContextParams = LanguageParam;
type GetRebloggedByParams = Omit<PaginationParams, 'min_id'>
type GetFavouritedByParams = Omit<PaginationParams, 'min_id'>
interface EditStatusOptionalParams {
sensitive?: boolean;
spoiler_text?: string;
language?: string;
}
type EditStatusParams = (CreateStatusWithContent | CreateStatusWithMedia) & EditStatusOptionalParams;
type GetStatusQuotesParams = PaginationParams;
export type {
CreateStatusParams,
GetStatusParams,
GetStatusesParams,
GetStatusContextParams,
GetRebloggedByParams,
GetFavouritedByParams,
EditStatusParams,
GetStatusQuotesParams,
};

View File

@@ -0,0 +1,65 @@
import type { LanguageParam, OnlyEventsParam, OnlyMediaParam, PaginationParams, WithMutedParam } from './common';
interface PublicTimelineParams extends PaginationParams, WithMutedParam, OnlyEventsParam, OnlyMediaParam, LanguageParam {
/** Boolean. Show only local statuses? Defaults to false. */
local?: boolean;
/** Boolean. Show only remote statuses? Defaults to false. */
remote?: boolean;
/**
* Boolean. Show only statuses from the given domain.
*
* Requires `features.instanceTimeline`.
*/
instance?: string;
}
interface HashtagTimelineParams extends PaginationParams, WithMutedParam, OnlyEventsParam, OnlyMediaParam, LanguageParam {
/** Array of String. Return statuses that contain any of these additional tags. */
any?: string[];
/** Array of String. Return statuses that contain all of these additional tags. */
all?: string[];
/** Array of String. Return statuses that contain none of these additional tags. */
none?: string[];
/** Boolean. Show only local statuses? Defaults to false. */
local?: boolean;
/** Boolean. Show only remote statuses? Defaults to false. */
remote?: boolean;
}
type HomeTimelineParams = PaginationParams & WithMutedParam & OnlyEventsParam & LanguageParam;
type LinkTimelineParams = PaginationParams & WithMutedParam & LanguageParam;
type ListTimelineParams = PaginationParams & WithMutedParam & OnlyEventsParam & LanguageParam;
interface GetConversationsParams extends PaginationParams, LanguageParam {
/**
* Only return conversations with the given recipients (a list of user ids).
* Requires `features.conversationsByRecipients`.
* */
recipients?: string[];
}
interface SaveMarkersParams {
home?: {
/** String. ID of the last status read in the home timeline. */
last_read_id?: string;
};
notifications?: {
/** String. ID of the last notification read. */
last_read_id?: string;
};
}
type GroupTimelineParams = PaginationParams & WithMutedParam & OnlyMediaParam & LanguageParam;
type BubbleTimelineParams = PaginationParams & WithMutedParam & OnlyEventsParam & OnlyMediaParam & LanguageParam;
export type {
PublicTimelineParams,
HashtagTimelineParams,
HomeTimelineParams,
LinkTimelineParams,
ListTimelineParams,
GetConversationsParams,
SaveMarkersParams,
GroupTimelineParams,
BubbleTimelineParams,
};

View File

@@ -0,0 +1,16 @@
interface GetTrends {
/** Integer. Maximum number of results to return. */
limit?: number;
/** Integer. Skip the first n results. */
offset?: number;
}
type GetTrendingTags = GetTrends;
type GetTrendingStatuses = GetTrends;
type GetTrendingLinks = GetTrends;
export type {
GetTrendingTags,
GetTrendingStatuses,
GetTrendingLinks,
};