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

[ACS-5839] improved documentation and TypeScript support #1636

Merged
merged 10 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions api-codegen/src/main/resources/api-code-gen/api_doc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

All URIs are relative to *{{basePath}}*

Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{&summary}}{{/summary}}
{{/operation}}{{/operations}}
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| {{#operations}}{{#operation}}[{{operationId}}]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{&summary}}{{/summary}}
{{/operation}}{{/operations}} |

{{#operations}}
{{#operation}}
Expand All @@ -18,7 +18,7 @@ Method | HTTP request | Description

{{&notes}}{{/notes}}

### Example
**Example**

```javascript
import { AlfrescoApi, {{classname}}} from '@alfresco/js-api';
Expand All @@ -37,17 +37,17 @@ const opts = { {{#allParams}}{{^required}}

{{instanceClassname}}.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(({{#returnType}}data{{/returnType}}) => {
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
}, function(error) {
}, (error) => {
console.error(error);
});
```

### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{&paramName}}** | {{#isPrimitiveType}}**{{&dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{&dataType}}**{{/isFile}}{{^isFile}}[**{{&dataType}}**]({{&baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{&description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/allParams}}
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} |
| {{#allParams}} **{{&paramName}}** | {{#isPrimitiveType}}**{{&dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{&dataType}}**{{/isFile}}{{^isFile}}[**{{&dataType}}**]({{&baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{&description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/allParams}} |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
{{/isEnum}}{{^isEnum}}# {{classname}}

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{&datatype}}{{#isListContainer}}[]{{/isListContainer}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{&datatype}}{{#isListContainer}}[]{{/isListContainer}}**]({{complexType}}.md){{/isPrimitiveType}} | {{&description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
| Name | Type | Description | Notes |
| ------------ | ------------- | ------------- | ------------- |
| {{#vars}}{{name}} | {{#isPrimitiveType}}{{&datatype}}{{#isListContainer}}[]{{/isListContainer}}{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{&datatype}}{{#isListContainer}}[]{{/isListContainer}}**]({{complexType}}.md){{/isPrimitiveType}} | {{&description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/vars}}
{{#vars}}{{#isEnum}}
{{#vars}}{{#isEnum}} |

<a name="{{{datatypeWithEnum}}}"></a>
## Enum: {{datatypeWithEnum}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ All URIs are relative to:
{{basePath}}
```

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{classname}} | [**{{operationId}}**](docs/{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{&summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
| Class | Method | HTTP request | Description |
| ------------ | ------------- | ------------- | ------------- |
| {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{classname}} | [**{{operationId}}**](docs/{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{&summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} |

## Models

{{#models}}{{#model}}- [{{classname}}](docs/{{classname}}.md)
Expand Down
134 changes: 32 additions & 102 deletions src/api/activiti-rest-api/api/users.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,15 @@ export class UsersApi extends BaseApi {
throwIfNotDefined(userId, 'userId');
throwIfNotDefined(actionRequest, 'actionRequest');

let postBody = actionRequest;

let pathParams = {
'userId': userId
};

let queryParams = {
const pathParams = {
userId
};

let headerParams = {

};
let formParams = {
};

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

return this.apiClient.callApi(
'/api/enterprise/users/{userId}', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts);
return this.post({
path: '/api/enterprise/users/{userId}',
pathParams,
bodyParam: actionRequest
});
}
/**
* Stream user profile picture
Expand All @@ -86,28 +73,15 @@ export class UsersApi extends BaseApi {
getUser(userId: number): Promise<UserRepresentation> {
throwIfNotDefined(userId, 'userId');

let postBody = null;

let pathParams = {
'userId': userId
};

let queryParams = {
const pathParams = {
userId
};

let headerParams = {

};
let formParams = {
};

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

return this.apiClient.callApi(
'/api/enterprise/users/{userId}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, UserRepresentation);
return this.get({
path: '/api/enterprise/users/{userId}',
pathParams,
returnType: UserRepresentation
});
}
/**
* Query users
Expand All @@ -127,13 +101,8 @@ export class UsersApi extends BaseApi {
*/
getUsers(opts?: any): Promise<ResultListDataRepresentationLightUserRepresentation> {
opts = opts || {};
let postBody = null;

let pathParams = {

};

let queryParams = {
const queryParams = {
'filter': opts['filter'],
'email': opts['email'],
'externalId': opts['externalId'],
Expand All @@ -144,19 +113,11 @@ export class UsersApi extends BaseApi {
'tenantId': opts['tenantId']
};

let headerParams = {

};
let formParams = {
};

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

return this.apiClient.callApi(
'/api/enterprise/users', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, ResultListDataRepresentationLightUserRepresentation);
return this.get({
path: '/api/enterprise/users',
queryParams,
returnType: ResultListDataRepresentationLightUserRepresentation
});
}
/**
* Request a password reset
Expand All @@ -169,28 +130,10 @@ export class UsersApi extends BaseApi {
requestPasswordReset(resetPassword: ResetPasswordRepresentation): Promise<any> {
throwIfNotDefined(resetPassword, 'resetPassword');

let postBody = resetPassword;

let pathParams = {

};

let queryParams = {
};

let headerParams = {

};
let formParams = {
};

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

return this.apiClient.callApi(
'/api/enterprise/idm/passwords', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts);
return this.post({
path: '/api/enterprise/idm/passwords',
bodyParam: resetPassword
});
}
/**
* Update a user
Expand All @@ -205,28 +148,15 @@ export class UsersApi extends BaseApi {
throwIfNotDefined(userId, 'userId');
throwIfNotDefined(userRequest, 'userRequest');

let postBody = userRequest;

let pathParams = {
'userId': userId
const pathParams = {
userId
};

let queryParams = {
};

let headerParams = {

};
let formParams = {
};

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

return this.apiClient.callApi(
'/api/enterprise/users/{userId}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, UserRepresentation);
return this.put({
path: '/api/enterprise/users/{userId}',
pathParams,
bodyParam: userRequest,
returnType: UserRepresentation
});
}

}
4 changes: 2 additions & 2 deletions src/api/activiti-rest-api/model/taskRepresentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export class TaskRepresentation {
let fullName: string = '';

if (this.assignee) {
let firstName: string = this.assignee.firstName ? this.assignee.firstName : '';
let lastName: string = this.assignee.lastName ? this.assignee.lastName : '';
const firstName: string = this.assignee.firstName ? this.assignee.firstName : '';
const lastName: string = this.assignee.lastName ? this.assignee.lastName : '';
fullName = `${firstName} ${lastName}`;
}

Expand Down
Loading
Loading