Class: TorqueAudienceClient

@torque-labs/torque-ts-sdkDocs


@torque-labs/torque-ts-sdk / TorqueAudienceClient

Class: TorqueAudienceClient

The TorqueAudienceClient class is used to manage and verify audiencess for the Torque API.

Example

const client = new TorqueAudienceClient(TorqueAudienceClientOptions);

const audience = await client.buildAudience(<audienceData>);
const verified = await client.verifyAudience(audience);

Constructors

new TorqueAudienceClient()

new TorqueAudienceClient(options): TorqueAudienceClient

Create a new instance of the TorqueAdminClient class with the provided API key.

Parameters

ParameterTypeDescription

options

The options for the TorqueAudienceClient.

Returns

TorqueAudienceClient

Defined in

src/classes/audience.ts:57

Properties

PropertyType

client

userClient

undefined | TorqueUserClient

Methods

buildAudience()

buildAudience(options): Promise<AudienceBuildResponse>

Builds an audience with the provided options.

Parameters

ParameterTypeDescription

options

The options for the audience build.

Returns

Promise<AudienceBuildResponse>

The response from the API.

Throws

If there is an error building the audience.

Defined in

src/classes/audience.ts:77


logout()

logout(): Promise<void>

Returns

Promise<void>

Defined in

src/classes/audience.ts:64


verifyAudience()

verifyAudience(audience, publicKey?): Promise<boolean>

Verifies the current user with the provided audience.

Parameters

ParameterTypeDescription

audience

The options for the audience verification.

publicKey?

string

-

Returns

Promise<boolean>

True if the user is verified with the audience, false otherwise.

Throws

If there is an error verifying the user with the audience.

Defined in

src/classes/audience.ts:108

Last updated