/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { projectsCreate } from "../funcs/projects-create.js"; import { projectsDelete } from "../funcs/projects-delete.js"; import { projectsDuplicate } from "../funcs/projects-duplicate.js"; import { projectsList } from "../funcs/projects-list.js"; import { projectsRetrieve } from "../funcs/projects-retrieve.js"; import { projectsUpdate } from "../funcs/projects-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; export class Projects extends ClientSDK { /** * List projects * * @remarks * List the projects in the organization. The list is paginated. Needs the `projects:read` permission. */ async list( page?: number | undefined, pageSize?: number | undefined, options?: RequestOptions, ): Promise> { return unwrapResultIterator(projectsList( this, page, pageSize, options, )); } /** * Create a project * * @remarks * Create a project with one channel, a review queue inbox and a secret API key. Give a domain or context and the project suggests policies for the platform. Needs the `projects:write` permission and a key that reaches all projects. */ async create( request: operations.CreateProjectRequest, options?: RequestOptions, ): Promise { return unwrapAsync(projectsCreate( this, request, options, )); } /** * Get a project * * @remarks * Get a project by ID. Needs the `projects:read` permission. */ async retrieve( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(projectsRetrieve( this, id, options, )); } /** * Update a project * * @remarks * Update a project. Fields you leave out keep their value. Needs the `projects:write` permission. */ async update( id: string, body: operations.UpdateProjectRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(projectsUpdate( this, id, body, options, )); } /** * Delete a project * * @remarks * Delete a project with everything in it: channels, queues, API keys and stored content. This can't be undone. The project's API keys stop working at once. Needs the `projects:write` permission. */ async delete( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(projectsDelete( this, id, options, )); } /** * Duplicate a project * * @remarks * Copy a project's configuration into a new project: its settings, every channel with its policies, rules and wordlists, its moderation actions and its review queues. The copy gets its own secret API key. Webhooks, integrations, API keys and content are not copied. Needs the `projects:write` permission and a key that reaches all projects. */ async duplicate( id: string, body: operations.DuplicateProjectRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(projectsDuplicate( this, id, body, options, )); } }