Options
All
  • Public
  • Public/Protected
  • All
Menu

megalodon

Index

Type aliases

ProxyConfig

ProxyConfig: { auth?: { password: string; username: string }; host: string; port: number; protocol: "http" | "https" | "socks4" | "socks4a" | "socks5" | "socks5h" | "socks" }

Type declaration

  • Optional auth?: { password: string; username: string }
    • password: string
    • username: string
  • host: string
  • port: number
  • protocol: "http" | "https" | "socks4" | "socks4a" | "socks5" | "socks5h" | "socks"

Response

Response<T>: { data: T; headers: any; status: number; statusText: string }

Type parameters

  • T = any

Type declaration

  • data: T
  • headers: any
  • status: number
  • statusText: string

Functions

Const default

  • default(sns: "mastodon" | "pleroma" | "misskey", baseUrl: string, accessToken?: null | string, userAgent?: null | string, proxyConfig?: false | ProxyConfig): MegalodonInterface
  • Get client for each SNS according to megalodon interface.

    Parameters

    • sns: "mastodon" | "pleroma" | "misskey"

      Name of your SNS, mastodon or pleroma.

    • baseUrl: string

      hostname or base URL.

    • accessToken: null | string = null

      access token from OAuth2 authorization

    • userAgent: null | string = null

      UserAgent is specified in header on request.

    • proxyConfig: false | ProxyConfig = false

      Proxy setting, or set false if don't use proxy.

    Returns MegalodonInterface

    Client instance for each SNS you specified.

Const detector

  • detector(url: string, proxyConfig?: false | ProxyConfig): Promise<"mastodon" | "pleroma" | "misskey">
  • Detect SNS type. Now support Mastodon, Pleroma and Pixelfed.

    Parameters

    • url: string

      Base URL of SNS.

    • proxyConfig: false | ProxyConfig = false

      Proxy setting, or set false if don't use proxy.

    Returns Promise<"mastodon" | "pleroma" | "misskey">

    SNS name.

Const isCancel

  • isCancel(value: any): boolean
  • Parameters

    • value: any

    Returns boolean

Generated using TypeDoc