Options
All
  • Public
  • Public/Protected
  • All
Menu

This class supports create threads that assistant can interact with.
Do not create it directly; Get it from AinftJs instance.

Hierarchy

Index

Constructors

  • new Threads(baseUrl: string, route: null | string, ain: default, ainize?: default): Threads

Properties

ain: default

The Ain object for sign and send transaction to AIN blockchain.

ainize?: default

The Ainize object for send request to AIN blockchain.

baseUrl: string = ''

The base url of api server of AINFT Factory.

route: string

The subpath of api server request url.

Methods

  • buildTxBodyForCreateThread(address: string, objectId: string, tokenId: string, __namedParameters: Thread): TransactionInput
  • Parameters

    • address: string
    • objectId: string
    • tokenId: string
    • __namedParameters: Thread

    Returns TransactionInput

  • buildTxBodyForDeleteThread(address: string, objectId: string, tokenId: string, threadId: string): TransactionInput
  • Parameters

    • address: string
    • objectId: string
    • tokenId: string
    • threadId: string

    Returns TransactionInput

  • buildTxBodyForUpdateThread(address: string, objectId: string, tokenId: string, __namedParameters: Thread): Promise<TransactionInput>
  • Parameters

    • address: string
    • objectId: string
    • tokenId: string
    • __namedParameters: Thread

    Returns Promise<TransactionInput>

  • Create a thread.

    Parameters

    • objectId: string

      The ID of AINFT object.

    • tokenId: string

      The ID of AINFT token.

    • ThreadCreateParams: ThreadCreateParams

      The parameters to create thread.

    Returns Promise<ThreadTransactionResult>

    A promise that resolves with both the transaction result and the created thread.

  • Deletes a thread.

    Parameters

    • objectId: string

      The ID of AINFT object.

    • tokenId: string

      The ID of AINFT token.

    • threadId: string

      The ID of thread.

    Returns Promise<ThreadDeleteTransactionResult>

    A promise that resolves with both the transaction result and the deleted thread.

  • fetchTokens(objectId: string): Promise<any>
  • filterThreads(threads: any, tokenId?: null | string, address?: null | string): any[]
  • Parameters

    • threads: any
    • Optional tokenId: null | string
    • Optional address: null | string

    Returns any[]

  • flattenThreads(objectId: string, tokens: any): Promise<any>
  • get(objectId: string, tokenId: string, threadId: string, address: string): Promise<Thread>
  • Retrieves a thread.

    Parameters

    • objectId: string

      The ID of AINFT object.

    • tokenId: string

      The ID of AINFT token.

    • threadId: string

      The ID of thread.

    • address: string

      The checksum address of account.

    Returns Promise<Thread>

    A promise that resolves with the thread.

  • list(objectIds: string[], tokenId?: null | string, address?: null | string, QueryParams?: QueryParams): Promise<{ items: any[]; total: number }>
  • Retrieves a list of threads.

    Parameters

    • objectIds: string[]

      The ID(s) of AINFT object.

    • Optional tokenId: null | string
    • Optional address: null | string
    • QueryParams: QueryParams = {}

      The parameters for querying items.

    Returns Promise<{ items: any[]; total: number }>

    A promise that resolves with the list of threads.

  • sendFormRequest(method: POST | PUT, trailingUrl: string, stringFields: {}, fileFields: {}): Promise<any>
  • Sends request that include form to api server of AINFT Factory. Used to upload asset data.

    Parameters

    • method: POST | PUT

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • stringFields: {}

      The string fields of form.

      • [key: string]: string
    • fileFields: {}

      The file fields of form.

      • [key: string]: { buffer: Buffer; filename: string }
        • buffer: Buffer
        • filename: string

    Returns Promise<any>

    Returns response of api request.

  • sendRequest(method: HttpMethod, trailingUrl: string, data?: Record<string, any>): Promise<any>
  • Sends request to api server of AINFT Factory. Authenticate by signing data.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    Returns Promise<any>

    Returns response of api request.

  • sendRequestWithoutSign(method: HttpMethod, trailingUrl: string, data?: Record<string, any>, headers?: AxiosRequestHeaders): Promise<any>
  • Sends request to api server of AINFT Factory. Used when authentication is not required.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    • Optional headers: AxiosRequestHeaders

      The headers of Http api request.

    Returns Promise<any>

    Returns response of api request.

  • setBaseUrl(baseUrl: string): void
  • signData(data: any): string | Promise<string>
  • Sign the data with the private key that the user has registered.

    Parameters

    • data: any

      The data to sign.

    Returns string | Promise<string>

    Returns signature string.

  • sortThreads(threads: any, sort: string, order: "asc" | "desc"): any[]
  • Updates a thread.

    Parameters

    • objectId: string

      The ID of AINFT object.

    • tokenId: string

      The ID of AINFT token.

    • threadId: string

      The ID of thread.

    • ThreadUpdateParams: ThreadUpdateParams

      The parameters to update thread.

    Returns Promise<ThreadTransactionResult>

    A promise that resolves with both the transaction result and the updated thread.

Generated using TypeDoc