# Example

Example SDK usage to demonstrate required effort:

* registering a user
* authenticating that user
* listing quests
* completing a quest

#### Backend:

```typescript
const thx = new THXAPIClient({
  clientId: '<CREATE_IN_DASHBOARD>',
  clientSecret: '<CREATE_IN_DASHBOARD>',
});

const identity = await thx.identity.create();
// Identity: e7f32a71-33ea-418e-9d80-32b6bf6405f0
```

#### Front-end:

```typescript
const thx = new THXIdentityClient({
  clientId: '<CREATE_IN_DASHBOARD>',
  clientSecret: '<CREATE_IN_DASHBOARD>',
});

// Authenticate a specific user using his identity code
thx.setIdentity('e7f32a71-33ea-418e-9d80-32b6bf6405f0');

// List available daily quests for your campaign 
// and get the ID of the first quest
const { daily } = await thx.quests.list();
const questId = daily[0].id;
await thx.quests.daily.entry.create(questId);

// Get campaign participation info for authenticated user 
// and show point balance
const { balance } = await thx.request.get('/v1/participants');
// Balance: 10 points
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thx.network/developers/api/example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
