Qronomnom.Bookings (Qronomnom v0.1.1)

Functions for interacting with Bookings resource.

Link to this section Summary

Functions

Creates a booking.

Lists bookings.

Shows a single booking.

Link to this section Types

Link to this type

booking_type()

Specs

booking_type() :: %{
  optional(:description) => String.t(),
  :start => DateTime.t(),
  :end => DateTime.t(),
  :item_id => String.t(),
  optional(:customer) => customer_type(),
  optional(:metadata) => %{atom: String.t()},
  optional(:deleted) => boolean()
}
Link to this type

customer_type()

Specs

customer_type() :: %{
  optional(:email) => String.t(),
  optional(:full_name) => String.t(),
  optional(:nickname) => String.t(),
  optional(:phone) => String.t(),
  optional(:metadata) => %{atom: String.t()}
}

Link to this section Functions

Link to this function

create(client, booking_data)

Specs

create(Tesla.Client.t(), booking_type()) ::
  {:error, any()} | {:ok, booking_type()}

Creates a booking.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Bookings.create(%{
      description: "string",
      start: "~U[2021-10-11 19:17:02.566057Z]",
      end: "~U[2021-10-11 20:17:02.566057Z]",
      item_id: "itm_EwYbBY2",
      customer: {
        "id": "DFfDs"
      },
      metadata: %{
        additionalProp: "foo"
      },
      deleted: false
})
{:ok, %{booking_id: "DFfDs..."}}

Specs

index(Tesla.Client.t()) :: {:error, any()} | {:ok, booking_type()}

Lists bookings.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Bookings.index()
{:ok, [%{booking_id: "DFfDs.."}, %{booking_id: "SDFdfa..."}]}
Link to this function

show(client, booking_id)

Specs

show(Tesla.Client.t(), String.t()) :: {:error, any()} | {:ok, booking_type()}

Shows a single booking.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Bookings.show("DFfDs")
{:ok, %{booking_id: "DFfDs.."}}
Link to this function

update(client, booking_id, booking_data)

Specs

update(Tesla.Client.t(), String.t(), booking_type()) ::
  {:error, any()} | {:ok, booking_type()}

Updates a booking.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Bookings.update("DFfDs...", %{
      description: "string",
      start: "~U[2021-10-11 19:17:02.566057Z]",
      end: "~U[2021-10-11 20:17:02.566057Z]",
      item_id: "itm_EwYbBY2",
      customer: {
        "id": "DFfDs"
      },
      metadata: %{
        additionalProp: "foo"
      },
      deleted: false
})
{:ok, %{booking_id: "DFfDs..."}}