Skip to content

Commit ce81163

Browse files
committed
v1.0.0
1 parent af2f40d commit ce81163

File tree

276 files changed

+31521
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+31521
-0
lines changed

src/api.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Zeplin API
5+
* Access your resources in Zeplin
6+
*
7+
* Contact: [email protected]
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+
16+
import globalAxios, { AxiosInstance } from 'axios';
17+
18+
import { BaseAPI, BASE_PATH } from './base';
19+
import { Configuration } from "./configuration";
20+
21+
import { AuthorizationApi } from './apis/authorization-api';
22+
import { ColorsApi } from './apis/colors-api';
23+
import { ComponentsApi } from './apis/components-api';
24+
import { DesignTokensApi } from './apis/design-tokens-api';
25+
import { NotificationsApi } from './apis/notifications-api';
26+
import { OrganizationsApi } from './apis/organizations-api';
27+
import { ProjectsApi } from './apis/projects-api';
28+
import { ScreensApi } from './apis/screens-api';
29+
import { SpacingApi } from './apis/spacing-api';
30+
import { StyleguidesApi } from './apis/styleguides-api';
31+
import { TextStylesApi } from './apis/text-styles-api';
32+
import { UsersApi } from './apis/users-api';
33+
import { WebhooksApi } from './apis/webhooks-api';
34+
35+
import { Webhooks } from './utilities/webhooks';
36+
37+
38+
export class ZeplinApi extends BaseAPI {
39+
protected configuration: Configuration | undefined;
40+
authorization: AuthorizationApi;
41+
colors: ColorsApi;
42+
components: ComponentsApi;
43+
designTokens: DesignTokensApi;
44+
notifications: NotificationsApi;
45+
organizations: OrganizationsApi;
46+
projects: ProjectsApi;
47+
screens: ScreensApi;
48+
spacing: SpacingApi;
49+
styleguides: StyleguidesApi;
50+
textStyles: TextStylesApi;
51+
users: UsersApi;
52+
webhooks: WebhooksApi;
53+
54+
55+
static Webhooks = Webhooks;
56+
57+
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
58+
super(configuration, basePath, axios);
59+
this.authorization = new AuthorizationApi(configuration, basePath, axios);
60+
this.colors = new ColorsApi(configuration, basePath, axios);
61+
this.components = new ComponentsApi(configuration, basePath, axios);
62+
this.designTokens = new DesignTokensApi(configuration, basePath, axios);
63+
this.notifications = new NotificationsApi(configuration, basePath, axios);
64+
this.organizations = new OrganizationsApi(configuration, basePath, axios);
65+
this.projects = new ProjectsApi(configuration, basePath, axios);
66+
this.screens = new ScreensApi(configuration, basePath, axios);
67+
this.spacing = new SpacingApi(configuration, basePath, axios);
68+
this.styleguides = new StyleguidesApi(configuration, basePath, axios);
69+
this.textStyles = new TextStylesApi(configuration, basePath, axios);
70+
this.users = new UsersApi(configuration, basePath, axios);
71+
this.webhooks = new WebhooksApi(configuration, basePath, axios);
72+
73+
}
74+
}
75+

