Skip to content

Latest commit

 

History

History
291 lines (227 loc) · 10.4 KB

File metadata and controls

291 lines (227 loc) · 10.4 KB

AttachmentsApi

All URIs are relative to http://localhost

Method HTTP request Description
apiV2AttachmentsIdDelete DELETE /api/v2/attachments/{id} Delete attachment file
apiV2AttachmentsIdGet GET /api/v2/attachments/{id} Download attachment file
apiV2AttachmentsOccupiedFileStorageSizeGet GET /api/v2/attachments/occupiedFileStorageSize Get size of attachments storage in bytes
apiV2AttachmentsPost POST /api/v2/attachments Upload new attachment file

apiV2AttachmentsIdDelete

apiV2AttachmentsIdDelete(id)

Delete attachment file

Example

// Import classes:
import io.test_gear.client.invoker.ApiClient;
import io.test_gear.client.invoker.ApiException;
import io.test_gear.client.invoker.Configuration;
import io.test_gear.client.invoker.auth.*;
import io.test_gear.client.invoker.models.*;
import io.test_gear.client.api.AttachmentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: Bearer or PrivateToken
    ApiKeyAuth Bearer or PrivateToken = (ApiKeyAuth) defaultClient.getAuthentication("Bearer or PrivateToken");
    Bearer or PrivateToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Bearer or PrivateToken.setApiKeyPrefix("Token");

    AttachmentsApi apiInstance = new AttachmentsApi(defaultClient);
    UUID id = UUID.randomUUID(); // UUID | 
    try {
      apiInstance.apiV2AttachmentsIdDelete(id);
    } catch (ApiException e) {
      System.err.println("Exception when calling AttachmentsApi#apiV2AttachmentsIdDelete");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id UUID

Return type

null (empty response body)

Authorization

[Bearer or PrivateToken](../README.md#Bearer or PrivateToken)

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
422 Attachment file is already in use -
204 Attachment file was deleted successfully -

apiV2AttachmentsIdGet

File apiV2AttachmentsIdGet(id, width, height, resizeType, backgroundColor, preview)

Download attachment file

Example

// Import classes:
import io.test_gear.client.invoker.ApiClient;
import io.test_gear.client.invoker.ApiException;
import io.test_gear.client.invoker.Configuration;
import io.test_gear.client.invoker.auth.*;
import io.test_gear.client.invoker.models.*;
import io.test_gear.client.api.AttachmentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: Bearer or PrivateToken
    ApiKeyAuth Bearer or PrivateToken = (ApiKeyAuth) defaultClient.getAuthentication("Bearer or PrivateToken");
    Bearer or PrivateToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Bearer or PrivateToken.setApiKeyPrefix("Token");

    AttachmentsApi apiInstance = new AttachmentsApi(defaultClient);
    UUID id = UUID.randomUUID(); // UUID | 
    Integer width = 56; // Integer | Width of the result image
    Integer height = 56; // Integer | Height of the result image
    ImageResizeType resizeType = ImageResizeType.fromValue("Crop"); // ImageResizeType | Type of resizing to apply to the result image
    String backgroundColor = "backgroundColor_example"; // String | Color of the background if the `resizeType` is `AddBackgroundStripes`
    Boolean preview = true; // Boolean | If image must be converted to a preview (lower quality, no animation)
    try {
      File result = apiInstance.apiV2AttachmentsIdGet(id, width, height, resizeType, backgroundColor, preview);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AttachmentsApi#apiV2AttachmentsIdGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id UUID
width Integer Width of the result image [optional]
height Integer Height of the result image [optional]
resizeType ImageResizeType Type of resizing to apply to the result image [optional] [enum: Crop, AddBackgroundStripes]
backgroundColor String Color of the background if the `resizeType` is `AddBackgroundStripes` [optional]
preview Boolean If image must be converted to a preview (lower quality, no animation) [optional]

Return type

File

Authorization

[Bearer or PrivateToken](../README.md#Bearer or PrivateToken)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

HTTP response details

Status code Description Response headers
200 Success -

apiV2AttachmentsOccupiedFileStorageSizeGet

Long apiV2AttachmentsOccupiedFileStorageSizeGet()

Get size of attachments storage in bytes

Example

// Import classes:
import io.test_gear.client.invoker.ApiClient;
import io.test_gear.client.invoker.ApiException;
import io.test_gear.client.invoker.Configuration;
import io.test_gear.client.invoker.auth.*;
import io.test_gear.client.invoker.models.*;
import io.test_gear.client.api.AttachmentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: Bearer or PrivateToken
    ApiKeyAuth Bearer or PrivateToken = (ApiKeyAuth) defaultClient.getAuthentication("Bearer or PrivateToken");
    Bearer or PrivateToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Bearer or PrivateToken.setApiKeyPrefix("Token");

    AttachmentsApi apiInstance = new AttachmentsApi(defaultClient);
    try {
      Long result = apiInstance.apiV2AttachmentsOccupiedFileStorageSizeGet();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AttachmentsApi#apiV2AttachmentsOccupiedFileStorageSizeGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

This endpoint does not need any parameter.

Return type

Long

Authorization

[Bearer or PrivateToken](../README.md#Bearer or PrivateToken)

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success -

apiV2AttachmentsPost

AttachmentModel apiV2AttachmentsPost(_file)

Upload new attachment file

File size is restricted to 50 MB (52 428 800 bytes)

Example

// Import classes:
import io.test_gear.client.invoker.ApiClient;
import io.test_gear.client.invoker.ApiException;
import io.test_gear.client.invoker.Configuration;
import io.test_gear.client.invoker.auth.*;
import io.test_gear.client.invoker.models.*;
import io.test_gear.client.api.AttachmentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: Bearer or PrivateToken
    ApiKeyAuth Bearer or PrivateToken = (ApiKeyAuth) defaultClient.getAuthentication("Bearer or PrivateToken");
    Bearer or PrivateToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Bearer or PrivateToken.setApiKeyPrefix("Token");

    AttachmentsApi apiInstance = new AttachmentsApi(defaultClient);
    File _file = new File("/path/to/file"); // File | 
    try {
      AttachmentModel result = apiInstance.apiV2AttachmentsPost(_file);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AttachmentsApi#apiV2AttachmentsPost");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
_file File [optional]

Return type

AttachmentModel

Authorization

[Bearer or PrivateToken](../README.md#Bearer or PrivateToken)

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -
403 Forbidden -
400 <br>- Invalid file contents <br>- Invalid HTTP headers -
401 Unauthorized -