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).

Deletes one or multiple snippets.

Detaches one or more files from an existing snippet.

Link to this section Functions

Link to this function

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 (for image/*), audio (for audio/*), video (for video/*) and application (for application/*).
  • file (String.t): The attachment file.
  • opts (KeywordList): [optional] Optional parameters

returns

Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

create_snippet(connection, session, body, opts \\ [])

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

Link to this function

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

Link to this function

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

Link to this function

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

Link to this function

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

Link to this function

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

Link to this function

remove_snippet_attachments(connection, session, id, body, opts \\ [])

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

Link to this function

update_snippet(connection, session, id, body, opts \\ [])

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