Skip to content

Commit

Permalink
feat: Added api params to string translation approvals and votes API (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
faizan1191 authored Oct 30, 2023
1 parent 4379c54 commit d38eeb1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/stringTranslations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export class StringTranslations extends CrowdinApi {
* @param limit maximum number of items to retrieve (default 25)
* @param offset starting offset in the collection (default 0)
* @param fileId file identifier
* @param labelIds label Identifiers
* @param excludeLabelIds exclude label Identifiers
* @deprecated optional parameters should be passed through an object
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.getMany
*/
Expand All @@ -40,6 +42,8 @@ export class StringTranslations extends CrowdinApi {
limit?: number,
offset?: number,
fileId?: number,
labelIds?: string,
excludeLabelIds?: string,
): Promise<ResponseList<StringTranslationsModel.Approval>>;
listTranslationApprovals(
projectId: number,
Expand All @@ -49,6 +53,8 @@ export class StringTranslations extends CrowdinApi {
deprecatedLimit?: number,
deprecatedOffset?: number,
deprecatedFileId?: number,
deprecatedLabelIds?: string,
deprecatedExcludeLabelIds?: string,
): Promise<ResponseList<StringTranslationsModel.Approval>> {
let url = `${this.url}/projects/${projectId}/approvals`;
if (isOptionalNumber(options, '1' in arguments)) {
Expand All @@ -59,12 +65,16 @@ export class StringTranslations extends CrowdinApi {
limit: deprecatedLimit,
offset: deprecatedOffset,
fileId: deprecatedFileId,
labelIds: deprecatedLabelIds,
excludeLabelIds: deprecatedExcludeLabelIds,
};
}
url = this.addQueryParam(url, 'stringId', options.stringId);
url = this.addQueryParam(url, 'languageId', options.languageId);
url = this.addQueryParam(url, 'translationId', options.translationId);
url = this.addQueryParam(url, 'fileId', options.fileId);
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 @@ -327,6 +337,8 @@ export class StringTranslations extends CrowdinApi {
* @param stringId string identifier
* @param languageId language identifier
* @param translationId translation identifier
* @param labelIds label Identifiers
* @param excludeLabelIds exclude label Identifiers
* @param limit maximum number of items to retrieve (default 25)
* @param offset starting offset in the collection (default 0)
* @deprecated optional parameters should be passed through an object
Expand All @@ -337,6 +349,8 @@ export class StringTranslations extends CrowdinApi {
stringId?: number,
languageId?: string,
translationId?: number,
labelIds?: string,
excludeLabelIds?: string,
limit?: number,
offset?: number,
): Promise<ResponseList<StringTranslationsModel.Vote>>;
Expand All @@ -345,6 +359,8 @@ export class StringTranslations extends CrowdinApi {
options?: number | StringTranslationsModel.ListTranslationVotesOptions,
deprecatedLanguageId?: string,
deprecatedTranslationId?: number,
deprecatedLabelIds?: string,
deprecatedExcludeLabelIds?: string,
deprecatedLimit?: number,
deprecatedOffset?: number,
): Promise<ResponseList<StringTranslationsModel.Vote>> {
Expand All @@ -354,13 +370,17 @@ export class StringTranslations extends CrowdinApi {
stringId: options,
languageId: deprecatedLanguageId,
translationId: deprecatedTranslationId,
labelIds: deprecatedLabelIds,
excludeLabelIds: deprecatedExcludeLabelIds,
limit: deprecatedLimit,
offset: deprecatedOffset,
};
}
url = this.addQueryParam(url, 'stringId', options.stringId);
url = this.addQueryParam(url, 'languageId', options.languageId);
url = this.addQueryParam(url, 'translationId', options.translationId);
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 @@ -404,6 +424,8 @@ export namespace StringTranslationsModel {
languageId?: string;
translationId?: number;
fileId?: number;
labelIds?: string;
excludeLabelIds?: string;
}

export interface Approval {
Expand Down Expand Up @@ -500,6 +522,8 @@ export namespace StringTranslationsModel {
stringId?: number;
languageId?: string;
translationId?: number;
labelIds?: string;
excludeLabelIds?: string;
}

export interface Vote {
Expand Down

0 comments on commit d38eeb1

Please sign in to comment.