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

Commit 8ca4ed0

Browse files
authored
[ACS-5839] GS Api enhancements and typings(#1649)
1 parent 0e9673d commit 8ca4ed0

9 files changed

+124
-139
lines changed

src/api/gs-classification-rest-api/api/authorityClearance.api.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
AuthorityClearanceGroupPaging,
2121
NodeSecurityMarkBody, SecurityMarkEntry, SecurityMarkPaging
2222
} from '../model';
23+
import { GsPagingQuery } from './types';
2324

2425
/**
2526
* AuthorityClearanceApi service.
@@ -30,11 +31,9 @@ export class AuthorityClearanceApi extends BaseApi {
3031
* Get the authority clearances for a single user/group
3132
* @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
3233
* @param opts
33-
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
34-
* @param opts.maxItems The maximum number of items to return in the list.
3534
* @return Promise<AuthorityClearanceGroupPaging>
3635
*/
37-
getAuthorityClearanceForAuthority(authorityId: string, opts?: { skipCount?: number; maxItems?: number }): Promise<AuthorityClearanceGroupPaging> {
36+
getAuthorityClearanceForAuthority(authorityId: string, opts?: GsPagingQuery): Promise<AuthorityClearanceGroupPaging> {
3837
const pathParams = {
3938
authorityId
4039
};

src/api/gs-classification-rest-api/api/classificationGuides.api.ts

+24-34
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { TopicPaging } from '../model/topicPaging';
2626
import { BaseApi } from './base.api';
2727
import { buildCollectionParam } from '../../../alfrescoApiClient';
2828
import { throwIfNotDefined } from '../../../assert';
29+
import { GsPagingQuery } from './types';
2930

3031
export interface CombinedInstructionsOpts {
3132
instructions?: any;
@@ -90,14 +91,12 @@ export class ClassificationGuidesApi extends BaseApi {
9091
throwIfNotDefined(topicId, 'topicId');
9192
throwIfNotDefined(topic, 'topic');
9293

93-
opts = opts || {};
94-
9594
const pathParams = {
9695
topicId
9796
};
9897

9998
const queryParams = {
100-
'include': buildCollectionParam(opts['include'], 'csv')
99+
include: buildCollectionParam(opts?.include, 'csv')
101100
};
102101

103102
return this.post({
@@ -162,13 +161,10 @@ export class ClassificationGuidesApi extends BaseApi {
162161
classificationGuideId
163162
};
164163

165-
const contentTypes = ['application/json'];
166-
const accepts = ['application/json'];
167-
168-
return this.apiClient.callApi(
169-
'/classification-guides/{classificationGuideId}', 'DELETE',
170-
pathParams, {}, {}, {}, null,
171-
contentTypes, accepts);
164+
return this.delete({
165+
path: '/classification-guides/{classificationGuideId}',
166+
pathParams
167+
});
172168
}
173169

174170
/**
@@ -186,19 +182,15 @@ export class ClassificationGuidesApi extends BaseApi {
186182
topicId
187183
};
188184

189-
const contentTypes = ['application/json'];
190-
const accepts = ['application/json'];
191-
192-
return this.apiClient.callApi(
193-
'/topics/{topicId}', 'DELETE',
194-
pathParams, {}, {}, {}, null,
195-
contentTypes, accepts);
185+
return this.delete({
186+
path: '/topics/{topicId}',
187+
pathParams
188+
});
196189
}
190+
197191
/**
198192
* List all classification guides
199193
*
200-
* Gets all classification guides.
201-
*
202194
* @param opts Optional parameters
203195
* @param opts.include Returns additional information about the guide. The following optional fields can be requested:
204196
* hasTopics - A flag indicating whether the guide already contains any topics.
@@ -218,15 +210,15 @@ export class ClassificationGuidesApi extends BaseApi {
218210
219211
* @return Promise<ClassificationGuidePaging>
220212
*/
221-
listClassificationGuides(opts?: { include?: string[]; skipCount?: number; maxItems?: number; orderBy?: string[]; where?: string }): Promise<ClassificationGuidePaging> {
213+
listClassificationGuides(opts?: { include?: string[]; orderBy?: string[]; where?: string } & GsPagingQuery): Promise<ClassificationGuidePaging> {
222214
opts = opts || {};
223215

224216
const queryParams = {
225-
'include': buildCollectionParam(opts['include'], 'csv'),
226-
'skipCount': opts['skipCount'],
227-
'maxItems': opts['maxItems'],
228-
'orderBy': buildCollectionParam(opts['orderBy'], 'csv'),
229-
'where': opts['where']
217+
include: buildCollectionParam(opts?.include, 'csv'),
218+
skipCount: opts?.skipCount,
219+
maxItems: opts?.maxItems,
220+
orderBy: buildCollectionParam(opts?.orderBy, 'csv'),
221+
where: opts?.where
230222
};
231223

232224
return this.get({
@@ -268,12 +260,10 @@ export class ClassificationGuidesApi extends BaseApi {
268260
*/
269261
listSubtopics(topicId: string, opts?: {
270262
include?: string[];
271-
skipCount?: number;
272-
maxItems?: number;
273263
orderBy?: string[];
274264
where?: string;
275265
includeSource?: boolean;
276-
}): Promise<SubtopicPaging> {
266+
} & GsPagingQuery): Promise<SubtopicPaging> {
277267
throwIfNotDefined(topicId, 'topicId');
278268
opts = opts || {};
279269

@@ -282,12 +272,12 @@ export class ClassificationGuidesApi extends BaseApi {
282272
};
283273

284274
const queryParams = {
285-
'include': buildCollectionParam(opts['include'], 'csv'),
286-
'skipCount': opts['skipCount'],
287-
'maxItems': opts['maxItems'],
288-
'orderBy': buildCollectionParam(opts['orderBy'], 'csv'),
289-
'where': opts['where'],
290-
'includeSource': opts['includeSource']
275+
include: buildCollectionParam(opts?.include, 'csv'),
276+
skipCount: opts?.skipCount,
277+
maxItems: opts?.maxItems,
278+
orderBy: buildCollectionParam(opts?.orderBy, 'csv'),
279+
where: opts?.where,
280+
includeSource: opts?.includeSource
291281
};
292282

293283
return this.get({

src/api/gs-classification-rest-api/api/classificationReasons.api.ts

+16-33
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import { ClassificationReasonsPaging } from '../model/classificationReasonsPagin
2121
import { BaseApi } from './base.api';
2222
import { buildCollectionParam } from '../../../alfrescoApiClient';
2323
import { throwIfNotDefined } from '../../../assert';
24+
import { GsFieldsQuery, GsPagingQuery } from './types';
2425

2526
/**
26-
* Classificationreasons service.
27+
* ClassificationReasonsApi service.
2728
* @module ClassificationReasonsApi
2829
*/
2930
export class ClassificationReasonsApi extends BaseApi {
@@ -101,43 +102,25 @@ JSON
101102
classificationReasonId
102103
};
103104

104-
const contentTypes = ['application/json'];
105-
const accepts = ['application/json'];
106-
107-
return this.apiClient.callApi(
108-
'/classification-reasons/{classificationReasonId}', 'DELETE',
109-
pathParams, {}, {}, {}, null,
110-
contentTypes, accepts);
105+
return this.delete({
106+
path: '/classification-reasons/{classificationReasonId}',
107+
pathParams
108+
});
111109
}
112-
/**
113-
* List all classification reasons
114-
*
115-
* Gets all classification reasons.
116-
*
117-
* @param opts Optional parameters
118-
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
119-
* @param opts.maxItems The maximum number of items to return in the list.
120-
* @param opts.fields A list of field names.
121-
122-
You can use this parameter to restrict the fields
123-
returned within a response if, for example, you want to save on overall bandwidth.
124110

125-
The list applies to a returned individual
126-
entity or entries within a collection.
127-
128-
If the API method also supports the **include**
129-
parameter, then the fields specified in the **include**
130-
parameter are returned in addition to those specified in the **fields** parameter.
131-
132-
* @return Promise<ClassificationReasonsPaging>
133-
*/
134-
listClassificationReasons(opts?: { skipCount?: number; maxItems?: number; fields?: string[] }): Promise<ClassificationReasonsPaging> {
111+
/**
112+
* List all classification reasons
113+
*
114+
* @param opts Optional parameters
115+
* @return Promise<ClassificationReasonsPaging>
116+
*/
117+
listClassificationReasons(opts?: GsPagingQuery & GsFieldsQuery): Promise<ClassificationReasonsPaging> {
135118
opts = opts || {};
136119

137120
const queryParams = {
138-
'skipCount': opts['skipCount'],
139-
'maxItems': opts['maxItems'],
140-
'fields': buildCollectionParam(opts['fields'], 'csv')
121+
skipCount: opts?.skipCount,
122+
maxItems: opts?.maxItems,
123+
fields: buildCollectionParam(opts?.fields, 'csv')
141124
};
142125

143126
return this.get({

src/api/gs-classification-rest-api/api/declassificationExemptions.api.ts

+15-19
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { DeclassificationExemptionEntry } from '../model/declassificationExempti
2020
import { DeclassificationExemptionsPaging } from '../model/declassificationExemptionsPaging';
2121
import { BaseApi } from './base.api';
2222
import { throwIfNotDefined } from '../../../assert';
23+
import { GsPagingQuery } from './types';
2324

2425
/**
2526
* DeclassificationExemptionsApi service.
@@ -85,40 +86,35 @@ JSON
8586
returnType: DeclassificationExemptionEntry
8687
});
8788
}
89+
8890
/**
89-
* Delete a declassification exemption
90-
*
91-
* Deletes the declassification exemption with id **declassificationExemptionId**. You can't delete a classification exemption that is being used to classify content.
92-
*
93-
* @param declassificationExemptionId The identifier for the declassification exemption
94-
* @return Promise<{}>
95-
*/
91+
* Delete a declassification exemption
92+
*
93+
* Deletes the declassification exemption with id **declassificationExemptionId**.
94+
* You can't delete a classification exemption that is being used to classify content.
95+
*
96+
* @param declassificationExemptionId The identifier for the declassification exemption
97+
* @return Promise<{}>
98+
*/
9699
deleteDeclassificationExemption(declassificationExemptionId: string): Promise<any> {
97100
throwIfNotDefined(declassificationExemptionId, 'declassificationExemptionId');
98101

99102
const pathParams = {
100103
declassificationExemptionId
101104
};
102105

103-
const contentTypes = ['application/json'];
104-
const accepts = ['application/json'];
105-
106-
return this.apiClient.callApi(
107-
'/declassification-exemptions/{declassificationExemptionId}', 'DELETE',
108-
pathParams, {}, {}, {}, null,
109-
contentTypes, accepts);
106+
return this.delete({
107+
path: '/declassification-exemptions/{declassificationExemptionId}',
108+
pathParams
109+
});
110110
}
111111
/**
112112
* List all declassification exemptions
113113
*
114-
* Gets all declassification exemptions.
115-
*
116114
* @param opts Optional parameters
117-
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
118-
* @param opts.maxItems The maximum number of items to return in the list.
119115
* @return Promise<DeclassificationExemptionsPaging>
120116
*/
121-
listDeclassificationExemptions(opts?: { skipCount?: number; maxItems?: number; }): Promise<DeclassificationExemptionsPaging> {
117+
listDeclassificationExemptions(opts?: GsPagingQuery): Promise<DeclassificationExemptionsPaging> {
122118
return this.get({
123119
path: '/declassification-exemptions',
124120
queryParams: opts,

src/api/gs-classification-rest-api/api/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
export * from './types';
1819
export * from './classificationGuides.api';
1920
export * from './classificationReasons.api';
2021
export * from './declassificationExemptions.api';

src/api/gs-classification-rest-api/api/nodeSecurityMarks.api.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { BaseApi } from './base.api';
1919
import { throwIfNotDefined } from '../../../assert';
2020
import { NodeSecurityMarkBody } from '../model/nodeSecurityMarkBody';
2121
import { SecurityMarkPaging } from '../model/securityMarkPaging';
22+
import { GsPagingQuery } from './types';
2223

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

5959
const pathParams = {

src/api/gs-classification-rest-api/api/securityGroups.api.ts

+5-18
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ import { BaseApi } from './base.api';
1919
import { SecurityGroupPaging } from '../model/securityGroupPaging';
2020
import { SecurityGroupBody } from '../model/securityGroupBody';
2121
import { SecurityGroupEntry } from '../model/securityGroupEntry';
22-
23-
export type GroupInclude = {
24-
/**
25-
* Returns additional information about the security group. The following optional fields can be requested:
26-
* - inUse - A flag indicating whether the security group is in use or not.
27-
*/
28-
include?: string;
29-
}
22+
import { GsGroupInclude, GsPagingQuery } from './types';
3023

3124
/**
3225
* SecurityGroupsApi service.
@@ -36,12 +29,9 @@ export class SecurityGroupsApi extends BaseApi {
3629
/**
3730
* Get All security groups
3831
* @param opts Optional parameters
39-
* @param opts.include Additional information about the security group
40-
* @param opts.skipCount The number of entities that exist in the collection before those included in this list.
41-
* @param opts.maxItems The maximum number of items to return in the list.
4232
* @return Promise<SecurityGroupPaging>
4333
*/
44-
getSecurityGroups(opts?: { skipCount?: number; maxItems?: number; } & GroupInclude): Promise<SecurityGroupPaging> {
34+
getSecurityGroups(opts?: GsPagingQuery & GsGroupInclude): Promise<SecurityGroupPaging> {
4535
return this.get({
4636
path: '/security-groups',
4737
queryParams: opts,
@@ -53,10 +43,9 @@ export class SecurityGroupsApi extends BaseApi {
5343
* Create security group
5444
* @param securityGroupBody securityGroupBody.
5545
* @param opts Optional parameters
56-
* @param opts.include additional information about the security group
5746
* @return Promise<SecurityGroupEntry>
5847
*/
59-
createSecurityGroup(securityGroupBody: SecurityGroupBody, opts?: GroupInclude): Promise<SecurityGroupEntry> {
48+
createSecurityGroup(securityGroupBody: SecurityGroupBody, opts?: GsGroupInclude): Promise<SecurityGroupEntry> {
6049
return this.post({
6150
path: '/security-groups',
6251
queryParams: opts,
@@ -68,10 +57,9 @@ export class SecurityGroupsApi extends BaseApi {
6857
* Get a security groups information
6958
* @param securityGroupId The Key of Security Group id for which info is required
7059
* @param opts Optional parameters
71-
* @param opts.include additional information about the security group
7260
* @return Promise<SecurityGroupEntry>
7361
*/
74-
getSecurityGroupInfo(securityGroupId: string, opts?: GroupInclude): Promise<SecurityGroupEntry> {
62+
getSecurityGroupInfo(securityGroupId: string, opts?: GsGroupInclude): Promise<SecurityGroupEntry> {
7563
const pathParams = {
7664
securityGroupId,
7765
};
@@ -88,10 +76,9 @@ export class SecurityGroupsApi extends BaseApi {
8876
* @param securityGroupId The Key of Security Group id for which info is required
8977
* @param securityGroupBody SecurityGroupBody
9078
* @param opts Optional parameters
91-
* @param opts.include additional information about the security group
9279
* @return Promise<SecurityGroupEntry>
9380
*/
94-
updateSecurityGroup(securityGroupId: string, securityGroupBody: SecurityGroupBody, opts?: GroupInclude): Promise<SecurityGroupEntry> {
81+
updateSecurityGroup(securityGroupId: string, securityGroupBody: SecurityGroupBody, opts?: GsGroupInclude): Promise<SecurityGroupEntry> {
9582
const pathParams = {
9683
securityGroupId,
9784
};

0 commit comments

Comments
 (0)