Files
discoursejs/docs/sdks/invites/README.md

162 lines
15 KiB
Markdown

# Invites
(*invites*)
## Overview
### Available Operations
* [createInvite](#createinvite) - Create an invite
* [inviteToTopic](#invitetotopic) - Invite to topic
## createInvite
Create an invite
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.invites.createInvite("<value>", "<value>", {
email: "not-a-user-yet@example.com",
groupIds: "42,43",
groupNames: "foo,bar",
maxRedemptionsAllowed: 5,
});
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { invitesCreateInvite } from "@lukehagar/discoursejs/funcs/invitesCreateInvite.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await invitesCreateInvite(sdk, "<value>", "<value>", {
email: "not-a-user-yet@example.com",
groupIds: "42,43",
groupNames: "foo,bar",
maxRedemptionsAllowed: 5,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `apiKey` | *string* | :heavy_check_mark: | N/A |
| `apiUsername` | *string* | :heavy_check_mark: | N/A |
| `requestBody` | [operations.CreateInviteRequestBody](../../sdk/models/operations/createinviterequestbody.md) | :heavy_minus_sign: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.CreateInviteResponseBody](../../sdk/models/operations/createinviteresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |
## inviteToTopic
Invite to topic
### Example Usage
```typescript
import { SDK } from "@lukehagar/discoursejs";
const sdk = new SDK();
async function run() {
const result = await sdk.invites.inviteToTopic("<value>", "<value>", "<value>");
// Handle the result
console.log(result)
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { SDKCore } from "@lukehagar/discoursejs/core.js";
import { invitesInviteToTopic } from "@lukehagar/discoursejs/funcs/invitesInviteToTopic.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();
async function run() {
const res = await invitesInviteToTopic(sdk, "<value>", "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result)
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `apiKey` | *string* | :heavy_check_mark: | N/A |
| `apiUsername` | *string* | :heavy_check_mark: | N/A |
| `id` | *string* | :heavy_check_mark: | N/A |
| `requestBody` | [operations.InviteToTopicRequestBody](../../sdk/models/operations/invitetotopicrequestbody.md) | :heavy_minus_sign: | N/A |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[operations.InviteToTopicResponseBody](../../sdk/models/operations/invitetotopicresponsebody.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 4xx-5xx | */* |