# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule OpenXchangeClient.Api.Calendar do
@moduledoc """
API calls for all endpoints tagged `Calendar`.
"""
alias OpenXchangeClient.Connection
import OpenXchangeClient.RequestBuilder
@doc """
Confirms an appointment.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the appointment that shall be confirmed.
- folder (String.t): Object ID of the folder who contains the appointments.
- timestamp (integer()): Timestamp of the last update of the appointment.
- body (AppointmentConfirmationBody): A JSON object with the fields `confirmation`, `confirmmessage` and optionally `id`.
- opts (KeywordList): [optional] Optional parameters
- :occurrence (integer()): The numeric identifier of the occurrence to which the confirmation applies (in case `id` denotes a series appointment).
## Returns
{:ok, OpenXchangeClient.Model.CommonResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec confirm_appointment(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
integer(),
OpenXchangeClient.Model.AppointmentConfirmationBody.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.CommonResponse.t()} | {:error, Tesla.Env.t()}
def confirm_appointment(connection, session, id, folder, timestamp, body, opts \\ []) do
optional_params = %{
:occurrence => :query
}
%{}
|> method(:put)
|> url("/calendar?action=confirm")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :folder, folder)
|> add_param(:query, :timestamp, timestamp)
|> add_param(:body, :body, body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.CommonResponse{}}
])
end
@doc """
Creates an appointment.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- body (AppointmentData): A JSON object containing the appointment's data.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentCreationResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec create_appointment(
Tesla.Env.client(),
String.t(),
OpenXchangeClient.Model.AppointmentData.t(),
keyword()
) ::
{:ok, OpenXchangeClient.Model.AppointmentCreationResponse.t()} | {:error, Tesla.Env.t()}
def create_appointment(connection, session, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/calendar?action=new")
|> add_param(:query, :session, session)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentCreationResponse{}}
])
end
@doc """
Creates an appointment.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the requested appointment.
- ignore_conflicts (boolean()): Flag indicating whether conflicts should be ignored or not.
- folder (String.t): Object ID of the folder who contains the appointments.
- timezone (String.t): The timezone which should be used
- body (InlineObject):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentCreationResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec create_appointment_0(
Tesla.Env.client(),
String.t(),
String.t(),
boolean(),
String.t(),
String.t(),
OpenXchangeClient.Model.InlineObject.t(),
keyword()
) ::
{:ok, OpenXchangeClient.Model.AppointmentCreationResponse.t()} | {:error, Tesla.Env.t()}
def create_appointment_0(
connection,
session,
id,
ignore_conflicts,
folder,
timezone,
body,
_opts \\ []
) do
%{}
|> method(:put)
|> url("/calendar?action=copy")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :ignore_conflicts, ignore_conflicts)
|> add_param(:query, :folder, folder)
|> add_param(:query, :timezone, timezone)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentCreationResponse{}}
])
end
@doc """
Deletes appointments.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- timestamp (integer()): Timestamp of the last update of the deleted appointments.
- body ([OpenXchangeClient.Model.AppointmentDeletionsElement.t]): A JSON array of JSON objects with the id, folder and optionally the recurrence position (if present in an appointment to fully identify it) of the appointments.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentDeletionsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec delete_appointment(
Tesla.Env.client(),
String.t(),
integer(),
list(OpenXchangeClient.Model.AppointmentDeletionsElement.t()),
keyword()
) ::
{:ok, OpenXchangeClient.Model.AppointmentDeletionsResponse.t()}
| {:error, Tesla.Env.t()}
def delete_appointment(connection, session, timestamp, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/calendar?action=delete")
|> add_param(:query, :session, session)
|> add_param(:query, :timestamp, timestamp)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentDeletionsResponse{}}
])
end
@doc """
Gets all appointments.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,500\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed appointment data](#detailed-appointment-data).
- start_date (integer()): Lower inclusive limit of the queried range as a Date. Only appointments which start on or after this date are returned.
- end_date (integer()): Upper exclusive limit of the queried range as a Date. Only appointments which end before this date are returned.
- opts (KeywordList): [optional] Optional parameters
- :folder (String.t): Object ID of the folder, whose contents are queried. If not specified, defaults to all calendar folders.
- :recurrence_master (boolean()): Extract the recurrence to several appointments. The default value is false so every appointment of the recurrence will be calculated.
## Returns
{:ok, OpenXchangeClient.Model.AppointmentsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_all_appointments(
Tesla.Env.client(),
String.t(),
String.t(),
integer(),
integer(),
keyword()
) :: {:ok, OpenXchangeClient.Model.AppointmentsResponse.t()} | {:error, Tesla.Env.t()}
def get_all_appointments(connection, session, columns, start_date, end_date, opts \\ []) do
optional_params = %{
:folder => :query,
:recurrence_master => :query
}
%{}
|> method(:get)
|> url("/calendar?action=all")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:query, :start, start_date)
|> add_param(:query, :end, end_date)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentsResponse{}}
])
end
@doc """
Gets an appointment.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the requested appointment.
- folder (String.t): Object ID of the folder who contains the appointments.
- opts (KeywordList): [optional] Optional parameters
- :recurrence_position (integer()): Recurrence position of requested appointment.
## Returns
{:ok, OpenXchangeClient.Model.AppointmentResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_appointment(Tesla.Env.client(), String.t(), String.t(), String.t(), keyword()) ::
{:ok, OpenXchangeClient.Model.AppointmentResponse.t()} | {:error, Tesla.Env.t()}
def get_appointment(connection, session, id, folder, opts \\ []) do
optional_params = %{
:recurrence_position => :query
}
%{}
|> method(:get)
|> url("/calendar?action=get")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :folder, folder)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentResponse{}}
])
end
@doc """
Gets a list of appointments.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,500\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed appointment data](#detailed-appointment-data).
- body ([OpenXchangeClient.Model.AppointmentListElement.t]): A JSON array of JSON objects with the id, folder and optionally either recurrence_position or recurrence_date_position of the requested appointments.
- opts (KeywordList): [optional] Optional parameters
- :recurrence_master (boolean()): Extract the recurrence to several appointments. The default value is false so every appointment of the recurrence will be calculated.
## Returns
{:ok, OpenXchangeClient.Model.AppointmentsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_appointment_list(
Tesla.Env.client(),
String.t(),
String.t(),
list(OpenXchangeClient.Model.AppointmentListElement.t()),
keyword()
) :: {:ok, OpenXchangeClient.Model.AppointmentsResponse.t()} | {:error, Tesla.Env.t()}
def get_appointment_list(connection, session, columns, body, opts \\ []) do
optional_params = %{
:recurrence_master => :query
}
%{}
|> method(:put)
|> url("/calendar?action=list")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:body, :body, body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentsResponse{}}
])
end
@doc """
Gets updated appointments.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,500\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed appointment data](#detailed-appointment-data).
- timestamp (integer()): Timestamp of the last update of the requested appointments.
- opts (KeywordList): [optional] Optional parameters
- :folder (String.t): Object ID of the folder, whose contents are queried. That parameter may be absent in case ignore is set to \"deleted\", which means all accessible calendar folders are considered. If ignore is not set to \"deleted\", that parameter is mandatory.
- :start (integer()): Lower inclusive limit of the queried range as a Date. Only appointments which end on or after this date are returned. This parameter is optional in case a certain folder is queried, but mandatory if all accessible calendar folders are supposed to be considered (folder not specified).
- :end (integer()): Upper exclusive limit of the queried range as a Date. Only appointments which start before this date are returned. This parameter is optional in case a certain folder is queried, but mandatory if all accessible calendar folders are supposed to be considered (folder not specified).
- :ignore (String.t): Which kinds of updates should be ignored. Currently, the only valid value – \"deleted\" – causes deleted object IDs not to be returned.
- :recurrence_master (boolean()): Extract the recurrence to several appointments. The default value is false so every appointment of the recurrence will be calculated.
## Returns
{:ok, OpenXchangeClient.Model.AppointmentUpdatesResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_appointment_updates(Tesla.Env.client(), String.t(), String.t(), integer(), keyword()) ::
{:ok, OpenXchangeClient.Model.AppointmentUpdatesResponse.t()} | {:error, Tesla.Env.t()}
def get_appointment_updates(connection, session, columns, timestamp, opts \\ []) do
optional_params = %{
:folder => :query,
:start => :query,
:end => :query,
:ignore => :query,
:recurrence_master => :query
}
%{}
|> method(:get)
|> url("/calendar?action=updates")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:query, :timestamp, timestamp)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentUpdatesResponse{}}
])
end
@doc """
Gets all change exceptions.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the appointment series.
- folder (String.t): Object ID of the folder who contains the appointments.
- columns (String.t): A comma-separated list of columns to return, like \"1,500\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed appointment data](#detailed-appointment-data).
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_change_exceptions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.AppointmentsResponse.t()} | {:error, Tesla.Env.t()}
def get_change_exceptions(connection, session, id, folder, columns, _opts \\ []) do
%{}
|> method(:get)
|> url("/calendar?action=getChangeExceptions")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :folder, folder)
|> add_param(:query, :columns, columns)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentsResponse{}}
])
end
@doc """
Gets appointments between a specified time range.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (integer()): Internal user id. Must be obtained from the contact module.
- start_date (integer()): Lower inclusive limit of the queried range as a Date. Only appointments which end on or after this date are returned.
- end_date (integer()): Upper exclusive limit of the queried range as a Date. Only appointments which start before this date are returned.
- type (integer()): Constant for user or resource (1 for users, 3 for resources).
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentFreeBusyResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_free_and_busy(
Tesla.Env.client(),
String.t(),
integer(),
integer(),
integer(),
integer(),
keyword()
) ::
{:ok, OpenXchangeClient.Model.AppointmentFreeBusyResponse.t()} | {:error, Tesla.Env.t()}
def get_free_and_busy(connection, session, id, start_date, end_date, type, _opts \\ []) do
%{}
|> method(:get)
|> url("/calendar?action=freebusy")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :start, start_date)
|> add_param(:query, :end, end_date)
|> add_param(:query, :type, type)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentFreeBusyResponse{}}
])
end
@doc """
Gets new appointments.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,500\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed appointment data](#detailed-appointment-data).
- start_date (integer()): Lower inclusive limit of the queried range as a Date. Only appointments which end on or after this date are returned.
- end_date (integer()): Upper exclusive limit of the queried range as a Date. Only appointments which start before this date are returned.
- limit (String.t): Limits the number of returned objects to the given value.
- opts (KeywordList): [optional] Optional parameters
- :sort (String.t): The identifier of a column which determines the sort order of the response. If this parameter is specified and holds a column number, then the parameter order must be also specified.
- :order (String.t): \"asc\" if the response entires should be sorted in the ascending order, \"desc\" if the response entries should be sorted in the descending order. If this parameter is specified, then the parameter sort must be also specified.
## Returns
{:ok, OpenXchangeClient.Model.AppointmentsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_new_appointments(
Tesla.Env.client(),
String.t(),
String.t(),
integer(),
integer(),
String.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.AppointmentsResponse.t()} | {:error, Tesla.Env.t()}
def get_new_appointments(connection, session, columns, start_date, end_date, limit, opts \\ []) do
optional_params = %{
:sort => :query,
:order => :query
}
%{}
|> method(:get)
|> url("/calendar?action=newappointments")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:query, :start, start_date)
|> add_param(:query, :end, end_date)
|> add_param(:query, :limit, limit)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentsResponse{}}
])
end
@doc """
Requests whether there are appointments on days in a specified time range.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- start_date (integer()): Lower inclusive limit of the queried range as a Date. Only appointments which start on or after this date are returned.
- end_date (integer()): Upper exclusive limit of the queried range as a Date. Only appointments which end before this date are returned.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentInfoResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec has_appointments_on_days(Tesla.Env.client(), String.t(), integer(), integer(), keyword()) ::
{:ok, OpenXchangeClient.Model.AppointmentInfoResponse.t()} | {:error, Tesla.Env.t()}
def has_appointments_on_days(connection, session, start_date, end_date, _opts \\ []) do
%{}
|> method(:get)
|> url("/calendar?action=has")
|> add_param(:query, :session, session)
|> add_param(:query, :start, start_date)
|> add_param(:query, :end, end_date)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentInfoResponse{}}
])
end
@doc """
Resolves the UID to an OX object ID.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- uid (String.t): The UID that shall be resolved.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentUpdateResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec resolve_uid(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
{:ok, OpenXchangeClient.Model.AppointmentUpdateResponse.t()} | {:error, Tesla.Env.t()}
def resolve_uid(connection, session, uid, _opts \\ []) do
%{}
|> method(:get)
|> url("/calendar?action=resolveuid")
|> add_param(:query, :session, session)
|> add_param(:query, :uid, uid)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentUpdateResponse{}}
])
end
@doc """
Searches for appointments.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,500\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed appointment data](#detailed-appointment-data).
- body (AppointmentSearchBody): A JSON object containing search parameters.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec search_appointments(
Tesla.Env.client(),
String.t(),
String.t(),
OpenXchangeClient.Model.AppointmentSearchBody.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.AppointmentsResponse.t()} | {:error, Tesla.Env.t()}
def search_appointments(connection, session, columns, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/calendar?action=search")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentsResponse{}}
])
end
@doc """
Updates an appointment.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the requested appointment.
- folder (String.t): Object ID of the folder who contains the appointments.
- timestamp (integer()): Timestamp of the updated appointment. If the appointment was modified after the specified timestamp, then the update must fail.
- body (AppointmentData): A JSON object containing the appointment's data. The field `recurrence_id` is always present if it is present in the original appointment. The field `recurrence_position` is present if it is present in the original appointment and only this single appointment should be modified. The field `id` is not present because it is already included as a parameter. Other fields are present only if modified.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AppointmentUpdateResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec update_appointment(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
integer(),
OpenXchangeClient.Model.AppointmentData.t(),
keyword()
) ::
{:ok, OpenXchangeClient.Model.AppointmentUpdateResponse.t()} | {:error, Tesla.Env.t()}
def update_appointment(connection, session, id, folder, timestamp, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/calendar?action=update")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :folder, folder)
|> add_param(:query, :timestamp, timestamp)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AppointmentUpdateResponse{}}
])
end
end