From 70eb00eafde230035dc4823c8b38a9a92318b492 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Tue, 15 Jul 2025 18:01:08 +0200 Subject: [PATCH] add share models --- src/gen/api/outline/models/Share.ts | 138 ++++++++++++++++++ .../api/outline/models/SharesCreateRequest.ts | 66 +++++++++ .../outline/models/SharesInfo200Response.ts | 88 +++++++++++ .../api/outline/models/SharesInfoRequest.ts | 73 +++++++++ .../outline/models/SharesList200Response.ts | 103 +++++++++++++ .../api/outline/models/SharesListRequest.ts | 108 ++++++++++++++ .../api/outline/models/SharesUpdateRequest.ts | 75 ++++++++++ 7 files changed, 651 insertions(+) create mode 100644 src/gen/api/outline/models/Share.ts create mode 100644 src/gen/api/outline/models/SharesCreateRequest.ts create mode 100644 src/gen/api/outline/models/SharesInfo200Response.ts create mode 100644 src/gen/api/outline/models/SharesInfoRequest.ts create mode 100644 src/gen/api/outline/models/SharesList200Response.ts create mode 100644 src/gen/api/outline/models/SharesListRequest.ts create mode 100644 src/gen/api/outline/models/SharesUpdateRequest.ts diff --git a/src/gen/api/outline/models/Share.ts b/src/gen/api/outline/models/Share.ts new file mode 100644 index 0000000..63d25e7 --- /dev/null +++ b/src/gen/api/outline/models/Share.ts @@ -0,0 +1,138 @@ +/* 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 { mapValues } from '../runtime'; +import type { User } from './User'; +import { + UserFromJSON, + UserFromJSONTyped, + UserToJSON, + UserToJSONTyped, +} from './User'; + +/** + * + * @export + * @interface Share + */ +export interface Share { + /** + * Unique identifier for the object. + * @type {string} + * @memberof Share + */ + readonly id?: string; + /** + * Title of the shared document. + * @type {string} + * @memberof Share + */ + readonly documentTitle?: string; + /** + * URL of the original document. + * @type {string} + * @memberof Share + */ + readonly documentUrl?: string; + /** + * URL of the publicly shared document. + * @type {string} + * @memberof Share + */ + readonly url?: string; + /** + * If true the share can be loaded without a user account. + * @type {boolean} + * @memberof Share + */ + published?: boolean; + /** + * If to also give permission to view documents nested beneath this one. + * @type {boolean} + * @memberof Share + */ + includeChildDocuments?: boolean; + /** + * Date and time when this share was created + * @type {Date} + * @memberof Share + */ + readonly createdAt?: Date; + /** + * + * @type {User} + * @memberof Share + */ + createdBy?: User; + /** + * Date and time when this share was edited + * @type {Date} + * @memberof Share + */ + readonly updatedAt?: Date; + /** + * Date and time when this share was last viewed + * @type {Date} + * @memberof Share + */ + readonly lastAccessedAt?: Date; +} + +/** + * Check if a given object implements the Share interface. + */ +export function instanceOfShare(value: object): value is Share { + return true; +} + +export function ShareFromJSON(json: any): Share { + return ShareFromJSONTyped(json, false); +} + +export function ShareFromJSONTyped(json: any, ignoreDiscriminator: boolean): Share { + if (json == null) { + return json; + } + return { + + 'id': json['id'] == null ? undefined : json['id'], + 'documentTitle': json['documentTitle'] == null ? undefined : json['documentTitle'], + 'documentUrl': json['documentUrl'] == null ? undefined : json['documentUrl'], + 'url': json['url'] == null ? undefined : json['url'], + 'published': json['published'] == null ? undefined : json['published'], + 'includeChildDocuments': json['includeChildDocuments'] == null ? undefined : json['includeChildDocuments'], + 'createdAt': json['createdAt'] == null ? undefined : (new Date(json['createdAt'])), + 'createdBy': json['createdBy'] == null ? undefined : UserFromJSON(json['createdBy']), + 'updatedAt': json['updatedAt'] == null ? undefined : (new Date(json['updatedAt'])), + 'lastAccessedAt': json['lastAccessedAt'] == null ? undefined : (new Date(json['lastAccessedAt'])), + }; +} + +export function ShareToJSON(json: any): Share { + return ShareToJSONTyped(json, false); +} + +export function ShareToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'published': value['published'], + 'includeChildDocuments': value['includeChildDocuments'], + 'createdBy': UserToJSON(value['createdBy']), + }; +} + diff --git a/src/gen/api/outline/models/SharesCreateRequest.ts b/src/gen/api/outline/models/SharesCreateRequest.ts new file mode 100644 index 0000000..6cdfb07 --- /dev/null +++ b/src/gen/api/outline/models/SharesCreateRequest.ts @@ -0,0 +1,66 @@ +/* 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 { mapValues } from '../runtime'; +/** + * + * @export + * @interface SharesCreateRequest + */ +export interface SharesCreateRequest { + /** + * + * @type {string} + * @memberof SharesCreateRequest + */ + documentId: string; +} + +/** + * Check if a given object implements the SharesCreateRequest interface. + */ +export function instanceOfSharesCreateRequest(value: object): value is SharesCreateRequest { + if (!('documentId' in value) || value['documentId'] === undefined) return false; + return true; +} + +export function SharesCreateRequestFromJSON(json: any): SharesCreateRequest { + return SharesCreateRequestFromJSONTyped(json, false); +} + +export function SharesCreateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SharesCreateRequest { + if (json == null) { + return json; + } + return { + + 'documentId': json['documentId'], + }; +} + +export function SharesCreateRequestToJSON(json: any): SharesCreateRequest { + return SharesCreateRequestToJSONTyped(json, false); +} + +export function SharesCreateRequestToJSONTyped(value?: SharesCreateRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'documentId': value['documentId'], + }; +} + diff --git a/src/gen/api/outline/models/SharesInfo200Response.ts b/src/gen/api/outline/models/SharesInfo200Response.ts new file mode 100644 index 0000000..3e31b78 --- /dev/null +++ b/src/gen/api/outline/models/SharesInfo200Response.ts @@ -0,0 +1,88 @@ +/* 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 { mapValues } from '../runtime'; +import type { Policy } from './Policy'; +import { + PolicyFromJSON, + PolicyFromJSONTyped, + PolicyToJSON, + PolicyToJSONTyped, +} from './Policy'; +import type { Share } from './Share'; +import { + ShareFromJSON, + ShareFromJSONTyped, + ShareToJSON, + ShareToJSONTyped, +} from './Share'; + +/** + * + * @export + * @interface SharesInfo200Response + */ +export interface SharesInfo200Response { + /** + * + * @type {Share} + * @memberof SharesInfo200Response + */ + data?: Share; + /** + * + * @type {Array} + * @memberof SharesInfo200Response + */ + policies?: Array; +} + +/** + * Check if a given object implements the SharesInfo200Response interface. + */ +export function instanceOfSharesInfo200Response(value: object): value is SharesInfo200Response { + return true; +} + +export function SharesInfo200ResponseFromJSON(json: any): SharesInfo200Response { + return SharesInfo200ResponseFromJSONTyped(json, false); +} + +export function SharesInfo200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SharesInfo200Response { + if (json == null) { + return json; + } + return { + + 'data': json['data'] == null ? undefined : ShareFromJSON(json['data']), + 'policies': json['policies'] == null ? undefined : ((json['policies'] as Array).map(PolicyFromJSON)), + }; +} + +export function SharesInfo200ResponseToJSON(json: any): SharesInfo200Response { + return SharesInfo200ResponseToJSONTyped(json, false); +} + +export function SharesInfo200ResponseToJSONTyped(value?: SharesInfo200Response | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': ShareToJSON(value['data']), + 'policies': value['policies'] == null ? undefined : ((value['policies'] as Array).map(PolicyToJSON)), + }; +} + diff --git a/src/gen/api/outline/models/SharesInfoRequest.ts b/src/gen/api/outline/models/SharesInfoRequest.ts new file mode 100644 index 0000000..efbe203 --- /dev/null +++ b/src/gen/api/outline/models/SharesInfoRequest.ts @@ -0,0 +1,73 @@ +/* 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 { mapValues } from '../runtime'; +/** + * + * @export + * @interface SharesInfoRequest + */ +export interface SharesInfoRequest { + /** + * Unique identifier for the share. + * @type {string} + * @memberof SharesInfoRequest + */ + id?: string; + /** + * Unique identifier for a document. One of id or documentId must be provided. + * @type {string} + * @memberof SharesInfoRequest + */ + documentId?: string; +} + +/** + * Check if a given object implements the SharesInfoRequest interface. + */ +export function instanceOfSharesInfoRequest(value: object): value is SharesInfoRequest { + return true; +} + +export function SharesInfoRequestFromJSON(json: any): SharesInfoRequest { + return SharesInfoRequestFromJSONTyped(json, false); +} + +export function SharesInfoRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SharesInfoRequest { + if (json == null) { + return json; + } + return { + + 'id': json['id'] == null ? undefined : json['id'], + 'documentId': json['documentId'] == null ? undefined : json['documentId'], + }; +} + +export function SharesInfoRequestToJSON(json: any): SharesInfoRequest { + return SharesInfoRequestToJSONTyped(json, false); +} + +export function SharesInfoRequestToJSONTyped(value?: SharesInfoRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'documentId': value['documentId'], + }; +} + diff --git a/src/gen/api/outline/models/SharesList200Response.ts b/src/gen/api/outline/models/SharesList200Response.ts new file mode 100644 index 0000000..d81f378 --- /dev/null +++ b/src/gen/api/outline/models/SharesList200Response.ts @@ -0,0 +1,103 @@ +/* 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 { mapValues } from '../runtime'; +import type { Policy } from './Policy'; +import { + PolicyFromJSON, + PolicyFromJSONTyped, + PolicyToJSON, + PolicyToJSONTyped, +} from './Policy'; +import type { Pagination } from './Pagination'; +import { + PaginationFromJSON, + PaginationFromJSONTyped, + PaginationToJSON, + PaginationToJSONTyped, +} from './Pagination'; +import type { Share } from './Share'; +import { + ShareFromJSON, + ShareFromJSONTyped, + ShareToJSON, + ShareToJSONTyped, +} from './Share'; + +/** + * + * @export + * @interface SharesList200Response + */ +export interface SharesList200Response { + /** + * + * @type {Array} + * @memberof SharesList200Response + */ + data?: Array; + /** + * + * @type {Array} + * @memberof SharesList200Response + */ + policies?: Array; + /** + * + * @type {Pagination} + * @memberof SharesList200Response + */ + pagination?: Pagination; +} + +/** + * Check if a given object implements the SharesList200Response interface. + */ +export function instanceOfSharesList200Response(value: object): value is SharesList200Response { + return true; +} + +export function SharesList200ResponseFromJSON(json: any): SharesList200Response { + return SharesList200ResponseFromJSONTyped(json, false); +} + +export function SharesList200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SharesList200Response { + if (json == null) { + return json; + } + return { + + 'data': json['data'] == null ? undefined : ((json['data'] as Array).map(ShareFromJSON)), + 'policies': json['policies'] == null ? undefined : ((json['policies'] as Array).map(PolicyFromJSON)), + 'pagination': json['pagination'] == null ? undefined : PaginationFromJSON(json['pagination']), + }; +} + +export function SharesList200ResponseToJSON(json: any): SharesList200Response { + return SharesList200ResponseToJSONTyped(json, false); +} + +export function SharesList200ResponseToJSONTyped(value?: SharesList200Response | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': value['data'] == null ? undefined : ((value['data'] as Array).map(ShareToJSON)), + 'policies': value['policies'] == null ? undefined : ((value['policies'] as Array).map(PolicyToJSON)), + 'pagination': PaginationToJSON(value['pagination']), + }; +} + diff --git a/src/gen/api/outline/models/SharesListRequest.ts b/src/gen/api/outline/models/SharesListRequest.ts new file mode 100644 index 0000000..5cee2a4 --- /dev/null +++ b/src/gen/api/outline/models/SharesListRequest.ts @@ -0,0 +1,108 @@ +/* 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 { mapValues } from '../runtime'; +/** + * + * @export + * @interface SharesListRequest + */ +export interface SharesListRequest { + /** + * + * @type {number} + * @memberof SharesListRequest + */ + offset?: number; + /** + * + * @type {number} + * @memberof SharesListRequest + */ + limit?: number; + /** + * + * @type {string} + * @memberof SharesListRequest + */ + sort?: string; + /** + * + * @type {string} + * @memberof SharesListRequest + */ + direction?: SharesListRequestDirectionEnum; + /** + * Filter to shared documents matching a search query + * @type {string} + * @memberof SharesListRequest + */ + query?: string; +} + + +/** + * @export + */ +export const SharesListRequestDirectionEnum = { + Asc: 'ASC', + Desc: 'DESC' +} as const; +export type SharesListRequestDirectionEnum = typeof SharesListRequestDirectionEnum[keyof typeof SharesListRequestDirectionEnum]; + + +/** + * Check if a given object implements the SharesListRequest interface. + */ +export function instanceOfSharesListRequest(value: object): value is SharesListRequest { + return true; +} + +export function SharesListRequestFromJSON(json: any): SharesListRequest { + return SharesListRequestFromJSONTyped(json, false); +} + +export function SharesListRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SharesListRequest { + if (json == null) { + return json; + } + return { + + 'offset': json['offset'] == null ? undefined : json['offset'], + 'limit': json['limit'] == null ? undefined : json['limit'], + 'sort': json['sort'] == null ? undefined : json['sort'], + 'direction': json['direction'] == null ? undefined : json['direction'], + 'query': json['query'] == null ? undefined : json['query'], + }; +} + +export function SharesListRequestToJSON(json: any): SharesListRequest { + return SharesListRequestToJSONTyped(json, false); +} + +export function SharesListRequestToJSONTyped(value?: SharesListRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'offset': value['offset'], + 'limit': value['limit'], + 'sort': value['sort'], + 'direction': value['direction'], + 'query': value['query'], + }; +} + diff --git a/src/gen/api/outline/models/SharesUpdateRequest.ts b/src/gen/api/outline/models/SharesUpdateRequest.ts new file mode 100644 index 0000000..ffe00af --- /dev/null +++ b/src/gen/api/outline/models/SharesUpdateRequest.ts @@ -0,0 +1,75 @@ +/* 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 { mapValues } from '../runtime'; +/** + * + * @export + * @interface SharesUpdateRequest + */ +export interface SharesUpdateRequest { + /** + * + * @type {string} + * @memberof SharesUpdateRequest + */ + id: string; + /** + * + * @type {boolean} + * @memberof SharesUpdateRequest + */ + published: boolean; +} + +/** + * Check if a given object implements the SharesUpdateRequest interface. + */ +export function instanceOfSharesUpdateRequest(value: object): value is SharesUpdateRequest { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('published' in value) || value['published'] === undefined) return false; + return true; +} + +export function SharesUpdateRequestFromJSON(json: any): SharesUpdateRequest { + return SharesUpdateRequestFromJSONTyped(json, false); +} + +export function SharesUpdateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SharesUpdateRequest { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'published': json['published'], + }; +} + +export function SharesUpdateRequestToJSON(json: any): SharesUpdateRequest { + return SharesUpdateRequestToJSONTyped(json, false); +} + +export function SharesUpdateRequestToJSONTyped(value?: SharesUpdateRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'published': value['published'], + }; +} +