mirror of
https://github.com/LukeHagar/discoursejs.git
synced 2025-12-06 04:19:37 +00:00
279 lines
21 KiB
Markdown
279 lines
21 KiB
Markdown
# Backups
|
|
(*backups*)
|
|
|
|
## Overview
|
|
|
|
### Available Operations
|
|
|
|
* [createBackup](#createbackup) - Create backup
|
|
* [downloadBackup](#downloadbackup) - Download backup
|
|
* [getBackups](#getbackups) - List backups
|
|
* [sendDownloadBackupEmail](#senddownloadbackupemail) - Send download backup email
|
|
|
|
## createBackup
|
|
|
|
Create backup
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { SDK } from "@lukehagar/discoursejs";
|
|
|
|
const sdk = new SDK();
|
|
|
|
async function run() {
|
|
const result = await sdk.backups.createBackup();
|
|
|
|
// 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 { backupsCreateBackup } from "@lukehagar/discoursejs/funcs/backupsCreateBackup.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 backupsCreateBackup(sdk);
|
|
|
|
if (!res.ok) {
|
|
throw res.error;
|
|
}
|
|
|
|
const { value: result } = res;
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.CreateBackupRequestBody](../../sdk/models/operations/createbackuprequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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.CreateBackupResponseBody](../../sdk/models/operations/createbackupresponsebody.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
|
|
## downloadBackup
|
|
|
|
Download backup
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { SDK } from "@lukehagar/discoursejs";
|
|
|
|
const sdk = new SDK();
|
|
|
|
async function run() {
|
|
await sdk.backups.downloadBackup("your_file_here", "<value>");
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { SDKCore } from "@lukehagar/discoursejs/core.js";
|
|
import { backupsDownloadBackup } from "@lukehagar/discoursejs/funcs/backupsDownloadBackup.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 backupsDownloadBackup(sdk, "your_file_here", "<value>");
|
|
|
|
if (!res.ok) {
|
|
throw res.error;
|
|
}
|
|
|
|
const { value: result } = res;
|
|
|
|
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `filename` | *string* | :heavy_check_mark: | N/A |
|
|
| `token` | *string* | :heavy_check_mark: | 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\<void\>**
|
|
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
|
|
## getBackups
|
|
|
|
List backups
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { SDK } from "@lukehagar/discoursejs";
|
|
|
|
const sdk = new SDK();
|
|
|
|
async function run() {
|
|
const result = await sdk.backups.getBackups();
|
|
|
|
// 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 { backupsGetBackups } from "@lukehagar/discoursejs/funcs/backupsGetBackups.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 backupsGetBackups(sdk);
|
|
|
|
if (!res.ok) {
|
|
throw res.error;
|
|
}
|
|
|
|
const { value: result } = res;
|
|
|
|
// Handle the result
|
|
console.log(result)
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `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.ResponseBody[]](../../models/.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
|
|
## sendDownloadBackupEmail
|
|
|
|
Send download backup email
|
|
|
|
### Example Usage
|
|
|
|
```typescript
|
|
import { SDK } from "@lukehagar/discoursejs";
|
|
|
|
const sdk = new SDK();
|
|
|
|
async function run() {
|
|
await sdk.backups.sendDownloadBackupEmail("your_file_here");
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { SDKCore } from "@lukehagar/discoursejs/core.js";
|
|
import { backupsSendDownloadBackupEmail } from "@lukehagar/discoursejs/funcs/backupsSendDownloadBackupEmail.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 backupsSendDownloadBackupEmail(sdk, "your_file_here");
|
|
|
|
if (!res.ok) {
|
|
throw res.error;
|
|
}
|
|
|
|
const { value: result } = res;
|
|
|
|
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `filename` | *string* | :heavy_check_mark: | 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\<void\>**
|
|
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4xx-5xx | */* |
|