Class JikeClient

Hierarchy

Constructors

  • Parameters

    • __namedParameters: Partial<ApiConfigResolved> & Pick<ApiConfigResolved, "endpointId" | "endpointUrl" | "bundleId" | "appVersion" | "buildNo" | "userAgent"> & {
          refreshToken?: string;
      }

    Returns JikeClient

Properties

#client: {
    comments: api/comments;
    mediaMeta: api/media-meta;
    notifications: api/notifications;
    personalUpdate: api/personal-update;
    posts: api/posts;
    recommendFeed: api/recommend-feed;
    stories: api/stories;
    topics: api/topics;
    upload: api/upload;
    userRelation: api/user-relation;
    users: api/users;
}

Type declaration

#refreshToken: string
#userCache: {
    [userSelfKey]?: JikeUser<true>;
} & Record<string, JikeUser<boolean>> = {}
prefixed: string | boolean

Accessors

  • get accessToken(): string
  • Returns string

  • set accessToken(token): void
  • Parameters

    • token: string

    Returns void

  • get refreshToken(): string
  • Returns string

Methods

  • Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, "renewToken">]

          Returns void

    • Optional context: any

    Returns JikeClient

  • Parameters

    • __namedParameters: BeforeRetryState

    Returns Promise<boolean>

  • Returns void

  • Parameters

    Returns Promise<{
        post: JikePostWithDetail;
        toast: string;
    }>

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<EventMap>[Extract<T, "renewToken">]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns "renewToken"[]

  • 获取用户

    Type Parameters

    • M extends boolean = boolean

      是否为自己

      • true: 是
      • false: 否
      • boolean: 未知 (默认)

    Parameters

    • username: string

      用户名

    Returns JikeUser<boolean>

    JikeUser 实例

  • Return the number of listeners listening to a given event.

    Parameters

    • event: "renewToken"

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • 密码登录

    Throws

    RequestFailureError 请求失败错误

    Parameters

    • areaCode: string | number

      区号,如 +86

    • mobile: string

      手机号

    • password: string

      密码

    Returns Promise<void>

  • 短信登录

    Throws

    RequestFailureError 请求失败错误

    Parameters

    • areaCode: string | number

      区号,如 +86

    • mobile: string

      手机号

    • smsCode: string | number

      短信验证码

    Returns Promise<void>

  • Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, "renewToken">]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns JikeClient

  • Add a listener for a given event.

    Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, "renewToken">]

          Returns void

    • Optional context: any

    Returns JikeClient

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, "renewToken">]

          Returns void

    • Optional context: any

    Returns JikeClient

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: "renewToken"

    Returns JikeClient

  • Remove the listeners of a given event.

    Type Parameters

    • T extends "renewToken"

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, "renewToken">]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns JikeClient

  • 刷新 access token

    Returns Promise<void>

  • 发送短信验证码

    Throws

    RequestFailureError 请求失败错误

    Parameters

    • areaCode: string | number

      区号,如 +86

    • mobile: string

      手机号

    Returns Promise<void>

  • 序列化

    Parameters

    • space: number = 0

      缩进空格数

    Returns Promise<string>

  • 反序列化

    Parameters

    • data: string

      数据

    Returns JikeClient

Generated using TypeDoc