defmodule Stripe.Terminal.Location do use Stripe.Entity @moduledoc "A Location represents a grouping of readers.\n\nRelated guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations)" ( defstruct [ :address, :address_kana, :address_kanji, :configuration_overrides, :display_name, :display_name_kana, :display_name_kanji, :id, :livemode, :metadata, :object, :phone ] @typedoc "The `terminal.location` type.\n\n * `address` \n * `address_kana` \n * `address_kanji` \n * `configuration_overrides` The ID of a configuration that will be used to customize all readers in this location.\n * `display_name` The display name of the location.\n * `display_name_kana` The Kana variation of the display name of the location.\n * `display_name_kanji` The Kanji variation of the display name of the location.\n * `id` Unique identifier for the object.\n * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.\n * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `phone` The phone number of the location.\n" @type t :: %__MODULE__{ address: term, address_kana: term, address_kanji: term, configuration_overrides: binary, display_name: binary, display_name_kana: binary, display_name_kanji: binary, id: binary, livemode: boolean, metadata: term, object: binary, phone: binary } ) ( @typedoc "The full address of the location." @type address :: %{ optional(:city) => binary, optional(:country) => binary, optional(:line1) => binary, optional(:line2) => binary, optional(:postal_code) => binary, optional(:state) => binary } ) ( @typedoc "The Kana variation of the full address of the location (Japan only)." @type address_kana :: %{ optional(:city) => binary, optional(:country) => binary, optional(:line1) => binary, optional(:line2) => binary, optional(:postal_code) => binary, optional(:state) => binary, optional(:town) => binary } ) ( @typedoc "The Kanji variation of the full address of the location (Japan only)." @type address_kanji :: %{ optional(:city) => binary, optional(:country) => binary, optional(:line1) => binary, optional(:line2) => binary, optional(:postal_code) => binary, optional(:state) => binary, optional(:town) => binary } ) ( nil @doc "

Deletes a Location object.

\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/terminal/locations/{location}`\n" ( @spec delete(location :: binary(), opts :: Keyword.t()) :: {:ok, Stripe.DeletedTerminal.Location.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def delete(location, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/locations/{location}", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "location", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "location", properties: [], title: nil, type: "string" } } ], [location] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_method(:delete) |> Stripe.Request.make_request() end ) ) ( nil @doc "

Returns a list of Location objects.

\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/terminal/locations`\n" ( @spec list( params :: %{ optional(:ending_before) => binary, optional(:expand) => list(binary), optional(:limit) => integer, optional(:starting_after) => binary }, opts :: Keyword.t() ) :: {:ok, Stripe.List.t(Stripe.Terminal.Location.t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def list(params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params("/v1/terminal/locations", [], []) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:get) |> Stripe.Request.make_request() end ) ) ( nil @doc "

Retrieves a Location object.

\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/terminal/locations/{location}`\n" ( @spec retrieve( location :: binary(), params :: %{optional(:expand) => list(binary)}, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Location.t() | Stripe.DeletedTerminal.Location.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def retrieve(location, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/locations/{location}", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "location", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "location", properties: [], title: nil, type: "string" } } ], [location] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:get) |> Stripe.Request.make_request() end ) ) ( nil @doc "

Creates a new Location object.\nFor further details, including which address fields are required in each country, see the Manage locations guide.

\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/locations`\n" ( @spec create( params :: %{ optional(:address) => address, optional(:address_kana) => address_kana, optional(:address_kanji) => address_kanji, optional(:configuration_overrides) => binary, optional(:display_name) => binary, optional(:display_name_kana) => binary, optional(:display_name_kanji) => binary, optional(:expand) => list(binary), optional(:metadata) => %{optional(binary) => binary} | binary, optional(:phone) => binary }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Location.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def create(params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params("/v1/terminal/locations", [], []) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "

Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/locations/{location}`\n" ( @spec update( location :: binary(), params :: %{ optional(:address) => address, optional(:address_kana) => address_kana, optional(:address_kanji) => address_kanji, optional(:configuration_overrides) => binary | binary, optional(:display_name) => binary | binary, optional(:display_name_kana) => binary | binary, optional(:display_name_kanji) => binary | binary, optional(:expand) => list(binary), optional(:metadata) => %{optional(binary) => binary} | binary, optional(:phone) => binary | binary }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Location.t() | Stripe.DeletedTerminal.Location.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def update(location, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/locations/{location}", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "location", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "location", properties: [], title: nil, type: "string" } } ], [location] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) end