# Concatenated Connector Functions API

## Concatenated connector functions JS API guide

This file provides methods to build concatenated function executions. These methods belong to `cf` global object.

### JS API

#### cf.response(responseFunctionCriteria, responsePayload)

Sets a call for a RESPONSE connector function, if there is one that matches the south criteria indicated in `responseFunctionCriteria`, setting its input payload to the value of `responsePayload`.

**Kind**: global function  
**Returns**: Void

| Param                    | Type   | Description                                                                                                                                                                                                          |
| ------------------------ |--------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| responseFunctionCriteria | string | The south criteria that will be used to find a RESPONSE connector function.                                                                                                                                          |
| responsePayload          | any    | It can be a String or a JSON object. In case it is null or not provided, the current connector function response object will be used instead. It is the in payload for the concatenated RESPONSE connector function. |

Example of use:
```javascript
var resp = {
    'result': {
        'code': 'SUCCESSFUL',
        'description': 'Operation finished successful'
    },
    'data': {}
};

cf.response('snmps://1.0.1.4.5.123456.1.7', resp);
```

#### cf.collection(collectionFunctionCriteria, collectionPayload)

Sets a call for a COLLECTION connector function, if there is one that matches the south criteria indicated in `collectionFunctionCriteria`, setting its input payload to the value of `collectionPayload`.

**Kind**: global function  
**Returns**: Void

| Param                      | Type   | Description                                                                                                                                                                                                            |
| -------------------------- |--------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| collectionFunctionCriteria | string | The south criteria that will be used to find a COLLECTION connector function.                                                                                                                                          |
| collectionPayload          | any    | It can be a String or a JSON object. In case it is null or not provided, the current connector function response object will be used instead. It is the in payload for the concatenated COLLECTION connector function. |

Example of use:
```javascript
var colMsg = {
    '1.0.1.4.5.123456.1.7.1': 'device name',
    '1.0.1.4.5.123456.1.7.2': 'device description',
};

cf.collection('snmps://1.0.1.4.5.123456.1.7', colMsg);
```