|
| 1 | +/* tslint:disable */ |
| 2 | +/* eslint-disable */ |
| 3 | +/** |
| 4 | + * The Plane REST API |
| 5 | + * The Plane REST API Visit our quick start guide and full API documentation at [developers.plane.so](https://developers.plane.so/api-reference/introduction). |
| 6 | + * |
| 7 | + * The version of the API Spec: 0.0.2 |
| 8 | + |
| 9 | + * |
| 10 | + * NOTE: This class is auto generated. |
| 11 | + * Do not edit the class manually. |
| 12 | + */ |
| 13 | + |
| 14 | + |
| 15 | +import * as runtime from '../runtime'; |
| 16 | +import type { |
| 17 | + Epic, |
| 18 | + PaginatedEpicResponse, |
| 19 | +} from '../models/index'; |
| 20 | +import { |
| 21 | + EpicFromJSON, |
| 22 | + EpicToJSON, |
| 23 | + PaginatedEpicResponseFromJSON, |
| 24 | + PaginatedEpicResponseToJSON, |
| 25 | +} from '../models/index'; |
| 26 | + |
| 27 | +export interface ListEpicsRequest { |
| 28 | + projectId: string; |
| 29 | + slug: string; |
| 30 | + cursor?: string; |
| 31 | + perPage?: number; |
| 32 | +} |
| 33 | + |
| 34 | +export interface RetrieveEpicRequest { |
| 35 | + pk: string; |
| 36 | + projectId: string; |
| 37 | + slug: string; |
| 38 | + fields?: string; |
| 39 | +} |
| 40 | + |
| 41 | +/** |
| 42 | + * |
| 43 | + */ |
| 44 | +export class EpicsApi extends runtime.BaseAPI { |
| 45 | + |
| 46 | + /** |
| 47 | + * List epics |
| 48 | + * List epics |
| 49 | + */ |
| 50 | + async listEpicsRaw(requestParameters: ListEpicsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedEpicResponse>> { |
| 51 | + if (requestParameters['projectId'] == null) { |
| 52 | + throw new runtime.RequiredError( |
| 53 | + 'projectId', |
| 54 | + 'Required parameter "projectId" was null or undefined when calling listEpics().' |
| 55 | + ); |
| 56 | + } |
| 57 | + |
| 58 | + if (requestParameters['slug'] == null) { |
| 59 | + throw new runtime.RequiredError( |
| 60 | + 'slug', |
| 61 | + 'Required parameter "slug" was null or undefined when calling listEpics().' |
| 62 | + ); |
| 63 | + } |
| 64 | + |
| 65 | + const queryParameters: any = {}; |
| 66 | + |
| 67 | + if (requestParameters['cursor'] != null) { |
| 68 | + queryParameters['cursor'] = requestParameters['cursor']; |
| 69 | + } |
| 70 | + |
| 71 | + if (requestParameters['perPage'] != null) { |
| 72 | + queryParameters['per_page'] = requestParameters['perPage']; |
| 73 | + } |
| 74 | + |
| 75 | + const headerParameters: runtime.HTTPHeaders = {}; |
| 76 | + |
| 77 | + if (this.configuration && this.configuration.apiKey) { |
| 78 | + headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuthentication authentication |
| 79 | + } |
| 80 | + |
| 81 | + if (this.configuration && this.configuration.accessToken) { |
| 82 | + // oauth required |
| 83 | + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2Authentication", []); |
| 84 | + } |
| 85 | + |
| 86 | + if (this.configuration && this.configuration.accessToken) { |
| 87 | + // oauth required |
| 88 | + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2Authentication", []); |
| 89 | + } |
| 90 | + |
| 91 | + const response = await this.request({ |
| 92 | + path: `/api/v1/workspaces/{slug}/projects/{project_id}/epics/`.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug']))), |
| 93 | + method: 'GET', |
| 94 | + headers: headerParameters, |
| 95 | + query: queryParameters, |
| 96 | + }, initOverrides); |
| 97 | + |
| 98 | + return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedEpicResponseFromJSON(jsonValue)); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * List epics |
| 103 | + * List epics |
| 104 | + */ |
| 105 | + async listEpics(requestParameters: ListEpicsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedEpicResponse> { |
| 106 | + const response = await this.listEpicsRaw(requestParameters, initOverrides); |
| 107 | + return await response.value(); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * Retrieve an epic by id |
| 112 | + * Retrieve an epic |
| 113 | + */ |
| 114 | + async retrieveEpicRaw(requestParameters: RetrieveEpicRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Epic>> { |
| 115 | + if (requestParameters['pk'] == null) { |
| 116 | + throw new runtime.RequiredError( |
| 117 | + 'pk', |
| 118 | + 'Required parameter "pk" was null or undefined when calling retrieveEpic().' |
| 119 | + ); |
| 120 | + } |
| 121 | + |
| 122 | + if (requestParameters['projectId'] == null) { |
| 123 | + throw new runtime.RequiredError( |
| 124 | + 'projectId', |
| 125 | + 'Required parameter "projectId" was null or undefined when calling retrieveEpic().' |
| 126 | + ); |
| 127 | + } |
| 128 | + |
| 129 | + if (requestParameters['slug'] == null) { |
| 130 | + throw new runtime.RequiredError( |
| 131 | + 'slug', |
| 132 | + 'Required parameter "slug" was null or undefined when calling retrieveEpic().' |
| 133 | + ); |
| 134 | + } |
| 135 | + |
| 136 | + const queryParameters: any = {}; |
| 137 | + |
| 138 | + if (requestParameters['fields'] != null) { |
| 139 | + queryParameters['fields'] = requestParameters['fields']; |
| 140 | + } |
| 141 | + |
| 142 | + const headerParameters: runtime.HTTPHeaders = {}; |
| 143 | + |
| 144 | + if (this.configuration && this.configuration.apiKey) { |
| 145 | + headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuthentication authentication |
| 146 | + } |
| 147 | + |
| 148 | + if (this.configuration && this.configuration.accessToken) { |
| 149 | + // oauth required |
| 150 | + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2Authentication", []); |
| 151 | + } |
| 152 | + |
| 153 | + if (this.configuration && this.configuration.accessToken) { |
| 154 | + // oauth required |
| 155 | + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2Authentication", []); |
| 156 | + } |
| 157 | + |
| 158 | + const response = await this.request({ |
| 159 | + path: `/api/v1/workspaces/{slug}/projects/{project_id}/epics/{pk}/`.replace(`{${"pk"}}`, encodeURIComponent(String(requestParameters['pk']))).replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug']))), |
| 160 | + method: 'GET', |
| 161 | + headers: headerParameters, |
| 162 | + query: queryParameters, |
| 163 | + }, initOverrides); |
| 164 | + |
| 165 | + return new runtime.JSONApiResponse(response, (jsonValue) => EpicFromJSON(jsonValue)); |
| 166 | + } |
| 167 | + |
| 168 | + /** |
| 169 | + * Retrieve an epic by id |
| 170 | + * Retrieve an epic |
| 171 | + */ |
| 172 | + async retrieveEpic(requestParameters: RetrieveEpicRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Epic> { |
| 173 | + const response = await this.retrieveEpicRaw(requestParameters, initOverrides); |
| 174 | + return await response.value(); |
| 175 | + } |
| 176 | + |
| 177 | +} |
0 commit comments