/* tslint:disable */ /* eslint-disable */ /** * Outline API * # Introduction The Outline API is structured in an RPC style. It enables you to programatically interact with all aspects of Outline’s data – in fact, the main application is built on exactly the same API. The API structure is available as an [openapi specification](https://github.com/outline/openapi) if that’s your jam – it can be used to generate clients for most programming languages. # Making requests Outline’s API follows simple RPC style conventions where each API endpoint is a `POST` method on `https://app.getoutline.com/api/:method`. Only HTTPS is supported and all response payloads are JSON. When making `POST` requests, request parameters are parsed depending on Content-Type header. To make a call using JSON payload, you must pass Content-Type: application/json header, here’s an example using CURL: ``` curl https://app.getoutline.com/api/documents.info \\ -X \'POST\' \\ -H \'authorization: Bearer MY_API_KEY\' \\ -H \'content-type: application/json\' \\ -H \'accept: application/json\' \\ -d \'{\"id\": \"outline-api-NTpezNwhUP\"}\' ``` Or, with JavaScript: ```javascript const response = await fetch(\"https://app.getoutline.com/api/documents.info\", { method: \"POST\", headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\", Authorization: \"Bearer MY_API_KEY\" } }) const body = await response.json(); const document = body.data; ``` # Authentication ## API key You can create new API keys under **Settings => API & Apps**. Be careful when handling your keys as they give access to all of your documents, you should treat them like passwords and they should never be committed to source control. To authenticate with API, you should supply the API key as the `Authorization` header (`Authorization: Bearer YOUR_API_KEY`). ## OAuth 2.0 OAuth 2.0 is a widely used protocol for authorization and authentication. It allows users to grant third-party _or_ internal applications access to their resources without sharing their credentials. To use OAuth 2.0 you need to follow these steps: 1. Register your application under **Settings => Applications** 2. Obtain an access token by exchanging the client credentials for an access token 3. Use the access token to authenticate requests to the API Some API endpoints allow unauthenticated requests for public resources and they can be called without authentication # Scopes Scopes are used to limit the access of an API key or application to specific resources. For example, an application may only need access to read documents, but not write them. Scopes can be global in the case of `read` and `write` scopes, specific to an API endpoint like `documents.read` and `documents.create`, or use wildcard scopes like `documents.*`. Some examples of scopes that can be used are: - `documents.read`: Allows reading documents - `documents.write`: Allows writing documents - `documents.*`: Allows all document-related actions - `users.*`: Allows all user-related actions - `read`: Allows all read actions - `write`: Allows all write actions # Errors All successful API requests will be returned with a 200 or 201 status code and `ok: true` in the response payload. If there’s an error while making the request, the appropriate status code is returned with the error message: ``` { \"ok\": false, \"error\": \"Not Found\" } ``` # Pagination Most top-level API resources have support for \"list\" API methods. For instance, you can list users, documents, and collections. These list methods share common parameters, taking both `limit` and `offset`. Responses will echo these parameters in the root `pagination` key, and also include a `nextPath` key which can be used as a handy shortcut to fetch the next page of results. For example: ``` { ok: true, status: 200, data: […], pagination: { limit: 25, offset: 0, nextPath: \"/api/documents.list?limit=25&offset=25\" } } ``` # Rate limits Like most APIs, Outline has rate limits in place to prevent abuse. Endpoints that mutate data are more restrictive than read-only endpoints. If you exceed the rate limit for a given endpoint, you will receive a `429 Too Many Requests` status code. The response will include a `Retry-After` header that indicates how many seconds you should wait before making another request. # Policies Most API resources have associated \"policies\", these objects describe the current authentications authorized actions related to an individual resource. It should be noted that the policy \"id\" is identical to the resource it is related to, policies themselves do not have unique identifiers. For most usecases of the API, policies can be safely ignored. Calling unauthorized methods will result in the appropriate response code – these can be used in an interface to adjust which elements are visible. * * The version of the OpenAPI document: 0.1.0 * Contact: hello@getoutline.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { AttachmentsDelete200Response, CollectionsAddUser200Response, CollectionsDeleteRequest, CollectionsMemberships200Response, DocumentsAddUserRequest, DocumentsAnswerquestion200Response, DocumentsAnswerquestionRequest, DocumentsCreateRequest, DocumentsDeleteRequest, DocumentsDraftsRequest, DocumentsExport200Response, DocumentsExportRequest, DocumentsInfo200Response, DocumentsInfoRequest, DocumentsList200Response, DocumentsListRequest, DocumentsMembershipsRequest, DocumentsMove200Response, DocumentsMoveRequest, DocumentsRemoveUserRequest, DocumentsRestoreRequest, DocumentsSearch200Response, DocumentsSearchRequest, DocumentsUnpublishRequest, DocumentsUpdateRequest, DocumentsUsers200Response, DocumentsUsersRequest, DocumentsViewedRequest, InlineObject, } from '../models/index'; import { AttachmentsDelete200ResponseFromJSON, AttachmentsDelete200ResponseToJSON, CollectionsAddUser200ResponseFromJSON, CollectionsAddUser200ResponseToJSON, CollectionsDeleteRequestFromJSON, CollectionsDeleteRequestToJSON, CollectionsMemberships200ResponseFromJSON, CollectionsMemberships200ResponseToJSON, DocumentsAddUserRequestFromJSON, DocumentsAddUserRequestToJSON, DocumentsAnswerquestion200ResponseFromJSON, DocumentsAnswerquestion200ResponseToJSON, DocumentsAnswerquestionRequestFromJSON, DocumentsAnswerquestionRequestToJSON, DocumentsCreateRequestFromJSON, DocumentsCreateRequestToJSON, DocumentsDeleteRequestFromJSON, DocumentsDeleteRequestToJSON, DocumentsDraftsRequestFromJSON, DocumentsDraftsRequestToJSON, DocumentsExport200ResponseFromJSON, DocumentsExport200ResponseToJSON, DocumentsExportRequestFromJSON, DocumentsExportRequestToJSON, DocumentsInfo200ResponseFromJSON, DocumentsInfo200ResponseToJSON, DocumentsInfoRequestFromJSON, DocumentsInfoRequestToJSON, DocumentsList200ResponseFromJSON, DocumentsList200ResponseToJSON, DocumentsListRequestFromJSON, DocumentsListRequestToJSON, DocumentsMembershipsRequestFromJSON, DocumentsMembershipsRequestToJSON, DocumentsMove200ResponseFromJSON, DocumentsMove200ResponseToJSON, DocumentsMoveRequestFromJSON, DocumentsMoveRequestToJSON, DocumentsRemoveUserRequestFromJSON, DocumentsRemoveUserRequestToJSON, DocumentsRestoreRequestFromJSON, DocumentsRestoreRequestToJSON, DocumentsSearch200ResponseFromJSON, DocumentsSearch200ResponseToJSON, DocumentsSearchRequestFromJSON, DocumentsSearchRequestToJSON, DocumentsUnpublishRequestFromJSON, DocumentsUnpublishRequestToJSON, DocumentsUpdateRequestFromJSON, DocumentsUpdateRequestToJSON, DocumentsUsers200ResponseFromJSON, DocumentsUsers200ResponseToJSON, DocumentsUsersRequestFromJSON, DocumentsUsersRequestToJSON, DocumentsViewedRequestFromJSON, DocumentsViewedRequestToJSON, InlineObjectFromJSON, InlineObjectToJSON, } from '../models/index'; export interface DocumentsAddUserOperationRequest { documentsAddUserRequest?: DocumentsAddUserRequest; } export interface DocumentsAnswerquestionOperationRequest { documentsAnswerquestionRequest?: DocumentsAnswerquestionRequest; } export interface DocumentsArchiveRequest { documentsUnpublishRequest?: DocumentsUnpublishRequest; } export interface DocumentsCreateOperationRequest { documentsCreateRequest?: DocumentsCreateRequest; } export interface DocumentsDeleteOperationRequest { documentsDeleteRequest?: DocumentsDeleteRequest; } export interface DocumentsDraftsOperationRequest { documentsDraftsRequest?: DocumentsDraftsRequest; } export interface DocumentsExportOperationRequest { documentsExportRequest?: DocumentsExportRequest; } export interface DocumentsImportRequest { file: object; collectionId?: string; parentDocumentId?: string; template?: boolean; publish?: boolean; } export interface DocumentsInfoOperationRequest { documentsInfoRequest?: DocumentsInfoRequest; } export interface DocumentsListOperationRequest { documentsListRequest?: DocumentsListRequest; } export interface DocumentsMembershipsOperationRequest { documentsMembershipsRequest?: DocumentsMembershipsRequest; } export interface DocumentsMoveOperationRequest { documentsMoveRequest?: DocumentsMoveRequest; } export interface DocumentsRemoveUserOperationRequest { documentsRemoveUserRequest?: DocumentsRemoveUserRequest; } export interface DocumentsRestoreOperationRequest { documentsRestoreRequest?: DocumentsRestoreRequest; } export interface DocumentsSearchOperationRequest { documentsSearchRequest?: DocumentsSearchRequest; } export interface DocumentsTemplatizeRequest { collectionsDeleteRequest?: CollectionsDeleteRequest; } export interface DocumentsUnpublishOperationRequest { documentsUnpublishRequest?: DocumentsUnpublishRequest; } export interface DocumentsUpdateOperationRequest { documentsUpdateRequest?: DocumentsUpdateRequest; } export interface DocumentsUsersOperationRequest { documentsUsersRequest?: DocumentsUsersRequest; } export interface DocumentsViewedOperationRequest { documentsViewedRequest?: DocumentsViewedRequest; } /** * */ export class DocumentsApi extends runtime.BaseAPI { /** * This method allows you to add a user membership to the specified document. * Add a document user */ async documentsAddUserRaw(requestParameters: DocumentsAddUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.add_user`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsAddUserRequestToJSON(requestParameters['documentsAddUserRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CollectionsAddUser200ResponseFromJSON(jsonValue)); } /** * This method allows you to add a user membership to the specified document. * Add a document user */ async documentsAddUser(requestParameters: DocumentsAddUserOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsAddUserRaw(requestParameters, initOverrides); return await response.value(); } /** * This method allows asking direct questions of your documents – where possible an answer will be provided. Search results will be restricted to those accessible by the current access token. Note that \"AI answers\" must be enabled for the workspace. * Query documents with natural language */ async documentsAnswerquestionRaw(requestParameters: DocumentsAnswerquestionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.answerQuestion`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsAnswerquestionRequestToJSON(requestParameters['documentsAnswerquestionRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsAnswerquestion200ResponseFromJSON(jsonValue)); } /** * This method allows asking direct questions of your documents – where possible an answer will be provided. Search results will be restricted to those accessible by the current access token. Note that \"AI answers\" must be enabled for the workspace. * Query documents with natural language */ async documentsAnswerquestion(requestParameters: DocumentsAnswerquestionOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsAnswerquestionRaw(requestParameters, initOverrides); return await response.value(); } /** * Archiving a document allows outdated information to be moved out of sight whilst retaining the ability to optionally search and restore it later. * Archive a document */ async documentsArchiveRaw(requestParameters: DocumentsArchiveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.archive`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsUnpublishRequestToJSON(requestParameters['documentsUnpublishRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * Archiving a document allows outdated information to be moved out of sight whilst retaining the ability to optionally search and restore it later. * Archive a document */ async documentsArchive(requestParameters: DocumentsArchiveRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsArchiveRaw(requestParameters, initOverrides); return await response.value(); } /** * This method allows you to create or publish a new document. By default a document is set to the collection root. If you want to create a nested/child document, you should pass parentDocumentId to set the parent document. * Create a document */ async documentsCreateRaw(requestParameters: DocumentsCreateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.create`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsCreateRequestToJSON(requestParameters['documentsCreateRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * This method allows you to create or publish a new document. By default a document is set to the collection root. If you want to create a nested/child document, you should pass parentDocumentId to set the parent document. * Create a document */ async documentsCreate(requestParameters: DocumentsCreateOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsCreateRaw(requestParameters, initOverrides); return await response.value(); } /** * Deleting a document moves it to the trash. If not restored within 30 days it is permenantly deleted. * Delete a document */ async documentsDeleteRaw(requestParameters: DocumentsDeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.delete`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsDeleteRequestToJSON(requestParameters['documentsDeleteRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => AttachmentsDelete200ResponseFromJSON(jsonValue)); } /** * Deleting a document moves it to the trash. If not restored within 30 days it is permenantly deleted. * Delete a document */ async documentsDelete(requestParameters: DocumentsDeleteOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsDeleteRaw(requestParameters, initOverrides); return await response.value(); } /** * This method will list all draft documents belonging to the current user. * List all draft documents */ async documentsDraftsRaw(requestParameters: DocumentsDraftsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.drafts`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsDraftsRequestToJSON(requestParameters['documentsDraftsRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsList200ResponseFromJSON(jsonValue)); } /** * This method will list all draft documents belonging to the current user. * List all draft documents */ async documentsDrafts(requestParameters: DocumentsDraftsOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsDraftsRaw(requestParameters, initOverrides); return await response.value(); } /** * Export a document as markdown */ async documentsExportRaw(requestParameters: DocumentsExportOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.export`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsExportRequestToJSON(requestParameters['documentsExportRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsExport200ResponseFromJSON(jsonValue)); } /** * Export a document as markdown */ async documentsExport(requestParameters: DocumentsExportOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsExportRaw(requestParameters, initOverrides); return await response.value(); } /** * This method allows you to create a new document by importing an existing file. By default a document is set to the collection root. If you want to create a nested/child document, you should pass parentDocumentId to set the parent document. * Import a file as a document */ async documentsImportRaw(requestParameters: DocumentsImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['file'] == null) { throw new runtime.RequiredError( 'file', 'Required parameter "file" was null or undefined when calling documentsImport().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const consumes: runtime.Consume[] = [ { contentType: 'multipart/form-data' }, ]; // @ts-ignore: canConsumeForm may be unused const canConsumeForm = runtime.canConsumeForm(consumes); let formParams: { append(param: string, value: any): any }; let useForm = false; if (useForm) { formParams = new FormData(); } else { formParams = new URLSearchParams(); } if (requestParameters['file'] != null) { formParams.append('file', new Blob([JSON.stringify(DocumentsInfo200ResponseToJSON(requestParameters['file']))], { type: "application/json", })); } if (requestParameters['collectionId'] != null) { formParams.append('collectionId', requestParameters['collectionId'] as any); } if (requestParameters['parentDocumentId'] != null) { formParams.append('parentDocumentId', requestParameters['parentDocumentId'] as any); } if (requestParameters['template'] != null) { formParams.append('template', requestParameters['template'] as any); } if (requestParameters['publish'] != null) { formParams.append('publish', requestParameters['publish'] as any); } let urlPath = `/documents.import`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * This method allows you to create a new document by importing an existing file. By default a document is set to the collection root. If you want to create a nested/child document, you should pass parentDocumentId to set the parent document. * Import a file as a document */ async documentsImport(requestParameters: DocumentsImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsImportRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a document by its `UUID`, `urlId`, or `shareId`. At least one of these parameters must be provided. * Retrieve a document */ async documentsInfoRaw(requestParameters: DocumentsInfoOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.info`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsInfoRequestToJSON(requestParameters['documentsInfoRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * Retrieve a document by its `UUID`, `urlId`, or `shareId`. At least one of these parameters must be provided. * Retrieve a document */ async documentsInfo(requestParameters: DocumentsInfoOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsInfoRaw(requestParameters, initOverrides); return await response.value(); } /** * This method will list all published documents and draft documents belonging to the current user. * List all documents */ async documentsListRaw(requestParameters: DocumentsListOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.list`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsListRequestToJSON(requestParameters['documentsListRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsList200ResponseFromJSON(jsonValue)); } /** * This method will list all published documents and draft documents belonging to the current user. * List all documents */ async documentsList(requestParameters: DocumentsListOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsListRaw(requestParameters, initOverrides); return await response.value(); } /** * Users with direct membership to a document. To list all users with access to a document use `documents.users`. * List document memberships */ async documentsMembershipsRaw(requestParameters: DocumentsMembershipsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.memberships`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsMembershipsRequestToJSON(requestParameters['documentsMembershipsRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CollectionsMemberships200ResponseFromJSON(jsonValue)); } /** * Users with direct membership to a document. To list all users with access to a document use `documents.users`. * List document memberships */ async documentsMemberships(requestParameters: DocumentsMembershipsOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsMembershipsRaw(requestParameters, initOverrides); return await response.value(); } /** * Move a document to a new location or collection. If no parent document is provided, the document will be moved to the collection root. * Move a document */ async documentsMoveRaw(requestParameters: DocumentsMoveOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.move`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsMoveRequestToJSON(requestParameters['documentsMoveRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsMove200ResponseFromJSON(jsonValue)); } /** * Move a document to a new location or collection. If no parent document is provided, the document will be moved to the collection root. * Move a document */ async documentsMove(requestParameters: DocumentsMoveOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsMoveRaw(requestParameters, initOverrides); return await response.value(); } /** * This method allows you to remove a user membership from the specified document. * Remove a document user */ async documentsRemoveUserRaw(requestParameters: DocumentsRemoveUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.remove_user`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsRemoveUserRequestToJSON(requestParameters['documentsRemoveUserRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => AttachmentsDelete200ResponseFromJSON(jsonValue)); } /** * This method allows you to remove a user membership from the specified document. * Remove a document user */ async documentsRemoveUser(requestParameters: DocumentsRemoveUserOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsRemoveUserRaw(requestParameters, initOverrides); return await response.value(); } /** * If a document has been archived or deleted, it can be restored. Optionally a revision can be passed to restore the document to a previous point in time. * Restore a document */ async documentsRestoreRaw(requestParameters: DocumentsRestoreOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.restore`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsRestoreRequestToJSON(requestParameters['documentsRestoreRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * If a document has been archived or deleted, it can be restored. Optionally a revision can be passed to restore the document to a previous point in time. * Restore a document */ async documentsRestore(requestParameters: DocumentsRestoreOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsRestoreRaw(requestParameters, initOverrides); return await response.value(); } /** * This methods allows you to search your teams documents with keywords. Note that search results will be restricted to those accessible by the current access token. * Search all documents */ async documentsSearchRaw(requestParameters: DocumentsSearchOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.search`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsSearchRequestToJSON(requestParameters['documentsSearchRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsSearch200ResponseFromJSON(jsonValue)); } /** * This methods allows you to search your teams documents with keywords. Note that search results will be restricted to those accessible by the current access token. * Search all documents */ async documentsSearch(requestParameters: DocumentsSearchOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsSearchRaw(requestParameters, initOverrides); return await response.value(); } /** * This method allows you to createa new template using an existing document as the basis * Create a template from a document */ async documentsTemplatizeRaw(requestParameters: DocumentsTemplatizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.templatize`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: CollectionsDeleteRequestToJSON(requestParameters['collectionsDeleteRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * This method allows you to createa new template using an existing document as the basis * Create a template from a document */ async documentsTemplatize(requestParameters: DocumentsTemplatizeRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsTemplatizeRaw(requestParameters, initOverrides); return await response.value(); } /** * Unpublishing a document moves it back to a draft status and out of the collection. * Unpublish a document */ async documentsUnpublishRaw(requestParameters: DocumentsUnpublishOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.unpublish`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsUnpublishRequestToJSON(requestParameters['documentsUnpublishRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * Unpublishing a document moves it back to a draft status and out of the collection. * Unpublish a document */ async documentsUnpublish(requestParameters: DocumentsUnpublishOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsUnpublishRaw(requestParameters, initOverrides); return await response.value(); } /** * This method allows you to modify an already created document * Update a document */ async documentsUpdateRaw(requestParameters: DocumentsUpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.update`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsUpdateRequestToJSON(requestParameters['documentsUpdateRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsInfo200ResponseFromJSON(jsonValue)); } /** * This method allows you to modify an already created document * Update a document */ async documentsUpdate(requestParameters: DocumentsUpdateOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsUpdateRaw(requestParameters, initOverrides); return await response.value(); } /** * All users with access to a document. To list only users with direct membership to the document use `documents.memberships` * List document users */ async documentsUsersRaw(requestParameters: DocumentsUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.users`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsUsersRequestToJSON(requestParameters['documentsUsersRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsUsers200ResponseFromJSON(jsonValue)); } /** * All users with access to a document. To list only users with direct membership to the document use `documents.memberships` * List document users */ async documentsUsers(requestParameters: DocumentsUsersOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsUsersRaw(requestParameters, initOverrides); return await response.value(); } /** * This method will list all documents recently viewed by the current user. * List all recently viewed documents */ async documentsViewedRaw(requestParameters: DocumentsViewedOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read", "write"]); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/documents.viewed`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DocumentsViewedRequestToJSON(requestParameters['documentsViewedRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DocumentsList200ResponseFromJSON(jsonValue)); } /** * This method will list all documents recently viewed by the current user. * List all recently viewed documents */ async documentsViewed(requestParameters: DocumentsViewedOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.documentsViewedRaw(requestParameters, initOverrides); return await response.value(); } }