# CommentsApi

All URIs are relative to *http://localhost:8889/api*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**createComment**](#createcomment) | **POST** /comments | Create a new comment for an entity.|
|[**getComments**](#getcomments) | **GET** /comments | Get comments for an entity|

# **createComment**
> Comment createComment(comment)


### Example

```typescript
import {
    CommentsApi,
    Configuration,
    Comment
} from './api';

const configuration = new Configuration();
const apiInstance = new CommentsApi(configuration);

let comment: Comment; //The comment to be created, which contains the message, the key, and entity type: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`.
let idempotencyKey: string; //Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. (optional) (default to undefined)

const { status, data } = await apiInstance.createComment(
    comment,
    idempotencyKey
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **comment** | **Comment**| The comment to be created, which contains the message, the key, and entity type: &#x60;CLIENT&#x60;, &#x60;GROUP&#x60;, &#x60;LOAN_ACCOUNT&#x60;, &#x60;DEPOSIT_ACCOUNT&#x60;, &#x60;BRANCH&#x60;, &#x60;CENTRE&#x60;, &#x60;USER&#x60;, &#x60;LOAN_PRODUCT&#x60;, or &#x60;SAVINGS_PRODUCT&#x60;. | |
| **idempotencyKey** | [**string**] | Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. | (optional) defaults to undefined|


### Return type

**Comment**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**102** | Your idempotent request was already submitted and is currently being processed, try again later. |  -  |
|**201** | The comment has been created. |  -  |
|**400** | A validation error occurred |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getComments**
> Array<Comment> getComments()


### Example

```typescript
import {
    CommentsApi,
    Configuration
} from './api';

const configuration = new Configuration();
const apiInstance = new CommentsApi(configuration);

let ownerType: 'CLIENT' | 'GROUP' | 'LOAN_PRODUCT' | 'SAVINGS_PRODUCT' | 'CENTRE' | 'BRANCH' | 'USER' | 'LOAN_ACCOUNT' | 'DEPOSIT_ACCOUNT' | 'ID_DOCUMENT' | 'LINE_OF_CREDIT' | 'GL_JOURNAL_ENTRY'; //The type of the entity that owns the comment: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. (default to undefined)
let ownerKey: string; //The ID or key of the entity that owns the comment. (default to undefined)
let offset: number; //Pagination, index to start searching at when retrieving elements, used in combination with limit to paginate results (optional) (default to undefined)
let limit: number; //Pagination, the number of elements to retrieve, used in combination with offset to paginate results (optional) (default to undefined)
let paginationDetails: 'ON' | 'OFF'; //Flag specifying whether the pagination  details should be provided in response headers. Please note that by default it is disabled (OFF), in order to improve the performance of the APIs (optional) (default to 'OFF')

const { status, data } = await apiInstance.getComments(
    ownerType,
    ownerKey,
    offset,
    limit,
    paginationDetails
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **ownerType** | [**&#39;CLIENT&#39; | &#39;GROUP&#39; | &#39;LOAN_PRODUCT&#39; | &#39;SAVINGS_PRODUCT&#39; | &#39;CENTRE&#39; | &#39;BRANCH&#39; | &#39;USER&#39; | &#39;LOAN_ACCOUNT&#39; | &#39;DEPOSIT_ACCOUNT&#39; | &#39;ID_DOCUMENT&#39; | &#39;LINE_OF_CREDIT&#39; | &#39;GL_JOURNAL_ENTRY&#39;**]**Array<&#39;CLIENT&#39; &#124; &#39;GROUP&#39; &#124; &#39;LOAN_PRODUCT&#39; &#124; &#39;SAVINGS_PRODUCT&#39; &#124; &#39;CENTRE&#39; &#124; &#39;BRANCH&#39; &#124; &#39;USER&#39; &#124; &#39;LOAN_ACCOUNT&#39; &#124; &#39;DEPOSIT_ACCOUNT&#39; &#124; &#39;ID_DOCUMENT&#39; &#124; &#39;LINE_OF_CREDIT&#39; &#124; &#39;GL_JOURNAL_ENTRY&#39;>** | The type of the entity that owns the comment: &#x60;CLIENT&#x60;, &#x60;GROUP&#x60;, &#x60;LOAN_ACCOUNT&#x60;, &#x60;DEPOSIT_ACCOUNT&#x60;, &#x60;BRANCH&#x60;, &#x60;CENTRE&#x60;, &#x60;USER&#x60;, &#x60;LOAN_PRODUCT&#x60;, or &#x60;SAVINGS_PRODUCT&#x60;. | defaults to undefined|
| **ownerKey** | [**string**] | The ID or key of the entity that owns the comment. | defaults to undefined|
| **offset** | [**number**] | Pagination, index to start searching at when retrieving elements, used in combination with limit to paginate results | (optional) defaults to undefined|
| **limit** | [**number**] | Pagination, the number of elements to retrieve, used in combination with offset to paginate results | (optional) defaults to undefined|
| **paginationDetails** | [**&#39;ON&#39; | &#39;OFF&#39;**]**Array<&#39;ON&#39; &#124; &#39;OFF&#39;>** | Flag specifying whether the pagination  details should be provided in response headers. Please note that by default it is disabled (OFF), in order to improve the performance of the APIs | (optional) defaults to 'OFF'|


### Return type

**Array<Comment>**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Comments have been returned. |  * Items-Limit - Pagination details, the requested page size <br>  * Items-Offset - Pagination details, the index of the first returned item <br>  * Items-Total - Pagination details, the total available items <br>  |
|**400** | A validation error occurred |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | The entity that owns the comment was not found. |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

