# ClientsApi

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

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**_delete**](#_delete) | **DELETE** /clients/{clientId} | Delete client|
|[**create**](#create) | **POST** /clients | Create client|
|[**getAll**](#getall) | **GET** /clients | Get clients|
|[**getById**](#getbyid) | **GET** /clients/{clientId} | Get client|
|[**getCreditArrangementsByClientIdOrKey**](#getcreditarrangementsbyclientidorkey) | **GET** /clients/{clientId}/creditarrangements | Credit arrangements list returned.|
|[**getRoleByClientId**](#getrolebyclientid) | **GET** /clients/{clientId}/role | Get client role for client|
|[**patch**](#patch) | **PATCH** /clients/{clientId} | Partially update client|
|[**search**](#search) | **POST** /clients:search | Search clients|
|[**update**](#update) | **PUT** /clients/{clientId} | Update client|

# **_delete**
> _delete()


### Example

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

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

let clientId: string; //The ID or encoded key of the client to be deleted. (default to undefined)

const { status, data } = await apiInstance._delete(
    clientId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **clientId** | [**string**] | The ID or encoded key of the client to be deleted. | defaults to undefined|


### Return type

void (empty response body)

### 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 |
|-------------|-------------|------------------|
|**204** | Client deleted. |  -  |
|**400** | A validation error occurred |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Client 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)

# **create**
> Client create(client)


### Example

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

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

let client: Client; //Client to be created.
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.create(
    client,
    idempotencyKey
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **client** | **Client**| Client to be created. | |
| **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

**Client**

### 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** | Client 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)

# **getAll**
> Array<Client> getAll()


### Example

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

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

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')
let detailsLevel: 'BASIC' | 'FULL'; //The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. (optional) (default to undefined)
let creditOfficerUsername: string; //The username of the credit officer to whom the entities are assigned to (optional) (default to undefined)
let branchId: string; //The id/encodedKey of the branch to which the entities are assigned to (optional) (default to undefined)
let centreId: string; //The id/encodedKey of the centre to which the entities are assigned to (optional) (default to undefined)
let firstName: string; //The first name, personal name, given name, or forename of the client. (optional) (default to undefined)
let lastName: string; //The last name, surname, or family name of the client. (optional) (default to undefined)
let idNumber: string; //The ID number of the client\'s identification document. (optional) (default to undefined)
let state: 'PENDING_APPROVAL' | 'INACTIVE' | 'ACTIVE' | 'EXITED' | 'BLACKLISTED' | 'REJECTED'; //The state of the client to search for. (optional) (default to undefined)
let birthDate: string; //The birth date of the client to search for. (optional) (default to undefined)
let sortBy: string; //The criteria based on which the records will be sorted. Expected format is <field:order>, for example, sortBy = field1:ASC,field2:DESC.<br/>Only the following fields can be used: firstName, lastName, creationDate, lastModifiedDate<br/>Default sorting is done by  creationDate:ASC (optional) (default to undefined)

const { status, data } = await apiInstance.getAll(
    offset,
    limit,
    paginationDetails,
    detailsLevel,
    creditOfficerUsername,
    branchId,
    centreId,
    firstName,
    lastName,
    idNumber,
    state,
    birthDate,
    sortBy
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **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'|
| **detailsLevel** | [**&#39;BASIC&#39; | &#39;FULL&#39;**]**Array<&#39;BASIC&#39; &#124; &#39;FULL&#39;>** | The level of details to return: &#x60;FULL&#x60; means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and &#x60;BASIC&#x60; will return only the first level elements of the object. | (optional) defaults to undefined|
| **creditOfficerUsername** | [**string**] | The username of the credit officer to whom the entities are assigned to | (optional) defaults to undefined|
| **branchId** | [**string**] | The id/encodedKey of the branch to which the entities are assigned to | (optional) defaults to undefined|
| **centreId** | [**string**] | The id/encodedKey of the centre to which the entities are assigned to | (optional) defaults to undefined|
| **firstName** | [**string**] | The first name, personal name, given name, or forename of the client. | (optional) defaults to undefined|
| **lastName** | [**string**] | The last name, surname, or family name of the client. | (optional) defaults to undefined|
| **idNumber** | [**string**] | The ID number of the client\&#39;s identification document. | (optional) defaults to undefined|
| **state** | [**&#39;PENDING_APPROVAL&#39; | &#39;INACTIVE&#39; | &#39;ACTIVE&#39; | &#39;EXITED&#39; | &#39;BLACKLISTED&#39; | &#39;REJECTED&#39;**]**Array<&#39;PENDING_APPROVAL&#39; &#124; &#39;INACTIVE&#39; &#124; &#39;ACTIVE&#39; &#124; &#39;EXITED&#39; &#124; &#39;BLACKLISTED&#39; &#124; &#39;REJECTED&#39;>** | The state of the client to search for. | (optional) defaults to undefined|
| **birthDate** | [**string**] | The birth date of the client to search for. | (optional) defaults to undefined|
| **sortBy** | [**string**] | The criteria based on which the records will be sorted. Expected format is &lt;field:order&gt;, for example, sortBy &#x3D; field1:ASC,field2:DESC.&lt;br/&gt;Only the following fields can be used: firstName, lastName, creationDate, lastModifiedDate&lt;br/&gt;Default sorting is done by  creationDate:ASC | (optional) defaults to undefined|


### Return type

**Array<Client>**

### 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** | Clients list 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 |  -  |

[[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)

# **getById**
> Client getById()


### Example

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

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

let clientId: string; //The ID or encoded key of the client to be returned. (default to undefined)
let detailsLevel: 'BASIC' | 'FULL'; //The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. (optional) (default to undefined)

const { status, data } = await apiInstance.getById(
    clientId,
    detailsLevel
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **clientId** | [**string**] | The ID or encoded key of the client to be returned. | defaults to undefined|
| **detailsLevel** | [**&#39;BASIC&#39; | &#39;FULL&#39;**]**Array<&#39;BASIC&#39; &#124; &#39;FULL&#39;>** | The level of details to return: &#x60;FULL&#x60; means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and &#x60;BASIC&#x60; will return only the first level elements of the object. | (optional) defaults to undefined|


### Return type

**Client**

### 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** | Client returned. |  -  |
|**400** | A validation error occurred |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Client 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)

# **getCreditArrangementsByClientIdOrKey**
> Array<CreditArrangement> getCreditArrangementsByClientIdOrKey()


### Example

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

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

let clientId: string; //The ID or encoded key of the client to be returned. (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')
let detailsLevel: 'BASIC' | 'FULL'; //The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. (optional) (default to undefined)

const { status, data } = await apiInstance.getCreditArrangementsByClientIdOrKey(
    clientId,
    offset,
    limit,
    paginationDetails,
    detailsLevel
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **clientId** | [**string**] | The ID or encoded key of the client to be returned. | 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'|
| **detailsLevel** | [**&#39;BASIC&#39; | &#39;FULL&#39;**]**Array<&#39;BASIC&#39; &#124; &#39;FULL&#39;>** | The level of details to return: &#x60;FULL&#x60; means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and &#x60;BASIC&#x60; will return only the first level elements of the object. | (optional) defaults to undefined|


### Return type

**Array<CreditArrangement>**

### 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** | Credit arrangements list 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** | Client 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)

# **getRoleByClientId**
> ClientRole getRoleByClientId()


### Example

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

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

let clientId: string; //The ID or encoded key of the client to be returned. (default to undefined)

const { status, data } = await apiInstance.getRoleByClientId(
    clientId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **clientId** | [**string**] | The ID or encoded key of the client to be returned. | defaults to undefined|


### Return type

**ClientRole**

### 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** | Client role returned. |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Client 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)

# **patch**
> patch(patchOperation)


### Example

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

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

let clientId: string; //The ID or encoded key of the client to be updated. (default to undefined)
let patchOperation: Array<PatchOperation>; //Patch operations to be applied to a resource.
let keepAssociationForAccounts: boolean; //The flag to allow associated accounts to maintain their branch, if client\'s changes. (optional) (default to false)

const { status, data } = await apiInstance.patch(
    clientId,
    patchOperation,
    keepAssociationForAccounts
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **patchOperation** | **Array<PatchOperation>**| Patch operations to be applied to a resource. | |
| **clientId** | [**string**] | The ID or encoded key of the client to be updated. | defaults to undefined|
| **keepAssociationForAccounts** | [**boolean**] | The flag to allow associated accounts to maintain their branch, if client\&#39;s changes. | (optional) defaults to false|


### Return type

void (empty response body)

### 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 |
|-------------|-------------|------------------|
|**204** | Client updated. |  -  |
|**400** | A validation error occurred |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Client 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)

# **search**
> Array<Client> search(clientSearchCriteria)


### Example

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

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

let clientSearchCriteria: ClientSearchCriteria; //The criteria to search clients.
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')
let detailsLevel: 'BASIC' | 'FULL'; //The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. (optional) (default to undefined)

const { status, data } = await apiInstance.search(
    clientSearchCriteria,
    offset,
    limit,
    paginationDetails,
    detailsLevel
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **clientSearchCriteria** | **ClientSearchCriteria**| The criteria to search clients. | |
| **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'|
| **detailsLevel** | [**&#39;BASIC&#39; | &#39;FULL&#39;**]**Array<&#39;BASIC&#39; &#124; &#39;FULL&#39;>** | The level of details to return: &#x60;FULL&#x60; means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and &#x60;BASIC&#x60; will return only the first level elements of the object. | (optional) defaults to undefined|


### Return type

**Array<Client>**

### 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 |
|-------------|-------------|------------------|
|**200** | Result of client search. |  * 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 |  -  |

[[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)

# **update**
> Client update(client)


### Example

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

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

let clientId: string; //The ID or encoded key of the client to be updated. (default to undefined)
let client: Client; //Client to be updated.
let keepAssociationForAccounts: boolean; //The flag to allow associated accounts to maintain their branch, if client\'s changes. (optional) (default to false)

const { status, data } = await apiInstance.update(
    clientId,
    client,
    keepAssociationForAccounts
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **client** | **Client**| Client to be updated. | |
| **clientId** | [**string**] | The ID or encoded key of the client to be updated. | defaults to undefined|
| **keepAssociationForAccounts** | [**boolean**] | The flag to allow associated accounts to maintain their branch, if client\&#39;s changes. | (optional) defaults to false|


### Return type

**Client**

### 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 |
|-------------|-------------|------------------|
|**200** | Client updated. |  -  |
|**400** | A validation error occurred |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Client 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)

