Skip to content

Commit

Permalink
added new params (crowdin#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ authored Nov 29, 2023
1 parent d3a067f commit 5431e18
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/screenshots/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import { CrowdinApi, isOptionalNumber, PaginationOptions, PatchRequest, Response
export class Screenshots extends CrowdinApi {
/**
* @param projectId project identifier
* @param options optional pagination parameters for the request
* @param options search options
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.screenshots.getMany
*/
listScreenshots(projectId: number, options?: PaginationOptions): Promise<ResponseList<ScreenshotsModel.Screenshot>>;
listScreenshots(
projectId: number,
options?: ScreenshotsModel.ListScreenshotParams,
): Promise<ResponseList<ScreenshotsModel.Screenshot>>;
/**
* @param projectId project identifier
* @param limit maximum number of items to retrieve (default 25)
Expand All @@ -27,13 +30,16 @@ export class Screenshots extends CrowdinApi {
): Promise<ResponseList<ScreenshotsModel.Screenshot>>;
listScreenshots(
projectId: number,
options?: number | PaginationOptions,
options?: number | ScreenshotsModel.ListScreenshotParams,
deprecatedOffset?: number,
): Promise<ResponseList<ScreenshotsModel.Screenshot>> {
if (isOptionalNumber(options, '1' in arguments)) {
options = { limit: options, offset: deprecatedOffset };
}
const url = `${this.url}/projects/${projectId}/screenshots`;
let url = `${this.url}/projects/${projectId}/screenshots`;
url = this.addQueryParam(url, 'stringId', options.stringId);
url = this.addQueryParam(url, 'labelIds', options.labelIds);
url = this.addQueryParam(url, 'excludeLabelIds', options.excludeLabelIds);
return this.getList(url, options.limit, options.offset);
}

Expand Down Expand Up @@ -219,6 +225,12 @@ export class Screenshots extends CrowdinApi {
}

export namespace ScreenshotsModel {
export interface ListScreenshotParams extends PaginationOptions {
stringId?: number;
labelIds?: string;
excludeLabelIds?: string;
}

export interface Screenshot {
id: number;
userId: number;
Expand All @@ -228,6 +240,7 @@ export namespace ScreenshotsModel {
tagsCount: number;
tags: Tag[];
labels: number[];
labelIds: number[];
createdAt: string;
updatedAt: string;
}
Expand All @@ -239,6 +252,7 @@ export namespace ScreenshotsModel {
fileId?: number;
branchId?: number;
directoryId?: number;
labelIds?: number[];
}

export interface UpdateScreenshotRequest {
Expand Down

0 comments on commit 5431e18

Please sign in to comment.