Options
All
  • Public
  • Public/Protected
  • All
Menu
name

Anilist

Hierarchy

  • default

Index

Constructors

constructor

  • new default(options?: Options): default

Properties

Private api

api: AxiosInstance

Private token

token: null | string

Methods

generateAuthUrl

  • generateAuthUrl(__namedParameters: { state: string }): string
  • Generate Auth Url to authenticate users.

    Parameters

    • __namedParameters: { state: string }
      • state: string

        Data you would like to share to the callback.

    Returns string

getAccessTokenFromCode

  • getAccessTokenFromCode(code: string): Promise<{ access_token: string; expires_in: number; refresh_token: string; token_type: "Bearer" }>
  • Parameters

    • code: string

    Returns Promise<{ access_token: string; expires_in: number; refresh_token: string; token_type: "Bearer" }>

setAccessToken

  • setAccessToken(token: string): void
  • Set access token to the instance.

    Parameters

    • token: string

      The accessToken of the User.

    Returns void

useGraphQL

  • useGraphQL(query: string, variables?: any): Promise<any>
  • Use custom Graphql queries.

    const anilist = new Anilist(token)
    
    anilist.useGraphQl(`
    query MyQuery($id: Int!){
     someQuery(id: $id){
     name
    }
    }
    `, {
     id: 123
    })
    

    Parameters

    • query: string

      GraphQL query.

    • Optional variables: any

      Variables.

    Returns Promise<any>

Legend

  • Constructor
  • Method
  • Private property

Generated using TypeDoc