OpenXchangeClient.Api.Snippet (open_xchange_client v0.10.1)
API calls for all endpoints tagged Snippet
.
Link to this section Summary
Functions
Attaches one or more files to an existing snippet. It can be uploaded multiple files at once. Each file must be specified in an own form field (the form field name is arbitrary).
Creates a snippet.
Deletes one or multiple snippets.
Gets all snippets.
Gets a snippet.
Gets the attachment of a snippet.
Gets a list of snippets.
Detaches one or more files from an existing snippet.
Updates a snippet.
Link to this section Functions
add_snippet_attachment(connection, session, id, type, file, opts \\ [])
@spec add_snippet_attachment( Tesla.Env.client(), String.t(), String.t(), String.t(), String.t(), keyword() ) :: {:ok, String.t()} | {:error, Tesla.Env.t()}
Attaches one or more files to an existing snippet. It can be uploaded multiple files at once. Each file must be specified in an own form field (the form field name is arbitrary).
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): The identifier of the snippet.
- type (String.t): The file type filter to define which file types are allowed during upload. Currently supported filters are: file (for all), text (for
text/*
), media (for image, audio or video), image (forimage/*
), audio (foraudio/*
), video (forvideo/*
) and application (forapplication/*
). - file (String.t): The attachment file.
- opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure
create_snippet(connection, session, body, opts \\ [])
@spec create_snippet( Tesla.Env.client(), String.t(), OpenXchangeClient.Model.SnippetData.t(), keyword() ) :: {:ok, OpenXchangeClient.Model.SnippetUpdateResponse.t()} | {:error, Tesla.Env.t()}
Creates a snippet.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- body (SnippetData): A JSON object describing the snippet excluding its attachment(s). For adding attachments see
/snippet?action=attach
request. - opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure
delete_snippet(connection, session, opts \\ [])
@spec delete_snippet(Tesla.Env.client(), String.t(), keyword()) :: {:ok, OpenXchangeClient.Model.CommonResponse.t()} | {:error, Tesla.Env.t()}
Deletes one or multiple snippets.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- opts (KeywordList): [optional] Optional parameters
- :id (String.t): The identifier of the snippet. Otherwise provide one or more identifiers in the request body's JSON array.
- :body ([String.t]): A JSON array containing the identifiers of the snippets to delete.
returns
Returns
on success {:error, Tesla.Env.t} on failure
get_all_snippets(connection, session, opts \\ [])
@spec get_all_snippets(Tesla.Env.client(), String.t(), keyword()) :: {:ok, OpenXchangeClient.Model.SnippetsResponse.t()} | {:error, Tesla.Env.t()}
Gets all snippets.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- opts (KeywordList): [optional] Optional parameters
- :type (String.t): A list of comma-separated types to filter, e.g. "signature".
returns
Returns
on success {:error, Tesla.Env.t} on failure
get_snippet(connection, session, id, opts \\ [])
@spec get_snippet(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, OpenXchangeClient.Model.SnippetResponse.t()} | {:error, Tesla.Env.t()}
Gets a snippet.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): The identifier of the snippet.
- opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure
get_snippet_attachment(connection, session, id, attachmentid, opts \\ [])
@spec get_snippet_attachment( Tesla.Env.client(), String.t(), String.t(), String.t(), keyword() ) :: {:ok, String.t()} | {:error, Tesla.Env.t()}
Gets the attachment of a snippet.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): The identifier of the snippet.
- attachmentid (String.t): The identifier of the attachment.
- opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure
get_snippet_list(connection, session, body, opts \\ [])
@spec get_snippet_list(Tesla.Env.client(), String.t(), [String.t()], keyword()) :: {:ok, OpenXchangeClient.Model.SnippetsResponse.t()} | {:error, Tesla.Env.t()}
Gets a list of snippets.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- body ([String.t]): A JSON array of snippet identifiers.
- opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure
remove_snippet_attachments(connection, session, id, body, opts \\ [])
@spec remove_snippet_attachments( Tesla.Env.client(), String.t(), String.t(), [OpenXchangeClient.Model.SnippetAttachmentListElement.t()], keyword() ) :: {:ok, OpenXchangeClient.Model.SnippetUpdateResponse.t()} | {:error, Tesla.Env.t()}
Detaches one or more files from an existing snippet.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): The identifier of the snippet.
- body ([OpenXchangeClient.Model.SnippetAttachmentListElement.t]): A JSON array with JSON objects each containing a field
id
with the identifier of an attachment that shall be removed. - opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure
update_snippet(connection, session, id, body, opts \\ [])
@spec update_snippet( Tesla.Env.client(), String.t(), String.t(), OpenXchangeClient.Model.SnippetData.t(), keyword() ) :: {:ok, OpenXchangeClient.Model.SnippetResponse.t()} | {:error, Tesla.Env.t()}
Updates a snippet.
parameters
Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): The identifier of the snippet.
- body (SnippetData): A JSON object providing the fields that should be changed, excluding its attachments. For deleting attachments see
/snippet?action=detach
request. - opts (KeywordList): [optional] Optional parameters
returns
Returns
on success {:error, Tesla.Env.t} on failure