Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
[ACS-5839] GS Api enhancements and typings(#1649)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika authored Aug 29, 2023
1 parent 0e9673d commit 8ca4ed0
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
AuthorityClearanceGroupPaging,
NodeSecurityMarkBody, SecurityMarkEntry, SecurityMarkPaging
} from '../model';
import { GsPagingQuery } from './types';

/**
* AuthorityClearanceApi service.
Expand All @@ -30,11 +31,9 @@ export class AuthorityClearanceApi extends BaseApi {
* Get the authority clearances for a single user/group
* @param authorityId The name for the authority for which the clearance is to be fetched. Can be left blank in which case it will fetch it for all users with pagination
* @param opts
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
* @param opts.maxItems The maximum number of items to return in the list.
* @return Promise<AuthorityClearanceGroupPaging>
*/
getAuthorityClearanceForAuthority(authorityId: string, opts?: { skipCount?: number; maxItems?: number }): Promise<AuthorityClearanceGroupPaging> {
getAuthorityClearanceForAuthority(authorityId: string, opts?: GsPagingQuery): Promise<AuthorityClearanceGroupPaging> {
const pathParams = {
authorityId
};
Expand Down
58 changes: 24 additions & 34 deletions src/api/gs-classification-rest-api/api/classificationGuides.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { TopicPaging } from '../model/topicPaging';
import { BaseApi } from './base.api';
import { buildCollectionParam } from '../../../alfrescoApiClient';
import { throwIfNotDefined } from '../../../assert';
import { GsPagingQuery } from './types';

export interface CombinedInstructionsOpts {
instructions?: any;
Expand Down Expand Up @@ -90,14 +91,12 @@ export class ClassificationGuidesApi extends BaseApi {
throwIfNotDefined(topicId, 'topicId');
throwIfNotDefined(topic, 'topic');

opts = opts || {};

const pathParams = {
topicId
};

const queryParams = {
'include': buildCollectionParam(opts['include'], 'csv')
include: buildCollectionParam(opts?.include, 'csv')
};

return this.post({
Expand Down Expand Up @@ -162,13 +161,10 @@ export class ClassificationGuidesApi extends BaseApi {
classificationGuideId
};

const contentTypes = ['application/json'];
const accepts = ['application/json'];

return this.apiClient.callApi(
'/classification-guides/{classificationGuideId}', 'DELETE',
pathParams, {}, {}, {}, null,
contentTypes, accepts);
return this.delete({
path: '/classification-guides/{classificationGuideId}',
pathParams
});
}

/**
Expand All @@ -186,19 +182,15 @@ export class ClassificationGuidesApi extends BaseApi {
topicId
};

const contentTypes = ['application/json'];
const accepts = ['application/json'];

return this.apiClient.callApi(
'/topics/{topicId}', 'DELETE',
pathParams, {}, {}, {}, null,
contentTypes, accepts);
return this.delete({
path: '/topics/{topicId}',
pathParams
});
}

/**
* List all classification guides
*
* Gets all classification guides.
*
* @param opts Optional parameters
* @param opts.include Returns additional information about the guide. The following optional fields can be requested:
* hasTopics - A flag indicating whether the guide already contains any topics.
Expand All @@ -218,15 +210,15 @@ export class ClassificationGuidesApi extends BaseApi {
* @return Promise<ClassificationGuidePaging>
*/
listClassificationGuides(opts?: { include?: string[]; skipCount?: number; maxItems?: number; orderBy?: string[]; where?: string }): Promise<ClassificationGuidePaging> {
listClassificationGuides(opts?: { include?: string[]; orderBy?: string[]; where?: string } & GsPagingQuery): Promise<ClassificationGuidePaging> {
opts = opts || {};

const queryParams = {
'include': buildCollectionParam(opts['include'], 'csv'),
'skipCount': opts['skipCount'],
'maxItems': opts['maxItems'],
'orderBy': buildCollectionParam(opts['orderBy'], 'csv'),
'where': opts['where']
include: buildCollectionParam(opts?.include, 'csv'),
skipCount: opts?.skipCount,
maxItems: opts?.maxItems,
orderBy: buildCollectionParam(opts?.orderBy, 'csv'),
where: opts?.where
};

return this.get({
Expand Down Expand Up @@ -268,12 +260,10 @@ export class ClassificationGuidesApi extends BaseApi {
*/
listSubtopics(topicId: string, opts?: {
include?: string[];
skipCount?: number;
maxItems?: number;
orderBy?: string[];
where?: string;
includeSource?: boolean;
}): Promise<SubtopicPaging> {
} & GsPagingQuery): Promise<SubtopicPaging> {
throwIfNotDefined(topicId, 'topicId');
opts = opts || {};

Expand All @@ -282,12 +272,12 @@ export class ClassificationGuidesApi extends BaseApi {
};

const queryParams = {
'include': buildCollectionParam(opts['include'], 'csv'),
'skipCount': opts['skipCount'],
'maxItems': opts['maxItems'],
'orderBy': buildCollectionParam(opts['orderBy'], 'csv'),
'where': opts['where'],
'includeSource': opts['includeSource']
include: buildCollectionParam(opts?.include, 'csv'),
skipCount: opts?.skipCount,
maxItems: opts?.maxItems,
orderBy: buildCollectionParam(opts?.orderBy, 'csv'),
where: opts?.where,
includeSource: opts?.includeSource
};

return this.get({
Expand Down
49 changes: 16 additions & 33 deletions src/api/gs-classification-rest-api/api/classificationReasons.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import { ClassificationReasonsPaging } from '../model/classificationReasonsPagin
import { BaseApi } from './base.api';
import { buildCollectionParam } from '../../../alfrescoApiClient';
import { throwIfNotDefined } from '../../../assert';
import { GsFieldsQuery, GsPagingQuery } from './types';

/**
* Classificationreasons service.
* ClassificationReasonsApi service.
* @module ClassificationReasonsApi
*/
export class ClassificationReasonsApi extends BaseApi {
Expand Down Expand Up @@ -101,43 +102,25 @@ JSON
classificationReasonId
};

const contentTypes = ['application/json'];
const accepts = ['application/json'];

return this.apiClient.callApi(
'/classification-reasons/{classificationReasonId}', 'DELETE',
pathParams, {}, {}, {}, null,
contentTypes, accepts);
return this.delete({
path: '/classification-reasons/{classificationReasonId}',
pathParams
});
}
/**
* List all classification reasons
*
* Gets all classification reasons.
*
* @param opts Optional parameters
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
* @param opts.maxItems The maximum number of items to return in the list.
* @param opts.fields A list of field names.
You can use this parameter to restrict the fields
returned within a response if, for example, you want to save on overall bandwidth.

The list applies to a returned individual
entity or entries within a collection.
If the API method also supports the **include**
parameter, then the fields specified in the **include**
parameter are returned in addition to those specified in the **fields** parameter.
* @return Promise<ClassificationReasonsPaging>
*/
listClassificationReasons(opts?: { skipCount?: number; maxItems?: number; fields?: string[] }): Promise<ClassificationReasonsPaging> {
/**
* List all classification reasons
*
* @param opts Optional parameters
* @return Promise<ClassificationReasonsPaging>
*/
listClassificationReasons(opts?: GsPagingQuery & GsFieldsQuery): Promise<ClassificationReasonsPaging> {
opts = opts || {};

const queryParams = {
'skipCount': opts['skipCount'],
'maxItems': opts['maxItems'],
'fields': buildCollectionParam(opts['fields'], 'csv')
skipCount: opts?.skipCount,
maxItems: opts?.maxItems,
fields: buildCollectionParam(opts?.fields, 'csv')
};

return this.get({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { DeclassificationExemptionEntry } from '../model/declassificationExempti
import { DeclassificationExemptionsPaging } from '../model/declassificationExemptionsPaging';
import { BaseApi } from './base.api';
import { throwIfNotDefined } from '../../../assert';
import { GsPagingQuery } from './types';

/**
* DeclassificationExemptionsApi service.
Expand Down Expand Up @@ -85,40 +86,35 @@ JSON
returnType: DeclassificationExemptionEntry
});
}

/**
* Delete a declassification exemption
*
* Deletes the declassification exemption with id **declassificationExemptionId**. You can't delete a classification exemption that is being used to classify content.
*
* @param declassificationExemptionId The identifier for the declassification exemption
* @return Promise<{}>
*/
* Delete a declassification exemption
*
* Deletes the declassification exemption with id **declassificationExemptionId**.
* You can't delete a classification exemption that is being used to classify content.
*
* @param declassificationExemptionId The identifier for the declassification exemption
* @return Promise<{}>
*/
deleteDeclassificationExemption(declassificationExemptionId: string): Promise<any> {
throwIfNotDefined(declassificationExemptionId, 'declassificationExemptionId');

const pathParams = {
declassificationExemptionId
};

const contentTypes = ['application/json'];
const accepts = ['application/json'];

return this.apiClient.callApi(
'/declassification-exemptions/{declassificationExemptionId}', 'DELETE',
pathParams, {}, {}, {}, null,
contentTypes, accepts);
return this.delete({
path: '/declassification-exemptions/{declassificationExemptionId}',
pathParams
});
}
/**
* List all declassification exemptions
*
* Gets all declassification exemptions.
*
* @param opts Optional parameters
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
* @param opts.maxItems The maximum number of items to return in the list.
* @return Promise<DeclassificationExemptionsPaging>
*/
listDeclassificationExemptions(opts?: { skipCount?: number; maxItems?: number; }): Promise<DeclassificationExemptionsPaging> {
listDeclassificationExemptions(opts?: GsPagingQuery): Promise<DeclassificationExemptionsPaging> {
return this.get({
path: '/declassification-exemptions',
queryParams: opts,
Expand Down
1 change: 1 addition & 0 deletions src/api/gs-classification-rest-api/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

export * from './types';
export * from './classificationGuides.api';
export * from './classificationReasons.api';
export * from './declassificationExemptions.api';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { BaseApi } from './base.api';
import { throwIfNotDefined } from '../../../assert';
import { NodeSecurityMarkBody } from '../model/nodeSecurityMarkBody';
import { SecurityMarkPaging } from '../model/securityMarkPaging';
import { GsPagingQuery } from './types';

/**
* @module NodeSecurityMarksApi
Expand Down Expand Up @@ -50,10 +51,9 @@ export class NodeSecurityMarksApi extends BaseApi {
* Get security marks on a node
* @param nodeId The key for the node id.
* @param opts Optional parameters
* @param opts.inUse The key for the security mark is in use or not.
* @return Promise<SecurityMarkPaging>
*/
getSecurityMarksOnNode(nodeId: string, opts?: { inUse?: any }): Promise<SecurityMarkPaging> {
getSecurityMarksOnNode(nodeId: string, opts?: GsPagingQuery): Promise<SecurityMarkPaging> {
throwIfNotDefined(nodeId, 'nodeId');

const pathParams = {
Expand Down
23 changes: 5 additions & 18 deletions src/api/gs-classification-rest-api/api/securityGroups.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ import { BaseApi } from './base.api';
import { SecurityGroupPaging } from '../model/securityGroupPaging';
import { SecurityGroupBody } from '../model/securityGroupBody';
import { SecurityGroupEntry } from '../model/securityGroupEntry';

export type GroupInclude = {
/**
* Returns additional information about the security group. The following optional fields can be requested:
* - inUse - A flag indicating whether the security group is in use or not.
*/
include?: string;
}
import { GsGroupInclude, GsPagingQuery } from './types';

/**
* SecurityGroupsApi service.
Expand All @@ -36,12 +29,9 @@ export class SecurityGroupsApi extends BaseApi {
/**
* Get All security groups
* @param opts Optional parameters
* @param opts.include Additional information about the security group
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
* @param opts.maxItems The maximum number of items to return in the list.
* @return Promise<SecurityGroupPaging>
*/
getSecurityGroups(opts?: { skipCount?: number; maxItems?: number; } & GroupInclude): Promise<SecurityGroupPaging> {
getSecurityGroups(opts?: GsPagingQuery & GsGroupInclude): Promise<SecurityGroupPaging> {
return this.get({
path: '/security-groups',
queryParams: opts,
Expand All @@ -53,10 +43,9 @@ export class SecurityGroupsApi extends BaseApi {
* Create security group
* @param securityGroupBody securityGroupBody.
* @param opts Optional parameters
* @param opts.include additional information about the security group
* @return Promise<SecurityGroupEntry>
*/
createSecurityGroup(securityGroupBody: SecurityGroupBody, opts?: GroupInclude): Promise<SecurityGroupEntry> {
createSecurityGroup(securityGroupBody: SecurityGroupBody, opts?: GsGroupInclude): Promise<SecurityGroupEntry> {
return this.post({
path: '/security-groups',
queryParams: opts,
Expand All @@ -68,10 +57,9 @@ export class SecurityGroupsApi extends BaseApi {
* Get a security groups information
* @param securityGroupId The Key of Security Group id for which info is required
* @param opts Optional parameters
* @param opts.include additional information about the security group
* @return Promise<SecurityGroupEntry>
*/
getSecurityGroupInfo(securityGroupId: string, opts?: GroupInclude): Promise<SecurityGroupEntry> {
getSecurityGroupInfo(securityGroupId: string, opts?: GsGroupInclude): Promise<SecurityGroupEntry> {
const pathParams = {
securityGroupId,
};
Expand All @@ -88,10 +76,9 @@ export class SecurityGroupsApi extends BaseApi {
* @param securityGroupId The Key of Security Group id for which info is required
* @param securityGroupBody SecurityGroupBody
* @param opts Optional parameters
* @param opts.include additional information about the security group
* @return Promise<SecurityGroupEntry>
*/
updateSecurityGroup(securityGroupId: string, securityGroupBody: SecurityGroupBody, opts?: GroupInclude): Promise<SecurityGroupEntry> {
updateSecurityGroup(securityGroupId: string, securityGroupBody: SecurityGroupBody, opts?: GsGroupInclude): Promise<SecurityGroupEntry> {
const pathParams = {
securityGroupId,
};
Expand Down
Loading

0 comments on commit 8ca4ed0

Please sign in to comment.