# Cyclos411Api.FilesApi

All URIs are relative to *https://138.197.145.149:8080/cyclos/eCloudAtm/api*

Method | HTTP request | Description
------------- | ------------- | -------------
[**deleteRawFile**](FilesApi.md#deleteRawFile) | **DELETE** /files/{id} | Removes a file by id
[**getRawFileContent**](FilesApi.md#getRawFileContent) | **GET** /files/{id}/content | Returns the content of a raw file (temp or custom field value)
[**listTempFiles**](FilesApi.md#listTempFiles) | **GET** /files/temp | Lists temporary files related to the currently authenticated user or guest 
[**uploadTempFile**](FilesApi.md#uploadTempFile) | **POST** /files/temp | Adds a new temporary file for the currently authenticated user or guest. 
[**viewRawFile**](FilesApi.md#viewRawFile) | **GET** /files/{id} | Returns a file details by id


<a name="deleteRawFile"></a>
# **deleteRawFile**
> deleteRawFile(id)

Removes a file by id

Removes the file with id

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.FilesApi();

var id = "id_example"; // String | The object identification


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deleteRawFile(id, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **String**| The object identification | 

### Return type

null (empty response body)

### Authorization

No authorization required

### HTTP request headers

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

<a name="getRawFileContent"></a>
# **getRawFileContent**
> File getRawFileContent(id)

Returns the content of a raw file (temp or custom field value)

Returns the content of either a temporary or a custom field value file 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.FilesApi();

var id = "id_example"; // String | The file identifier


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getRawFileContent(id, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **String**| The file identifier | 

### Return type

**File**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, text/plain, text/html, text/css, text/yaml, text/javascript, text/csv, image/jpeg, image/gif, image/png, application/pdf, application/zip, image/svg+xml, application/octet-stream

<a name="listTempFiles"></a>
# **listTempFiles**
> [StoredFile] listTempFiles(opts)

Lists temporary files related to the currently authenticated user or guest 

Returns all uploaded temporary files by the current user, or guest key. If the current request is as guest and no guest key is given, the IP address is used to match files. Using a key is recommended, because clients that move between WiFi and mobile connection or if the client is in a network with multiple outbound IP addresses, files won&#39;t be correctly matched without a key.  

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.FilesApi();

var opts = { 
  'fields': ["fields_example"], // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
  'guestKey': "guestKey_example", // String | This parameter is only taken into account if the current request is running as guest. It is the key passed by the client when uploading files. If no key is given, files are matched by remote address.  
  'customField': "customField_example", // String | If the temp file will be used as the value of a custom field of type file then the corresponding custom field must be given (id or internal name). Otherwise this paremeter will be ignored.  
  'customFieldKind': "customFieldKind_example" // String | If a custom field is given then its kind must be given too to allow find it. Possible values are: * contact: Contact fields. * contactInfo: Additional contact information fields. * custom_operation: Custom operation fields. * document: Document fields. * marketplace: Advertisements field. * record: Record fields. * transaction: Transaction fields. * user: User profile fields. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listTempFiles(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 
 **guestKey** | **String**| This parameter is only taken into account if the current request is running as guest. It is the key passed by the client when uploading files. If no key is given, files are matched by remote address.   | [optional] 
 **customField** | **String**| If the temp file will be used as the value of a custom field of type file then the corresponding custom field must be given (id or internal name). Otherwise this paremeter will be ignored.   | [optional] 
 **customFieldKind** | **String**| If a custom field is given then its kind must be given too to allow find it. Possible values are: * contact: Contact fields. * contactInfo: Additional contact information fields. * custom_operation: Custom operation fields. * document: Document fields. * marketplace: Advertisements field. * record: Record fields. * transaction: Transaction fields. * user: User profile fields.  | [optional] 

### Return type

[**[StoredFile]**](StoredFile.md)

### Authorization

No authorization required

### HTTP request headers

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

<a name="uploadTempFile"></a>
# **uploadTempFile**
> &#39;String&#39; uploadTempFile(file, opts)

Adds a new temporary file for the currently authenticated user or guest. 

Uploads a new temporary file. The returned id can later be used as value of a custom field of type file. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.FilesApi();

var file = "/path/to/file.txt"; // File | The file being uploaded

var opts = { 
  'name': "name_example", // String | The name for the new file. If not informed will fall back to the original file name in the form data 
  'guestKey': "guestKey_example", // String | This parameter is only taken into account if the current request is running as guest. It should be a reasonably unique key (for example, an UUID, device identifier or a reasonably large random string) which uniquely identifies the uploaded file as belonging to this \"session\". If no key is given, files uploaded as guest are matched by IP address. Using a key is recommended, because clients that move between WiFi and mobile connection or if the client is in a network with multiple outbound IP addresses, files won't be correctly matched without a key.   
  'customField': "customField_example", // String | If the temp file will be used as the value of a custom field of type file then the corresponding custom field must be given (id or internal name). Otherwise this paremeter will be ignored.  
  'customFieldKind': "customFieldKind_example" // String | If a custom field is given then its kind must be given too to allow find it. Possible values are: * contact: Contact fields. * contactInfo: Additional contact information fields. * custom_operation: Custom operation fields. * document: Document fields. * marketplace: Advertisements field. * record: Record fields. * transaction: Transaction fields. * user: User profile fields. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.uploadTempFile(file, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **file** | **File**| The file being uploaded | 
 **name** | **String**| The name for the new file. If not informed will fall back to the original file name in the form data  | [optional] 
 **guestKey** | **String**| This parameter is only taken into account if the current request is running as guest. It should be a reasonably unique key (for example, an UUID, device identifier or a reasonably large random string) which uniquely identifies the uploaded file as belonging to this \&quot;session\&quot;. If no key is given, files uploaded as guest are matched by IP address. Using a key is recommended, because clients that move between WiFi and mobile connection or if the client is in a network with multiple outbound IP addresses, files won&#39;t be correctly matched without a key.    | [optional] 
 **customField** | **String**| If the temp file will be used as the value of a custom field of type file then the corresponding custom field must be given (id or internal name). Otherwise this paremeter will be ignored.   | [optional] 
 **customFieldKind** | **String**| If a custom field is given then its kind must be given too to allow find it. Possible values are: * contact: Contact fields. * contactInfo: Additional contact information fields. * custom_operation: Custom operation fields. * document: Document fields. * marketplace: Advertisements field. * record: Record fields. * transaction: Transaction fields. * user: User profile fields.  | [optional] 

### Return type

**&#39;String&#39;**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: multipart/form-data
 - **Accept**: application/json, text/plain

<a name="viewRawFile"></a>
# **viewRawFile**
> StoredFile viewRawFile(id, opts)

Returns a file details by id

Returns metadata about a file given its id

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.FilesApi();

var id = "id_example"; // String | The object identification

var opts = { 
  'fields': ["fields_example"] // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.viewRawFile(id, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **String**| The object identification | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 

### Return type

[**StoredFile**](StoredFile.md)

### Authorization

No authorization required

### HTTP request headers

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

