From 2ab80a00a5564c4bcc87016fcf20082f30340786 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sat, 23 Sep 2023 15:17:39 -0700 Subject: [PATCH] fix indents --- megalodon/src/firefish/api_client.ts | 80 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/megalodon/src/firefish/api_client.ts b/megalodon/src/firefish/api_client.ts index 41196eb49..9064b4213 100644 --- a/megalodon/src/firefish/api_client.ts +++ b/megalodon/src/firefish/api_client.ts @@ -267,7 +267,7 @@ namespace FirefishAPI { plain_content: n.text ? n.text : null, created_at: n.createdAt, // Remove reaction emojis with names containing @ from the emojis list. - emojis: Array.isArray(n.emojis) ? n.emojis + emojis: Array.isArray(n.emojis) ? n.emojis .filter((e) => e.name.indexOf("@") === -1) .map((e) => emoji(e)) : [], replies_count: n.repliesCount, @@ -288,7 +288,7 @@ namespace FirefishAPI { language: null, pinned: null, // Use emojis list to provide URLs for emoji reactions. - emoji_reactions: mapReactions(n.emojis!, n.reactions, n.myReaction), + emoji_reactions: mapReactions(n.emojis!, n.reactions, n.myReaction), bookmarked: false, quote: n.renote !== undefined && n.text !== null } @@ -296,24 +296,24 @@ namespace FirefishAPI { export const mapReactions = (emojis: Array, r: { [key: string]: number }, myReaction?: string | null): Array => { // Map of emoji shortcodes to image URLs. - const emojiUrls = new Map( - emojis.map((e) => [e.name, e.url]), - ); + const emojiUrls = new Map( + emojis.map((e) => [e.name, e.url]), + ); return Object.keys(r).map(key => { // Strip colons from custom emoji reaction names to match emoji shortcodes. - const shortcode = key.replace(/:/g, ""); - // If this is a custom emoji (vs. a Unicode emoji), find its image URL. - const url = emojiUrls.get(shortcode); - // Finally, remove trailing @. from local custom emoji reaction names. - const name = shortcode.replace("@.", ""); + const shortcode = key.replace(/:/g, ""); + // If this is a custom emoji (vs. a Unicode emoji), find its image URL. + const url = emojiUrls.get(shortcode); + // Finally, remove trailing @. from local custom emoji reaction names. + const name = shortcode.replace("@.", ""); return { count: r[key], me: key === myReaction, - name, - url, - // We don't actually have a static version of the asset, but clients expect one anyway. - static_url: url, + name, + url, + // We don't actually have a static version of the asset, but clients expect one anyway. + static_url: url, } }) @@ -567,8 +567,8 @@ namespace FirefishAPI { ] /** - * Interface - */ + * Interface + */ export interface Interface { get(path: string, params?: any, headers?: { [key: string]: string }): Promise> post(path: string, params?: any, headers?: { [key: string]: string }): Promise> @@ -577,10 +577,10 @@ namespace FirefishAPI { } /** - * Firefish API client. - * - * Usign axios for request, you will handle promises. - */ + * Firefish API client. + * + * Usign axios for request, you will handle promises. + */ export class Client implements Interface { private accessToken: string | null private baseUrl: string @@ -589,11 +589,11 @@ namespace FirefishAPI { private proxyConfig: ProxyConfig | false = false /** - * @param baseUrl hostname or base URL - * @param accessToken access token from OAuth2 authorization - * @param userAgent UserAgent is specified in header on request. - * @param proxyConfig Proxy setting, or set false if don't use proxy. - */ + * @param baseUrl hostname or base URL + * @param accessToken access token from OAuth2 authorization + * @param userAgent UserAgent is specified in header on request. + * @param proxyConfig Proxy setting, or set false if don't use proxy. + */ constructor(baseUrl: string, accessToken: string | null, userAgent: string = DEFAULT_UA, proxyConfig: ProxyConfig | false = false) { this.accessToken = accessToken this.baseUrl = baseUrl @@ -604,8 +604,8 @@ namespace FirefishAPI { } /** - * GET request to firefish API. - **/ + * GET request to firefish API. + **/ public async get(path: string, params: any = {}, headers: { [key: string]: string } = {}): Promise> { let options: AxiosRequestConfig = { params: params, @@ -631,11 +631,11 @@ namespace FirefishAPI { } /** - * POST request to firefish REST API. - * @param path relative path from baseUrl - * @param params Form data - * @param headers Request header object - */ + * POST request to firefish REST API. + * @param path relative path from baseUrl + * @param params Form data + * @param headers Request header object + */ public async post(path: string, params: any = {}, headers: { [key: string]: string } = {}): Promise> { let options: AxiosRequestConfig = { headers: headers, @@ -670,19 +670,19 @@ namespace FirefishAPI { } /** - * Cancel all requests in this instance. - * @returns void - */ + * Cancel all requests in this instance. + * @returns void + */ public cancel(): void { return this.abortController.abort() } /** - * Get connection and receive websocket connection for Firefish API. - * - * @param channel Channel name is user, localTimeline, hybridTimeline, globalTimeline, conversation or list. - * @param listId This parameter is required only list channel. - */ + * Get connection and receive websocket connection for Firefish API. + * + * @param channel Channel name is user, localTimeline, hybridTimeline, globalTimeline, conversation or list. + * @param listId This parameter is required only list channel. + */ public socket( channel: 'user' | 'localTimeline' | 'hybridTimeline' | 'globalTimeline' | 'conversation' | 'list', listId?: string