lib/spatio/api/calls.ex

# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule Spatio.Api.Calls do
  @moduledoc """
  API calls for all endpoints tagged `Calls`.
  """

  alias Spatio.Connection
  import Spatio.RequestBuilder

  @doc """
  Start a new call.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:body` (CreateCallRequest): 

  ### Returns

  - `{:ok, Spatio.Model.SpatioCall.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec create_call(Tesla.Env.client, keyword()) :: {:ok, Spatio.Model.SpatioCall.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def create_call(connection, opts \\ []) do
    optional_params = %{
      :body => :body
    }

    request =
      %{}
      |> method(:post)
      |> url("/v1/calls")
      |> add_optional_params(optional_params, opts)
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {201, Spatio.Model.SpatioCall},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Create a persistent meeting room.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `create_meeting_room_request` (CreateMeetingRoomRequest): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.MeetingRoom.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec create_meeting_room(Tesla.Env.client, Spatio.Model.CreateMeetingRoomRequest.t, keyword()) :: {:ok, Spatio.Model.MeetingRoom.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def create_meeting_room(connection, create_meeting_room_request, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/calls/rooms")
      |> add_param(:body, :body, create_meeting_room_request)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {201, Spatio.Model.MeetingRoom},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Delete a recording.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `recording_id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec delete_call_recording(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def delete_call_recording(connection, recording_id, _opts \\ []) do
    request =
      %{}
      |> method(:delete)
      |> url("/v1/calls/recordings/#{recording_id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {204, false},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  End a call (host only).

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec end_call(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def end_call(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/calls/#{id}/end")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {204, false},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Time-series bandwidth metrics.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec get_bandwidth_history(Tesla.Env.client, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def get_bandwidth_history(connection, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/calls/bandwidth/history")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Aggregate bandwidth metrics.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec get_bandwidth_summary(Tesla.Env.client, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def get_bandwidth_summary(connection, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/calls/bandwidth/summary")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Fetch a call.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.SpatioCall.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec get_call(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.SpatioCall.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def get_call(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/calls/#{id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, Spatio.Model.SpatioCall},
      {401, Spatio.Model.ApiError},
      {404, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Fetch a meeting room.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.MeetingRoom.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec get_meeting_room(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.MeetingRoom.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def get_meeting_room(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/calls/rooms/#{id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, Spatio.Model.MeetingRoom},
      {401, Spatio.Model.ApiError},
      {404, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Join a call.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec join_call(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def join_call(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/calls/#{id}/join")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Leave a call.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec leave_call(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def leave_call(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/calls/#{id}/leave")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {204, false},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  List active calls.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.CallListResponse.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec list_active_calls(Tesla.Env.client, keyword()) :: {:ok, Spatio.Model.CallListResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def list_active_calls(connection, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/calls")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, Spatio.Model.CallListResponse},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  List recordings for a call.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.CallRecordingListResponse.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec list_call_recordings(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.CallRecordingListResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def list_call_recordings(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/calls/#{id}/recordings")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, Spatio.Model.CallRecordingListResponse},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Start a recording (host only).

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.CallRecording.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec start_call_recording(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.CallRecording.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def start_call_recording(connection, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/calls/#{id}/recordings/start")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, Spatio.Model.CallRecording},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Stop an in-progress recording.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `recording_id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, Spatio.Model.CallRecording.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec stop_call_recording(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Spatio.Model.CallRecording.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def stop_call_recording(connection, id, recording_id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/calls/#{id}/recordings/#{recording_id}/stop")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, Spatio.Model.CallRecording},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """
  Toggle participant audio/video/screen-share state.

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `id` (String.t): 
  - `update_participant_state_request` (UpdateParticipantStateRequest): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec update_call_participant_state(Tesla.Env.client, String.t, Spatio.Model.UpdateParticipantStateRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def update_call_participant_state(connection, id, update_participant_state_request, _opts \\ []) do
    request =
      %{}
      |> method(:patch)
      |> url("/v1/calls/#{id}/participant")
      |> add_param(:body, :body, update_participant_state_request)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `request_body` (%{optional(String.t) => any()}): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_create_call(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_create_call(connection, org, workspace, request_body, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls")
      |> add_param(:body, :body, request_body)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {201, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `request_body` (%{optional(String.t) => any()}): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_create_meeting_room(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_create_meeting_room(connection, org, workspace, request_body, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/rooms")
      |> add_param(:body, :body, request_body)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {201, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `recording_id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_delete_call_recording(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_delete_call_recording(connection, org, workspace, recording_id, _opts \\ []) do
    request =
      %{}
      |> method(:delete)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/recordings/#{recording_id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {204, false},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_end_call(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_end_call(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/end")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {204, false},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_get_bandwidth_history(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_get_bandwidth_history(connection, org, workspace, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/bandwidth/history")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_get_bandwidth_summary(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_get_bandwidth_summary(connection, org, workspace, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/bandwidth/summary")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_get_call(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_get_call(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError},
      {404, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_get_meeting_room(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_get_meeting_room(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/rooms/#{id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_join_call(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_join_call(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/join")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_leave_call(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_leave_call(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/leave")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {204, false},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_list_active_calls(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_list_active_calls(connection, org, workspace, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_list_call_recordings(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_list_call_recordings(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/recordings")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_start_call_recording(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_start_call_recording(connection, org, workspace, id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/recordings/start")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `recording_id` (String.t): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_stop_call_recording(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_stop_call_recording(connection, org, workspace, id, recording_id, _opts \\ []) do
    request =
      %{}
      |> method(:post)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/recordings/#{recording_id}/stop")
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end

  @doc """

  ### Parameters

  - `connection` (Spatio.Connection): Connection to server
  - `org` (String.t): 
  - `workspace` (String.t): 
  - `id` (String.t): 
  - `request_body` (%{optional(String.t) => any()}): 
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec workspace_update_call_participant(Tesla.Env.client, String.t, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
  def workspace_update_call_participant(connection, org, workspace, id, request_body, _opts \\ []) do
    request =
      %{}
      |> method(:patch)
      |> url("/v1/organizations/#{org}/workspaces/#{workspace}/calls/#{id}/participant")
      |> add_param(:body, :body, request_body)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %{}},
      {401, Spatio.Model.ApiError},
      {403, Spatio.Model.ApiError}
    ])
  end
end