Class LemmyHttp

Helps build lemmy HTTP requests.

Hierarchy

  • LemmyHttp

Constructors

  • Generates a new instance of LemmyHttp.

    Parameters

    • baseUrl: string

      the base url, without the vX version: https://lemmy.ml -> goes to https://lemmy.ml/api/vX

    • Optional options: {
          fetchFunction?: ((input, init?) => Promise<Response>);
          headers?: {
              [key: string]: string;
          };
      }
      • Optional fetchFunction?: ((input, init?) => Promise<Response>)
          • (input, init?): Promise<Response>
          • Parameters

            • input: RequestInfo | URL
            • Optional init: RequestInit

            Returns Promise<Response>

      • Optional headers?: {
            [key: string]: string;
        }
        • [key: string]: string

    Returns LemmyHttp

Properties

#apiUrl: string
#fetchFunction: ((input, init?) => Promise<Response>) = fetch

Type declaration

    • (input, init?): Promise<Response>
    • Parameters

      • input: RequestInfo | URL
      • Optional init: RequestInit

      Returns Promise<Response>

#headers: {
    [key: string]: string;
} = {}

Type declaration

  • [key: string]: string
#pictrsUrl: string

Methods

  • Parameters

    • endpoint: string

    Returns string

  • Type Parameters

    • BodyType extends object

    • ResponseType

    Parameters

    • type_: HttpType
    • endpoint: string
    • form: BodyType

    Returns Promise<ResponseType>

  • Delete your account.

    HTTP.POST /user/delete_account

    Parameters

    Returns Promise<null>

  • A moderator can feature a community post ( IE stick it to the top of a community ).

    HTTP.POST /post/feature

    Parameters

    Returns Promise<PostResponse>

  • A moderator can lock a post ( IE disable new comments ).

    HTTP.POST /post/lock

    Parameters

    Returns Promise<PostResponse>

  • Log into lemmy.

    HTTP.POST /user/login

    Parameters

    Returns Promise<LoginResponse>

  • Reset your password.

    HTTP.POST /user/password_reset

    Parameters

    Returns Promise<null>

  • A moderator remove for a post.

    HTTP.POST /post/remove

    Parameters

    Returns Promise<PostResponse>

  • Verify your email

    HTTP.POST /user/verify_email

    Parameters

    Returns Promise<null>

Generated using TypeDoc