Skip to content

contactAvatar 方法为什么调用的是 grpc 的 contactSelfQRCode #35

@dchaofei

Description

@dchaofei

contactAvatar 方法为什么调用的是 grpc 的 contactSelfQRCode?

public async contactAvatar (contactId: string, fileBox?: FileBox): Promise<void | FileBox> {
    log.verbose('PuppetHostie', 'contactAvatar(%s)', contactId)

    /**
     * 1. set
     */
    if (fileBox) {
      const fileboxWrapper = new StringValue()
      fileboxWrapper.setValue(JSON.stringify(fileBox))

      const request = new ContactAvatarRequest()
      request.setId(contactId)
      request.setFilebox(fileboxWrapper)

      await util.promisify(
        this.grpcClient!.contactSelfQRCode.bind(this.grpcClient)
      )(request)

      return
    }

    /**
     * 2. get
     */
    const request = new ContactAvatarRequest()
    request.setId(contactId)

    const response = await util.promisify(
      this.grpcClient!.contactSelfQRCode.bind(this.grpcClient)
    )(request)

    const qrcode = response.getQrcode()
    return FileBox.fromQRCode(qrcode)
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions