|
| 1 | +/* tslint:disable */ |
| 2 | +/* eslint-disable */ |
| 3 | +/** |
| 4 | + * Zeplin API |
| 5 | + * Access your resources in Zeplin |
| 6 | + * |
| 7 | + |
| 8 | + * |
| 9 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 10 | + * https://openapi-generator.tech |
| 11 | + * Do not edit the class manually. |
| 12 | + */ |
| 13 | + |
| 14 | + |
| 15 | +import globalAxios, { AxiosPromise, AxiosInstance, AxiosResponse } from 'axios'; |
| 16 | +import FormData from 'form-data'; |
| 17 | +import { Configuration } from '../configuration'; |
| 18 | +// Some imports not used depending on template conditions |
| 19 | +// @ts-ignore |
| 20 | +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; |
| 21 | +// @ts-ignore |
| 22 | +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; |
| 23 | +// @ts-ignore |
| 24 | +import { |
| 25 | + ErrorResponse, |
| 26 | + transformErrorResponseToJSON, |
| 27 | + transformJSONToErrorResponse |
| 28 | +} from '../models'; |
| 29 | +// @ts-ignore |
| 30 | +import { |
| 31 | + VariableCollection, |
| 32 | + transformVariableCollectionToJSON, |
| 33 | + transformJSONToVariableCollection |
| 34 | +} from '../models'; |
| 35 | +/** |
| 36 | + * VariableCollectionsApi - axios parameter creator |
| 37 | + * @export |
| 38 | + */ |
| 39 | +export const VariableCollectionsApiAxiosParamCreator = function (configuration?: Configuration) { |
| 40 | + return { |
| 41 | + /** |
| 42 | + * This endpoint returns all of the color variables in a project You need to be a member of the project or a member of the organization that owns the project. Returns `Not Found` response otherwise. |
| 43 | + * @summary Get project variable collections |
| 44 | + * @param {string} projectId Project id |
| 45 | + * @param {number} [limit] Pagination limit |
| 46 | + * @param {number} [offset] Pagination offset |
| 47 | + * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not |
| 48 | + * @param {*} [options] Override http request option. |
| 49 | + * @throws {RequiredError} |
| 50 | + */ |
| 51 | + getProjectVariableCollections: async (projectId: string, limit?: number, offset?: number, includeLinkedStyleguides?: boolean, options: any = {}): Promise<RequestArgs> => { |
| 52 | + // verify required parameter 'projectId' is not null or undefined |
| 53 | + assertParamExists('getProjectVariableCollections', 'projectId', projectId) |
| 54 | + const localVarPath = `/v1/projects/{project_id}/variable_collections` |
| 55 | + .replace(`{${"project_id"}}`, encodeURIComponent(String(projectId))); |
| 56 | + // use dummy base URL string because the URL constructor only accepts absolute URLs. |
| 57 | + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); |
| 58 | + let baseOptions; |
| 59 | + if (configuration) { |
| 60 | + baseOptions = configuration.baseOptions; |
| 61 | + } |
| 62 | + |
| 63 | + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; |
| 64 | + const localVarHeaderParameter = {} as any; |
| 65 | + const localVarQueryParameter = {} as any; |
| 66 | + |
| 67 | + // authentication OAuth2 required |
| 68 | + // oauth required |
| 69 | + await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) |
| 70 | + |
| 71 | + // authentication PersonalAccessToken required |
| 72 | + // http bearer authentication required |
| 73 | + await setBearerAuthToObject(localVarHeaderParameter, configuration) |
| 74 | + |
| 75 | + if (limit !== undefined) { |
| 76 | + localVarQueryParameter['limit'] = limit; |
| 77 | + } |
| 78 | + |
| 79 | + if (offset !== undefined) { |
| 80 | + localVarQueryParameter['offset'] = offset; |
| 81 | + } |
| 82 | + |
| 83 | + if (includeLinkedStyleguides !== undefined) { |
| 84 | + localVarQueryParameter['include_linked_styleguides'] = includeLinkedStyleguides; |
| 85 | + } |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); |
| 90 | + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; |
| 91 | + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; |
| 92 | + |
| 93 | + return { |
| 94 | + url: toPathString(localVarUrlObj), |
| 95 | + options: localVarRequestOptions, |
| 96 | + }; |
| 97 | + }, |
| 98 | + /** |
| 99 | + * This endpoint returns all of the color variables in a styleguide You need to be a member of the styleguide or a member of the organization that owns the styleguide. Returns `Not Found` response otherwise. |
| 100 | + * @summary Get styleguide variable collections |
| 101 | + * @param {string} styleguideId Styleguide id |
| 102 | + * @param {number} [limit] Pagination limit |
| 103 | + * @param {number} [offset] Pagination offset |
| 104 | + * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not |
| 105 | + * @param {*} [options] Override http request option. |
| 106 | + * @throws {RequiredError} |
| 107 | + */ |
| 108 | + getStyleguideVariableCollections: async (styleguideId: string, limit?: number, offset?: number, includeLinkedStyleguides?: boolean, options: any = {}): Promise<RequestArgs> => { |
| 109 | + // verify required parameter 'styleguideId' is not null or undefined |
| 110 | + assertParamExists('getStyleguideVariableCollections', 'styleguideId', styleguideId) |
| 111 | + const localVarPath = `/v1/styleguides/{styleguide_id}/variable_collections` |
| 112 | + .replace(`{${"styleguide_id"}}`, encodeURIComponent(String(styleguideId))); |
| 113 | + // use dummy base URL string because the URL constructor only accepts absolute URLs. |
| 114 | + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); |
| 115 | + let baseOptions; |
| 116 | + if (configuration) { |
| 117 | + baseOptions = configuration.baseOptions; |
| 118 | + } |
| 119 | + |
| 120 | + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; |
| 121 | + const localVarHeaderParameter = {} as any; |
| 122 | + const localVarQueryParameter = {} as any; |
| 123 | + |
| 124 | + // authentication OAuth2 required |
| 125 | + // oauth required |
| 126 | + await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) |
| 127 | + |
| 128 | + // authentication PersonalAccessToken required |
| 129 | + // http bearer authentication required |
| 130 | + await setBearerAuthToObject(localVarHeaderParameter, configuration) |
| 131 | + |
| 132 | + if (limit !== undefined) { |
| 133 | + localVarQueryParameter['limit'] = limit; |
| 134 | + } |
| 135 | + |
| 136 | + if (offset !== undefined) { |
| 137 | + localVarQueryParameter['offset'] = offset; |
| 138 | + } |
| 139 | + |
| 140 | + if (includeLinkedStyleguides !== undefined) { |
| 141 | + localVarQueryParameter['include_linked_styleguides'] = includeLinkedStyleguides; |
| 142 | + } |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); |
| 147 | + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; |
| 148 | + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; |
| 149 | + |
| 150 | + return { |
| 151 | + url: toPathString(localVarUrlObj), |
| 152 | + options: localVarRequestOptions, |
| 153 | + }; |
| 154 | + }, |
| 155 | + } |
| 156 | +}; |
| 157 | + |
| 158 | +/** |
| 159 | + * VariableCollectionsApi - functional programming interface |
| 160 | + * @export |
| 161 | + */ |
| 162 | +export const VariableCollectionsApiFp = function(configuration?: Configuration) { |
| 163 | + const localVarAxiosParamCreator = VariableCollectionsApiAxiosParamCreator(configuration) |
| 164 | + return { |
| 165 | + /** |
| 166 | + * This endpoint returns all of the color variables in a project You need to be a member of the project or a member of the organization that owns the project. Returns `Not Found` response otherwise. |
| 167 | + * @summary Get project variable collections |
| 168 | + * @param {string} projectId Project id |
| 169 | + * @param {number} [limit] Pagination limit |
| 170 | + * @param {number} [offset] Pagination offset |
| 171 | + * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not |
| 172 | + * @param {*} [options] Override http request option. |
| 173 | + * @throws {RequiredError} |
| 174 | + */ |
| 175 | + async getProjectVariableCollections(projectId: string, limit?: number, offset?: number, includeLinkedStyleguides?: boolean, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> { |
| 176 | + const localVarAxiosArgs = await localVarAxiosParamCreator.getProjectVariableCollections(projectId, limit, offset, includeLinkedStyleguides, options); |
| 177 | + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); |
| 178 | + }, |
| 179 | + /** |
| 180 | + * This endpoint returns all of the color variables in a styleguide You need to be a member of the styleguide or a member of the organization that owns the styleguide. Returns `Not Found` response otherwise. |
| 181 | + * @summary Get styleguide variable collections |
| 182 | + * @param {string} styleguideId Styleguide id |
| 183 | + * @param {number} [limit] Pagination limit |
| 184 | + * @param {number} [offset] Pagination offset |
| 185 | + * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not |
| 186 | + * @param {*} [options] Override http request option. |
| 187 | + * @throws {RequiredError} |
| 188 | + */ |
| 189 | + async getStyleguideVariableCollections(styleguideId: string, limit?: number, offset?: number, includeLinkedStyleguides?: boolean, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> { |
| 190 | + const localVarAxiosArgs = await localVarAxiosParamCreator.getStyleguideVariableCollections(styleguideId, limit, offset, includeLinkedStyleguides, options); |
| 191 | + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); |
| 192 | + }, |
| 193 | + } |
| 194 | +}; |
| 195 | + |
| 196 | + |
| 197 | +/** |
| 198 | + * Search parameters for getProjectVariableCollections operation in VariableCollectionsApi. |
| 199 | + * @export |
| 200 | + * @interface VariableCollectionsApiGetProjectVariableCollectionsSearchParams |
| 201 | + */ |
| 202 | +export interface VariableCollectionsApiGetProjectVariableCollectionsSearchParams { |
| 203 | + /** |
| 204 | + * Pagination limit |
| 205 | + * @type {number} |
| 206 | + * @memberof VariableCollectionsApiGetProjectVariableCollectionsSearchParams |
| 207 | + */ |
| 208 | + readonly limit?: number; |
| 209 | + |
| 210 | + /** |
| 211 | + * Pagination offset |
| 212 | + * @type {number} |
| 213 | + * @memberof VariableCollectionsApiGetProjectVariableCollectionsSearchParams |
| 214 | + */ |
| 215 | + readonly offset?: number; |
| 216 | + |
| 217 | + /** |
| 218 | + * Whether to include linked styleguides or not |
| 219 | + * @type {boolean} |
| 220 | + * @memberof VariableCollectionsApiGetProjectVariableCollectionsSearchParams |
| 221 | + */ |
| 222 | + readonly includeLinkedStyleguides?: boolean; |
| 223 | +} |
| 224 | + |
| 225 | +/** |
| 226 | + * Search parameters for getStyleguideVariableCollections operation in VariableCollectionsApi. |
| 227 | + * @export |
| 228 | + * @interface VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams |
| 229 | + */ |
| 230 | +export interface VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams { |
| 231 | + /** |
| 232 | + * Pagination limit |
| 233 | + * @type {number} |
| 234 | + * @memberof VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams |
| 235 | + */ |
| 236 | + readonly limit?: number; |
| 237 | + |
| 238 | + /** |
| 239 | + * Pagination offset |
| 240 | + * @type {number} |
| 241 | + * @memberof VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams |
| 242 | + */ |
| 243 | + readonly offset?: number; |
| 244 | + |
| 245 | + /** |
| 246 | + * Whether to include linked styleguides or not |
| 247 | + * @type {boolean} |
| 248 | + * @memberof VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams |
| 249 | + */ |
| 250 | + readonly includeLinkedStyleguides?: boolean; |
| 251 | +} |
| 252 | + |
| 253 | + |
| 254 | +/** |
| 255 | + * VariableCollectionsApi - object-oriented interface |
| 256 | + * @export |
| 257 | + * @class VariableCollectionsApi |
| 258 | + * @extends {BaseAPI} |
| 259 | + */ |
| 260 | +export class VariableCollectionsApi extends BaseAPI { |
| 261 | + /** |
| 262 | + * This endpoint returns all of the color variables in a project You need to be a member of the project or a member of the organization that owns the project. Returns `Not Found` response otherwise. |
| 263 | + * @summary Get project variable collections |
| 264 | + * @param {string} projectId Project id |
| 265 | + * @param {VariableCollectionsApiGetProjectVariableCollectionsSearchParams} [searchParams] Search parameters. |
| 266 | + * @param {*} [options] Override http request option. |
| 267 | + * @throws {RequiredError} |
| 268 | + * @memberof VariableCollectionsApi |
| 269 | + */ |
| 270 | + public async getProjectVariableCollections(projectId: string, searchParams: VariableCollectionsApiGetProjectVariableCollectionsSearchParams = {}, options?: any) : Promise<AxiosResponse<Array<VariableCollection>>> { |
| 271 | + const variableCollectionsApiFp = VariableCollectionsApiFp(this.configuration); |
| 272 | + const request = await variableCollectionsApiFp.getProjectVariableCollections(projectId, searchParams.limit, searchParams.offset, searchParams.includeLinkedStyleguides, options); |
| 273 | + const response = await request(this.axios, this.basePath); |
| 274 | + return { |
| 275 | + ...response, |
| 276 | + data: response.data.map(transformJSONToVariableCollection) |
| 277 | + }; |
| 278 | + } |
| 279 | + |
| 280 | + /** |
| 281 | + * This endpoint returns all of the color variables in a styleguide You need to be a member of the styleguide or a member of the organization that owns the styleguide. Returns `Not Found` response otherwise. |
| 282 | + * @summary Get styleguide variable collections |
| 283 | + * @param {string} styleguideId Styleguide id |
| 284 | + * @param {VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams} [searchParams] Search parameters. |
| 285 | + * @param {*} [options] Override http request option. |
| 286 | + * @throws {RequiredError} |
| 287 | + * @memberof VariableCollectionsApi |
| 288 | + */ |
| 289 | + public async getStyleguideVariableCollections(styleguideId: string, searchParams: VariableCollectionsApiGetStyleguideVariableCollectionsSearchParams = {}, options?: any) : Promise<AxiosResponse<Array<VariableCollection>>> { |
| 290 | + const variableCollectionsApiFp = VariableCollectionsApiFp(this.configuration); |
| 291 | + const request = await variableCollectionsApiFp.getStyleguideVariableCollections(styleguideId, searchParams.limit, searchParams.offset, searchParams.includeLinkedStyleguides, options); |
| 292 | + const response = await request(this.axios, this.basePath); |
| 293 | + return { |
| 294 | + ...response, |
| 295 | + data: response.data.map(transformJSONToVariableCollection) |
| 296 | + }; |
| 297 | + } |
| 298 | +} |
0 commit comments