src/apis/authorization-api.ts

Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Zeplin API
5+
* Access your resources in Zeplin
6+
*
7+
* Contact: [email protected]
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+
16+
import globalAxios, { AxiosPromise, AxiosInstance, AxiosResponse } from 'axios';
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 { ErrorResponse } from '../models';
25+
// @ts-ignore
26+
import { TokenCreateBody, transformTokenCreateBodyToJSON } from '../models';
27+
// @ts-ignore
28+
import { TokenResponse, transformJSONToTokenResponse } from '../models';
29+
/**
30+
* AuthorizationApi - axios parameter creator
31+
* @export
32+
*/
33+
export const AuthorizationApiAxiosParamCreator = function (configuration?: Configuration) {
34+
return {
35+
/**
36+
* Users are redirected to web app to authenticate themselves and authorize the app with `client_id` to act on behalf of themselves.
37+
* @summary Authorization endpoint
38+
* @param {string} responseType Only `code` flow is supported
39+
* @param {string} clientId Identifier of the Zeplin app requesting user authentication
40+
* @param {string} redirectUri User is redirected to this endpoint after authorization
41+
* @param {string} [state] RECOMMENDED. An opaque value used by the client to maintain state between the request and callback.
42+
* @param {*} [options] Override http request option.
43+
* @throws {RequiredError}
44+
*/
45+
oAuthAuthorize: (responseType: string, clientId: string, redirectUri: string, state?: string, options: any = {}): RequestArgs => {
46+
// verify required parameter 'responseType' is not null or undefined
47+
assertParamExists('oAuthAuthorize', 'responseType', responseType)
48+
// verify required parameter 'clientId' is not null or undefined
49+
assertParamExists('oAuthAuthorize', 'clientId', clientId)
50+
// verify required parameter 'redirectUri' is not null or undefined
51+
assertParamExists('oAuthAuthorize', 'redirectUri', redirectUri)
52+
const localVarPath = `/v1/oauth/authorize`;
53+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
54+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
55+
let baseOptions;
56+
if (configuration) {
57+
baseOptions = configuration.baseOptions;
58+
}
59+
60+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
61+
const localVarHeaderParameter = {} as any;
62+
const localVarQueryParameter = {} as any;
63+
64+
if (responseType !== undefined) {
65+
localVarQueryParameter['response_type'] = responseType;
66+
}
67+
68+
if (clientId !== undefined) {
69+
localVarQueryParameter['client_id'] = clientId;
70+
}
71+
72+
if (redirectUri !== undefined) {
73+
localVarQueryParameter['redirect_uri'] = redirectUri;
74+
}
75+
76+
if (state !== undefined) {
77+
localVarQueryParameter['state'] = state;
78+
}
79+
80+
81+
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
82+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
83+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
84+
85+
return {
86+
url: toPathString(localVarUrlObj),
87+
options: localVarRequestOptions,
88+
};
89+
},
90+
/**
91+
* If `grant_type` is given as `authorization_code`; handles code flow. If `grant_type` is given as `refresh_token` handles refresh token flow.
92+
* @summary Access token endpoint
93+
* @param {TokenCreateBody} tokenCreateBody
94+
* @param {*} [options] Override http request option.
95+
* @throws {RequiredError}
96+
*/
97+
oAuthPostToken: (tokenCreateBody: TokenCreateBody, options: any = {}): RequestArgs => {
98+
// verify required parameter 'tokenCreateBody' is not null or undefined
99+
assertParamExists('oAuthPostToken', 'tokenCreateBody', tokenCreateBody)
100+
const localVarPath = `/v1/oauth/token`;
101+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
102+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
103+
let baseOptions;
104+
if (configuration) {
105+
baseOptions = configuration.baseOptions;
106+
}
107+
108+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
109+
const localVarHeaderParameter = {} as any;
110+
const localVarQueryParameter = {} as any;
111+
112+
113+
114+
localVarHeaderParameter['Content-Type'] = 'application/json';
115+
116+
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
117+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
118+
119+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
120+
localVarRequestOptions.data = serializeDataIfNeeded(transformTokenCreateBodyToJSON(tokenCreateBody), localVarRequestOptions, configuration);
121+
122+
return {
123+
url: toPathString(localVarUrlObj),
124+
options: localVarRequestOptions,
125+
};
126+
},
127+
}
128+
};
129+
130+
/**
131+
* AuthorizationApi - functional programming interface
132+
* @export
133+
*/
134+
export const AuthorizationApiFp = function(configuration?: Configuration) {
135+
const localVarAxiosParamCreator = AuthorizationApiAxiosParamCreator(configuration)
136+
return {
137+
/**
138+
* If `grant_type` is given as `authorization_code`; handles code flow. If `grant_type` is given as `refresh_token` handles refresh token flow.
139+
* @summary Access token endpoint
140+
* @param {TokenCreateBody} tokenCreateBody
141+
* @param {*} [options] Override http request option.
142+
* @throws {RequiredError}
143+
*/
144+
async oAuthPostToken(tokenCreateBody: TokenCreateBody, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
145+
const localVarAxiosArgs = await localVarAxiosParamCreator.oAuthPostToken(tokenCreateBody, options);
146+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
147+
},
148+
}
149+
};
150+
151+
/**
152+
* Search parameters for getAuthorizeUrl operation in AuthorizationApi.
153+
* @export
154+
* @interface AuthorizationApiGetAuthorizationUrlSearchParams
155+
*/
156+
export interface AuthorizationApiGetAuthorizationUrlSearchParams {
157+
/**
158+
* Identifier of the Zeplin app requesting user authentication
159+
* @type {string}
160+
* @memberof AuthorizationApiGetAuthorizationUrlSearchParams
161+
*/
162+
readonly clientId: string
163+
164+
/**
165+
* User is redirected to this endpoint after authorization
166+
* @type {string}
167+
* @memberof AuthorizationApiGetAuthorizationUrlSearchParams
168+
*/
169+
readonly redirectUri: string
170+
171+
/**
172+
* RECOMMENDED. An opaque value used by the client to maintain state between the request and callback.
173+
* @type {string}
174+
* @memberof AuthorizationApiGetAuthorizationUrlSearchParams
175+
*/
176+
readonly state?: string
177+
}
178+
179+
180+
/**
181+
* Search parameters for createToken operation in AuthorizationApi.
182+
* @export
183+
* @interface AuthorizationApiCreateTokenParams
184+
*/
185+
export interface AuthorizationApiCreateTokenParams {
186+
/**
187+
* Applies when `grant_type` is `authorization_code`. The `code` obtained after `authorization` request
188+
* @type {string}
189+
* @memberof AuthorizationApiCreateTokenParams
190+
*/
191+
code: string;
192+
/**
193+
* The URL where users will be redirected after authorization
194+
* @type {string}
195+
* @memberof AuthorizationApiCreateTokenParams
196+
*/
197+
redirectUri: string;
198+
/**
199+
* The `client_id` of your Zeplin app
200+
* @type {string}
201+
* @memberof AuthorizationApiCreateTokenParams
202+
*/
203+
clientId: string;
204+
/**
205+
* The `client_secret` of your Zeplin app
206+
* @type {string}
207+
* @memberof AuthorizationApiCreateTokenParams
208+
*/
209+
clientSecret: string;
210+
}
211+
212+
213+
/**
214+
* Search parameters for refreshToken operation in AuthorizationApi.
215+
* @export
216+
* @interface AuthorizationApiRefreshTokenParams
217+
*/
218+
export interface AuthorizationApiRefreshTokenParams {
219+
/**
220+
* The `refresh_token` you obtained while generating the access token in the first place
221+
* @type {string}
222+
* @memberof AuthorizationApiRefreshTokenParams
223+
*/
224+
refreshToken: string;
225+
/**
226+
* The `client_id` of your Zeplin app
227+
* @type {string}
228+
* @memberof AuthorizationApiRefreshTokenParams
229+
*/
230+
clientId: string;
231+
/**
232+
* The `client_secret` of your Zeplin app
233+
* @type {string}
234+
* @memberof AuthorizationApiRefreshTokenParams
235+
*/
236+
clientSecret: string;
237+
}
238+
239+
240+
241+
/**
242+
* AuthorizationApi - object-oriented interface
243+
* @export
244+
* @class AuthorizationApi
245+
* @extends {BaseAPI}
246+
*/
247+
export class AuthorizationApi extends BaseAPI {
248+
249+
/**
250+
* Users are redirected to web app to authenticate themselves and authorize the app with `client_id` to act on behalf of themselves.
251+
* @summary Authorization endpoint
252+
* @param {AuthorizationApiGetAuthorizationUrlSearchParams} searchParams Search parameters.
253+
* @param {*} [options] Override http request option.
254+
* @throws {RequiredError}
255+
* @memberof AuthorizationApi
256+
*/
257+
public getAuthorizationUrl(searchParams: AuthorizationApiGetAuthorizationUrlSearchParams, options?: any): string {
258+
const paramCreator = AuthorizationApiAxiosParamCreator(this.configuration);
259+
const params = paramCreator.oAuthAuthorize("code", searchParams.clientId, searchParams.redirectUri, searchParams.state, options);
260+
return this.axios.getUri({
261+
...params.options,
262+
url: this.basePath + params.url
263+
});
264+
}
265+
266+
267+
/**
268+
* Handles code flow
269+
* @summary Access token endpoint
270+
* @param {AuthorizationApiCreateTokenParams} params
271+
* @param {*} [options] Override http request option.
272+
* @throws {RequiredError}
273+
* @memberof AuthorizationApi
274+
*/
275+
public async createToken(params: AuthorizationApiCreateTokenParams, options?: any): Promise<AxiosResponse<TokenResponse>> {
276+
const authorizationApiFp = AuthorizationApiFp(this.configuration);
277+
const request = await authorizationApiFp.oAuthPostToken(
278+
{
279+
...params,
280+
grantType: "authorization_code"
281+
},
282+
options
283+
);
284+
const response = await request(this.axios, this.basePath);
285+
return {
286+
...response,
287+
data: transformJSONToTokenResponse(response.data)
288+
};
289+
}
290+
291+
292+
/**
293+
* Handles refresh token flow
294+
* @summary Access token endpoint
295+
* @param {AuthorizationApiCreateTokenParams} params
296+
* @param {*} [options] Override http request option.
297+
* @throws {RequiredError}
298+
* @memberof AuthorizationApi
299+
*/
300+
public async refreshToken(params: AuthorizationApiRefreshTokenParams, options?: any): Promise<AxiosResponse<TokenResponse>> {
301+
const authorizationApiFp = AuthorizationApiFp(this.configuration);
302+
const request = await authorizationApiFp.oAuthPostToken(
303+
{
304+
...params,
305+
grantType: "refresh_token"
306+
},
307+
options
308+
);
309+
const response = await request(this.axios, this.basePath);
310+
return {
311+
...response,
312+
data: transformJSONToTokenResponse(response.data)
313+
};
314+
}
315+
}

0 commit comments

Comments
 (0)