# MessagesApi

All URIs are relative to *https://api.chatkitty.com*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**deleteMessage**](#deletemessage) | **DELETE** /messages/{id} | Delete a message|
|[**deleteMessages**](#deletemessages) | **DELETE** /messages | Delete messages|
|[**listMessageReadReceipts**](#listmessagereadreceipts) | **GET** /messages/{id}/read-receipts | List message read receipts|
|[**listMessages**](#listmessages) | **GET** /messages | List messages|
|[**retrieveMessage**](#retrievemessage) | **GET** /messages/{id} | Retrieve a message|
|[**updateMessage**](#updatemessage) | **PATCH** /messages/{id} | Update a message|

# **deleteMessage**
> ReplyThreadResource deleteMessage()

Deletes a message by ID

### Example

```typescript
import {
    MessagesApi,
    Configuration
} from 'chatkitty';

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

let id: number; //Message ID (default to undefined)

const { status, data } = await apiInstance.deleteMessage(
    id
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | Message ID | defaults to undefined|


### Return type

**ReplyThreadResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, application/vnd.chatkitty+json, application/vnd.chatkitty.v1+json, application/vnd.hal+json, application/hal+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**404** | Resource not found |  -  |
|**403** | Access is denied |  -  |
|**400** | Client error |  -  |
|**401** | Unauthorized: Full authentication is required to access this resource |  -  |
|**200** | OK |  -  |

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

# **deleteMessages**
> ApplicationResource deleteMessages()

Deletes all messages belonging to this application

### Example

```typescript
import {
    MessagesApi,
    Configuration
} from 'chatkitty';

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

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

### Parameters
This endpoint does not have any parameters.


### Return type

**ApplicationResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, application/vnd.chatkitty+json, application/vnd.chatkitty.v1+json, application/vnd.hal+json, application/hal+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**404** | Resource not found |  -  |
|**403** | Access is denied |  -  |
|**400** | Client error |  -  |
|**401** | Unauthorized: Full authentication is required to access this resource |  -  |
|**200** | OK |  -  |

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

# **listMessageReadReceipts**
> PagedModelMessageReadReceiptResource listMessageReadReceipts()

Returns a page of read receipts for this message

### Example

```typescript
import {
    MessagesApi,
    Configuration
} from 'chatkitty';

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

let id: number; // (default to undefined)
let page: number; //Zero-based page index (0..N) (optional) (default to 0)
let size: number; //The size of the page to be returned (optional) (default to 25)
let sort: Array<string>; //Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported. (optional) (default to undefined)

const { status, data } = await apiInstance.listMessageReadReceipts(
    id,
    page,
    size,
    sort
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] |  | defaults to undefined|
| **page** | [**number**] | Zero-based page index (0..N) | (optional) defaults to 0|
| **size** | [**number**] | The size of the page to be returned | (optional) defaults to 25|
| **sort** | **Array&lt;string&gt;** | Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported. | (optional) defaults to undefined|


### Return type

**PagedModelMessageReadReceiptResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, application/vnd.chatkitty+json, application/vnd.chatkitty.v1+json, application/vnd.hal+json, application/hal+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**404** | Resource not found |  -  |
|**403** | Access is denied |  -  |
|**400** | Client error |  -  |
|**401** | Unauthorized: Full authentication is required to access this resource |  -  |
|**200** | OK |  -  |

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

# **listMessages**
> CursorPagedModelMessageResource listMessages()

Returns a page of messages belonging to this application

### Example

```typescript
import {
    MessagesApi,
    Configuration
} from 'chatkitty';

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

let size: number; //The size of the page to be returned (optional) (default to undefined)
let start: number; //Start cursor value. Do not set manually. Provided by the Platform API pagination engine to fetch previous or next pages (optional) (default to undefined)
let next: number; //Next page cursor value. Do not set manually. Provided by the Platform API pagination engine to fetch subsequent pages (optional) (default to undefined)
let relation: 'SELF' | 'PREVIOUS' | 'NEXT'; //Page cursor relation. Do not set manually. Provided by the Platform API pagination engine to fetch previous or next pages (optional) (default to undefined)
let username: string; //Filters messages by a sender\'s username (optional) (default to undefined)
let query: string; //Filters text messages by text contained in the message body (optional) (default to undefined)

const { status, data } = await apiInstance.listMessages(
    size,
    start,
    next,
    relation,
    username,
    query
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **size** | [**number**] | The size of the page to be returned | (optional) defaults to undefined|
| **start** | [**number**] | Start cursor value. Do not set manually. Provided by the Platform API pagination engine to fetch previous or next pages | (optional) defaults to undefined|
| **next** | [**number**] | Next page cursor value. Do not set manually. Provided by the Platform API pagination engine to fetch subsequent pages | (optional) defaults to undefined|
| **relation** | [**&#39;SELF&#39; | &#39;PREVIOUS&#39; | &#39;NEXT&#39;**]**Array<&#39;SELF&#39; &#124; &#39;PREVIOUS&#39; &#124; &#39;NEXT&#39;>** | Page cursor relation. Do not set manually. Provided by the Platform API pagination engine to fetch previous or next pages | (optional) defaults to undefined|
| **username** | [**string**] | Filters messages by a sender\&#39;s username | (optional) defaults to undefined|
| **query** | [**string**] | Filters text messages by text contained in the message body | (optional) defaults to undefined|


### Return type

**CursorPagedModelMessageResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, application/vnd.chatkitty+json, application/vnd.chatkitty.v1+json, application/vnd.hal+json, application/hal+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**404** | Resource not found |  -  |
|**403** | Access is denied |  -  |
|**400** | Client error |  -  |
|**401** | Unauthorized: Full authentication is required to access this resource |  -  |
|**200** | OK |  -  |

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

# **retrieveMessage**
> MessageResource retrieveMessage()

Returns a message by ID

### Example

```typescript
import {
    MessagesApi,
    Configuration
} from 'chatkitty';

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

let id: number; //Message ID (default to undefined)

const { status, data } = await apiInstance.retrieveMessage(
    id
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | Message ID | defaults to undefined|


### Return type

**MessageResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, application/vnd.chatkitty+json, application/vnd.chatkitty.v1+json, application/vnd.hal+json, application/hal+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**404** | Resource not found |  -  |
|**403** | Access is denied |  -  |
|**400** | Client error |  -  |
|**401** | Unauthorized: Full authentication is required to access this resource |  -  |
|**200** | OK |  -  |

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

# **updateMessage**
> MessageResource updateMessage()

Updates a message properties

### Example

```typescript
import {
    MessagesApi,
    Configuration
} from 'chatkitty';

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

let id: number; //Message ID (default to undefined)
let body: object; // (optional)

const { status, data } = await apiInstance.updateMessage(
    id,
    body
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **body** | **object**|  | |
| **id** | [**number**] | Message ID | defaults to undefined|


### Return type

**MessageResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json+merge-patch
 - **Accept**: application/json, application/vnd.chatkitty+json, application/vnd.chatkitty.v1+json, application/vnd.hal+json, application/hal+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**404** | Resource not found |  -  |
|**403** | Access is denied |  -  |
|**400** | Client error |  -  |
|**401** | Unauthorized: Full authentication is required to access this resource |  -  |
|**200** | OK |  -  |

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

