# FunctionsApi

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

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**createFunctionVersion**](#createfunctionversion) | **POST** /functions/{id}/versions | Create a chat function version|
|[**listFunctionInvocations**](#listfunctioninvocations) | **GET** /functions/{id}/invocations | List chat function invocations|
|[**listFunctionVersions**](#listfunctionversions) | **GET** /functions/{id}/versions | List chat function versions|
|[**retrieveFunction**](#retrievefunction) | **GET** /functions/{id} | Retrieve a chat function|
|[**retrieveFunctionCurrentVersion**](#retrievefunctioncurrentversion) | **GET** /functions/{id}/current-version | Retrieve chat function current version|

# **createFunctionVersion**
> ChatFunctionVersionResource createFunctionVersion(createChatFunctionVersionResource)

Creates a new version of this chat function

### Example

```typescript
import {
    FunctionsApi,
    Configuration,
    CreateChatFunctionVersionResource
} from 'chatkitty';

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

let id: number; //Chat function ID (default to undefined)
let createChatFunctionVersionResource: CreateChatFunctionVersionResource; //

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

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **createChatFunctionVersionResource** | **CreateChatFunctionVersionResource**|  | |
| **id** | [**number**] | Chat function ID | defaults to undefined|


### Return type

**ChatFunctionVersionResource**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/vnd.chatkitty+json
 - **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)

# **listFunctionInvocations**
> PagedModelChatFunctionInvocationResource listFunctionInvocations()

Returns a page of invocations of this chat function. A log of previous runs of the function

### Example

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

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

let id: number; //Chat function ID (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.listFunctionInvocations(
    id,
    page,
    size,
    sort
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | Chat function ID | 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

**PagedModelChatFunctionInvocationResource**

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

# **listFunctionVersions**
> PagedModelChatFunctionVersionResource listFunctionVersions()

Returns a page of versions of this chat function

### Example

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

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

let id: number; //Chat function ID (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.listFunctionVersions(
    id,
    page,
    size,
    sort
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | Chat function ID | 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

**PagedModelChatFunctionVersionResource**

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

# **retrieveFunction**
> ChatFunctionResource retrieveFunction()

Returns a chat function by ID

### Example

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

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

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

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

### Parameters

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


### Return type

**ChatFunctionResource**

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

# **retrieveFunctionCurrentVersion**
> ChatFunctionVersionResource retrieveFunctionCurrentVersion()

Returns the version of this chat function currently deployed

### Example

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

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

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

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

### Parameters

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


### Return type

**ChatFunctionVersionResource**

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

