# ServerlessFunctionsApi

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

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**create5**](#create5) | **POST** /api/v2/apps/{appUuid}/serverless-functions | Create a serverless function|
|[**delete2**](#delete2) | **DELETE** /api/v2/apps/{appUuid}/serverless-functions/{uuid} | Delete a serverless function|
|[**index2**](#index2) | **POST** /api/v2/apps/{appUuid}/serverless-functions/index | List serverless functions for an app|
|[**logs**](#logs) | **GET** /api/v2/apps/{appUuid}/serverless-functions/{uuid}/logs | Get serverless function logs|
|[**samplePayload**](#samplepayload) | **POST** /api/v2/apps/{appUuid}/serverless-functions/sample-payload | Generate a sample webhook payload|
|[**show1**](#show1) | **GET** /api/v2/apps/{appUuid}/serverless-functions/{uuid} | Get a serverless function|
|[**testServerlessFunction**](#testserverlessfunction) | **POST** /api/v2/apps/{appUuid}/serverless-functions/{uuid}/test | Test a serverless function|
|[**update2**](#update2) | **PUT** /api/v2/apps/{appUuid}/serverless-functions/{uuid} | Update a serverless function|

# **create5**
> CreateResponse create5(serverlessFunctionDTO)

Creates a new serverless function attached to the specified app.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration,
    ServerlessFunctionDTO
} from '@caraer/client';

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

let appUuid: string; //UUID of the app to attach the serverless function to (default to undefined)
let serverlessFunctionDTO: ServerlessFunctionDTO; //Serverless function payload (runtime and code)

const { status, data } = await apiInstance.create5(
    appUuid,
    serverlessFunctionDTO
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **serverlessFunctionDTO** | **ServerlessFunctionDTO**| Serverless function payload (runtime and code) | |
| **appUuid** | [**string**] | UUID of the app to attach the serverless function to | defaults to undefined|


### Return type

**CreateResponse**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Successfully created serverless function |  -  |
|**400** | Invalid request or app not installed for company |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**404** | The requested resource was not found. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **delete2**
> DeleteResponse delete2()

Tears down the GCP Cloud Function (if provisioned) and deletes the serverless function entity.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration
} from '@caraer/client';

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

let appUuid: string; //UUID of the app (default to undefined)
let uuid: string; //UUID of the serverless function to delete (default to undefined)

const { status, data } = await apiInstance.delete2(
    appUuid,
    uuid
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **appUuid** | [**string**] | UUID of the app | defaults to undefined|
| **uuid** | [**string**] | UUID of the serverless function to delete | defaults to undefined|


### Return type

**DeleteResponse**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Successfully deleted serverless function |  -  |
|**404** | Serverless function not found for this app |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **index2**
> PaginationResponseServerlessFunctionDTO index2(paginationRequest)

Retrieves a paginated list of serverless functions that belong to the specified app.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration,
    PaginationRequest
} from '@caraer/client';

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

let appUuid: string; //UUID of the app whose serverless functions to list (default to undefined)
let paginationRequest: PaginationRequest; //Pagination and filtering options for the request

const { status, data } = await apiInstance.index2(
    appUuid,
    paginationRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **paginationRequest** | **PaginationRequest**| Pagination and filtering options for the request | |
| **appUuid** | [**string**] | UUID of the app whose serverless functions to list | defaults to undefined|


### Return type

**PaginationResponseServerlessFunctionDTO**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Successfully retrieved serverless functions |  -  |
|**400** | Invalid request or app not installed for company |  -  |
|**401** | Unauthorized access |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**404** | The requested resource was not found. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **logs**
> SuccessResponseMapStringObject logs()

Queries Cloud Logging for recent log entries emitted by the Cloud Function backing this serverless function.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration
} from '@caraer/client';

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

let appUuid: string; //UUID of the app (default to undefined)
let uuid: string; //UUID of the serverless function (default to undefined)
let since: string; //Lookback window, e.g. 15m, 1h, 24h (optional) (default to '1h')
let limit: number; //Maximum number of log entries to return (optional) (default to 100)

const { status, data } = await apiInstance.logs(
    appUuid,
    uuid,
    since,
    limit
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **appUuid** | [**string**] | UUID of the app | defaults to undefined|
| **uuid** | [**string**] | UUID of the serverless function | defaults to undefined|
| **since** | [**string**] | Lookback window, e.g. 15m, 1h, 24h | (optional) defaults to '1h'|
| **limit** | [**number**] | Maximum number of log entries to return | (optional) defaults to 100|


### Return type

**SuccessResponseMapStringObject**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Successfully retrieved logs (may be empty if logging is unavailable) |  -  |
|**404** | Serverless function not found for this app |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **samplePayload**
> SuccessResponseObject samplePayload(samplePayloadRequest)

Builds the same payload shape used for serverless invocations and webhook delivery from a record and event type, without invoking anything.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration,
    SamplePayloadRequest
} from '@caraer/client';

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

let appUuid: string; //UUID of the app (default to undefined)
let samplePayloadRequest: SamplePayloadRequest; //Sample payload request (recordUuid and eventType)

const { status, data } = await apiInstance.samplePayload(
    appUuid,
    samplePayloadRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **samplePayloadRequest** | **SamplePayloadRequest**| Sample payload request (recordUuid and eventType) | |
| **appUuid** | [**string**] | UUID of the app | defaults to undefined|


### Return type

**SuccessResponseObject**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Sample payload generated |  -  |
|**400** | Invalid input provided |  -  |
|**404** | App or record not found |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **show1**
> ShowResponseServerlessFunctionDTO show1()

Retrieves a serverless function by its UUID, ensuring it belongs to the specified app.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration
} from '@caraer/client';

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

let appUuid: string; //UUID of the app (default to undefined)
let uuid: string; //UUID of the serverless function (default to undefined)

const { status, data } = await apiInstance.show1(
    appUuid,
    uuid
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **appUuid** | [**string**] | UUID of the app | defaults to undefined|
| **uuid** | [**string**] | UUID of the serverless function | defaults to undefined|


### Return type

**ShowResponseServerlessFunctionDTO**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Successfully retrieved serverless function |  -  |
|**404** | Serverless function not found for this app |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **testServerlessFunction**
> SuccessResponseMapStringObject testServerlessFunction(testServerlessFunctionRequest)

Provisions (if needed) and invokes a serverless function for a given record and event type, using the same payload shape as webhooks.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration,
    TestServerlessFunctionRequest
} from '@caraer/client';

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

let appUuid: string; //UUID of the app (default to undefined)
let uuid: string; //UUID of the serverless function to test (default to undefined)
let testServerlessFunctionRequest: TestServerlessFunctionRequest; //Test serverless function payload (recordUuid and eventType)

const { status, data } = await apiInstance.testServerlessFunction(
    appUuid,
    uuid,
    testServerlessFunctionRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **testServerlessFunctionRequest** | **TestServerlessFunctionRequest**| Test serverless function payload (recordUuid and eventType) | |
| **appUuid** | [**string**] | UUID of the app | defaults to undefined|
| **uuid** | [**string**] | UUID of the serverless function to test | defaults to undefined|


### Return type

**SuccessResponseMapStringObject**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Serverless function test executed |  -  |
|**400** | Invalid input provided |  -  |
|**404** | App, serverless function, or record not found |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**500** | An internal server error occurred. |  -  |

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

# **update2**
> ShowResponseServerlessFunctionDTO update2(serverlessFunctionDTO)

Updates an existing serverless function\'s runtime and code, keeping it attached to the same app.

### Example

```typescript
import {
    ServerlessFunctionsApi,
    Configuration,
    ServerlessFunctionDTO
} from '@caraer/client';

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

let appUuid: string; //UUID of the app (default to undefined)
let uuid: string; //UUID of the serverless function to update (default to undefined)
let serverlessFunctionDTO: ServerlessFunctionDTO; //Updated serverless function payload (runtime and code)

const { status, data } = await apiInstance.update2(
    appUuid,
    uuid,
    serverlessFunctionDTO
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **serverlessFunctionDTO** | **ServerlessFunctionDTO**| Updated serverless function payload (runtime and code) | |
| **appUuid** | [**string**] | UUID of the app | defaults to undefined|
| **uuid** | [**string**] | UUID of the serverless function to update | defaults to undefined|


### Return type

**ShowResponseServerlessFunctionDTO**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Successfully updated serverless function |  -  |
|**404** | Serverless function not found for this app |  -  |
|**401** | Authentication is required or the token is invalid. |  -  |
|**403** | The caller is missing a required role or scope. |  -  |
|**500** | An internal server error occurred. |  -  |

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

