Skip to content

Latest commit

 

History

History
338 lines (241 loc) · 11.9 KB

File metadata and controls

338 lines (241 loc) · 11.9 KB

testgear_api_client.AttachmentsApi

All URIs are relative to http://localhost

Method HTTP request Description
api_v2_attachments_id_delete DELETE /api/v2/attachments/{id} Delete attachment file
api_v2_attachments_id_get GET /api/v2/attachments/{id} Download attachment file
api_v2_attachments_occupied_file_storage_size_get GET /api/v2/attachments/occupiedFileStorageSize Get size of attachments storage in bytes
api_v2_attachments_post POST /api/v2/attachments Upload new attachment file

api_v2_attachments_id_delete

api_v2_attachments_id_delete(id)

Delete attachment file

Example

  • Api Key Authentication (Bearer or PrivateToken):
import time
import testgear_api_client
from testgear_api_client.api import attachments_api
from testgear_api_client.model.problem_details import ProblemDetails
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = testgear_api_client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer or PrivateToken
configuration.api_key['Bearer or PrivateToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer or PrivateToken'] = 'Bearer'

# Enter a context with an instance of the API client
with testgear_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = attachments_api.AttachmentsApi(api_client)
    id = "id_example" # str | 

    # example passing only required values which don't have defaults set
    try:
        # Delete attachment file
        api_instance.api_v2_attachments_id_delete(id)
    except testgear_api_client.ApiException as e:
        print("Exception when calling AttachmentsApi->api_v2_attachments_id_delete: %s\n" % e)

Parameters

Name Type Description Notes
id str

Return type

void (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
204 Attachment file was deleted successfully -
422 Attachment file is already in use -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

api_v2_attachments_id_get

file_type api_v2_attachments_id_get(id)

Download attachment file

Example

  • Api Key Authentication (Bearer or PrivateToken):
import time
import testgear_api_client
from testgear_api_client.api import attachments_api
from testgear_api_client.model.image_resize_type import ImageResizeType
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = testgear_api_client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer or PrivateToken
configuration.api_key['Bearer or PrivateToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer or PrivateToken'] = 'Bearer'

# Enter a context with an instance of the API client
with testgear_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = attachments_api.AttachmentsApi(api_client)
    id = "id_example" # str | 
    width = 1 # int | Width of the result image (optional)
    height = 1 # int | Height of the result image (optional)
    resize_type = None # ImageResizeType | Type of resizing to apply to the result image (optional)
    background_color = "#62ECB0" # str | Color of the background if the `resizeType` is `AddBackgroundStripes` (optional)
    preview = True # bool | If image must be converted to a preview (lower quality, no animation) (optional)

    # example passing only required values which don't have defaults set
    try:
        # Download attachment file
        api_response = api_instance.api_v2_attachments_id_get(id)
        pprint(api_response)
    except testgear_api_client.ApiException as e:
        print("Exception when calling AttachmentsApi->api_v2_attachments_id_get: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Download attachment file
        api_response = api_instance.api_v2_attachments_id_get(id, width=width, height=height, resize_type=resize_type, background_color=background_color, preview=preview)
        pprint(api_response)
    except testgear_api_client.ApiException as e:
        print("Exception when calling AttachmentsApi->api_v2_attachments_id_get: %s\n" % e)

Parameters

Name Type Description Notes
id str
width int Width of the result image [optional]
height int Height of the result image [optional]
resize_type ImageResizeType Type of resizing to apply to the result image [optional]
background_color str Color of the background if the `resizeType` is `AddBackgroundStripes` [optional]
preview bool If image must be converted to a preview (lower quality, no animation) [optional]

Return type

file_type

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

api_v2_attachments_occupied_file_storage_size_get

int api_v2_attachments_occupied_file_storage_size_get()

Get size of attachments storage in bytes

Example

  • Api Key Authentication (Bearer or PrivateToken):
import time
import testgear_api_client
from testgear_api_client.api import attachments_api
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = testgear_api_client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer or PrivateToken
configuration.api_key['Bearer or PrivateToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer or PrivateToken'] = 'Bearer'

# Enter a context with an instance of the API client
with testgear_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = attachments_api.AttachmentsApi(api_client)

    # example, this endpoint has no required or optional parameters
    try:
        # Get size of attachments storage in bytes
        api_response = api_instance.api_v2_attachments_occupied_file_storage_size_get()
        pprint(api_response)
    except testgear_api_client.ApiException as e:
        print("Exception when calling AttachmentsApi->api_v2_attachments_occupied_file_storage_size_get: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

int

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

api_v2_attachments_post

AttachmentModel api_v2_attachments_post()

Upload new attachment file

File size is restricted to 1 GB (1 073 741 824 bytes)

Example

  • Api Key Authentication (Bearer or PrivateToken):
import time
import testgear_api_client
from testgear_api_client.api import attachments_api
from testgear_api_client.model.problem_details import ProblemDetails
from testgear_api_client.model.attachment_model import AttachmentModel
from testgear_api_client.model.validation_problem_details import ValidationProblemDetails
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = testgear_api_client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer or PrivateToken
configuration.api_key['Bearer or PrivateToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer or PrivateToken'] = 'Bearer'

# Enter a context with an instance of the API client
with testgear_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = attachments_api.AttachmentsApi(api_client)
    file = open('/path/to/file', 'rb') # file_type |  (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Upload new attachment file
        api_response = api_instance.api_v2_attachments_post(file=file)
        pprint(api_response)
    except testgear_api_client.ApiException as e:
        print("Exception when calling AttachmentsApi->api_v2_attachments_post: %s\n" % e)

Parameters

Name Type Description Notes
file file_type [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 -
400 <br>- Invalid file contents <br>- Invalid HTTP headers -
401 Unauthorized -
403 Forbidden -

[Back to top] [Back to API list] [Back to Model list] [Back to README]