lib/docusign/api/notary_jurisdiction.ex

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

defmodule DocuSign.Api.NotaryJurisdiction do
  @moduledoc """
  API calls for all endpoints tagged `NotaryJurisdiction`.
  """

  alias DocuSign.Connection
  import DocuSign.RequestBuilder

  @doc """
  Deletes the specified jurisdiction.
  Deletes the specified jurisdiction.

  ### Parameters

  - `connection` (DocuSign.Connection): Connection to server
  - `jurisdiction_id` (String.t): The ID of the jurisdiction. The following jurisdictions are supported:  -  `5 - California` -  `6 - Colorado` -  `9 - Florida` -  `10 - Georgia` -  `12 - Idaho` -  `13 - Illinois` -  `14 - Indiana` -  `15 - Iowa` -  `17 - Kentucky` -  `23 - Minnesota` -  `25 - Missouri` -  `30 - New Jersey` -  `32 - New York` -  `33 - North Carolina` -  `35 - Ohio` -  `37 - Oregon` -  `38 - Pennsylvania` -  `40 - South Carolina` -  `43 - Texas` -  `44 - Utah` -  `47 - Washington` -  `48 - West Virginia` -  `49 - Wisconsin` -  `62 - Florida Commissioner of Deeds`
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec notary_jurisdictions_delete_notary_jurisdiction(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, nil} | {:ok, DocuSign.Model.ErrorDetails.t()} | {:error, Tesla.Env.t()}
  def notary_jurisdictions_delete_notary_jurisdiction(connection, jurisdiction_id, _opts \\ []) do
    request =
      %{}
      |> method(:delete)
      |> url("/v2.1/current_user/notary/jurisdictions/#{jurisdiction_id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, false},
      {400, %DocuSign.Model.ErrorDetails{}}
    ])
  end

  @doc """
  Gets a jurisdiction object for the current user. The user must be a notary.
  Gets a jurisdiction object for the current user.  The following restrictions apply:  - The current user must be a notary. - The `jurisdictionId` must be a jurisdiction that the notary is registered for.

  ### Parameters

  - `connection` (DocuSign.Connection): Connection to server
  - `jurisdiction_id` (String.t): The ID of the jurisdiction. The following jurisdictions are supported:  -  `5 - California` -  `6 - Colorado` -  `9 - Florida` -  `10 - Georgia` -  `12 - Idaho` -  `13 - Illinois` -  `14 - Indiana` -  `15 - Iowa` -  `17 - Kentucky` -  `23 - Minnesota` -  `25 - Missouri` -  `30 - New Jersey` -  `32 - New York` -  `33 - North Carolina` -  `35 - Ohio` -  `37 - Oregon` -  `38 - Pennsylvania` -  `40 - South Carolina` -  `43 - Texas` -  `44 - Utah` -  `47 - Washington` -  `48 - West Virginia` -  `49 - Wisconsin` -  `62 - Florida Commissioner of Deeds`
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, DocuSign.Model.NotaryJurisdiction.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec notary_jurisdictions_get_notary_jurisdiction(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, DocuSign.Model.NotaryJurisdiction.t()}
          | {:ok, DocuSign.Model.ErrorDetails.t()}
          | {:error, Tesla.Env.t()}
  def notary_jurisdictions_get_notary_jurisdiction(connection, jurisdiction_id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v2.1/current_user/notary/jurisdictions/#{jurisdiction_id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %DocuSign.Model.NotaryJurisdiction{}},
      {400, %DocuSign.Model.ErrorDetails{}}
    ])
  end

  @doc """
  Returns a list of jurisdictions that the notary is registered in.
  Returns a list of jurisdictions that the notary is registered in. The current user must be a notary.

  ### Parameters

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

  ### Returns

  - `{:ok, DocuSign.Model.NotaryJurisdictionList.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec notary_jurisdictions_get_notary_jurisdictions(Tesla.Env.client(), keyword()) ::
          {:ok, DocuSign.Model.NotaryJurisdictionList.t()}
          | {:ok, DocuSign.Model.ErrorDetails.t()}
          | {:error, Tesla.Env.t()}
  def notary_jurisdictions_get_notary_jurisdictions(connection, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v2.1/current_user/notary/jurisdictions")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %DocuSign.Model.NotaryJurisdictionList{}},
      {400, %DocuSign.Model.ErrorDetails{}}
    ])
  end

  @doc """
  Creates a jurisdiction object.
  Creates a jurisdiction object.

  ### Parameters

  - `connection` (DocuSign.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:body` (NotaryJurisdiction):

  ### Returns

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

    request =
      %{}
      |> method(:post)
      |> url("/v2.1/current_user/notary/jurisdictions")
      |> add_optional_params(optional_params, opts)
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {201, %DocuSign.Model.NotaryJurisdiction{}},
      {400, %DocuSign.Model.ErrorDetails{}}
    ])
  end

  @doc """
  Updates the jurisdiction information about a notary.
  Updates the jurisdiction information about a notary.  The following restrictions apply:  - The current user must be a notary. - The `jurisdictionId` path parameter must be a jurisdiction that the notary is registered for. - The `jurisdictionId` path parameter must match the request body's `jurisdiction.jurisdictionId`.  The request body must have a full `jurisdiction` object for the jurisdiction property. The best way to do this is to use `getNotaryJurisdiction` to obtain the current values and update the properties you want to change.  For example, assume `getNotaryJurisdiction` returns this:  ``` {     \"jurisdiction\": {         \"jurisdictionId\": \"15\",         \"name\": \"Iowa\",         \"county\": \"\",         \"enabled\": \"true\",         \"countyInSeal\": \"false\",         \"commissionIdInSeal\": \"true\",         \"stateNameInSeal\": \"true\",         \"notaryPublicInSeal\": \"true\",         \"allowSystemCreatedSeal\": \"true\",         \"allowUserUploadedSeal\": \"false\"     },     \"commissionId\": \"123456\",     \"commissionExpiration\": \"2020-08-31T07:00:00.0000000Z\",     \"registeredName\": \"Bob Notary\",     \"county\": \"Adams\",     \"sealType\": \"system_created\" } ```  If you want to change the name of the notary from \"Bob Notary\" to \"Robert Notary\", your request body would be:  ``` {     \"jurisdiction\": {         \"jurisdictionId\": \"15\",         \"name\": \"Iowa\",         \"county\": \"\",         \"enabled\": \"true\",         \"countyInSeal\": \"false\",         \"commissionIdInSeal\": \"true\",         \"stateNameInSeal\": \"true\",         \"notaryPublicInSeal\": \"true\",         \"allowSystemCreatedSeal\": \"true\",         \"allowUserUploadedSeal\": \"false\"     },     \"commissionId\": \"123456\",     \"commissionExpiration\": \"2020-08-31T07:00:00.0000000Z\",     \"registeredName\": \"Robert Notary\",     \"county\": \"Adams\",     \"sealType\": \"system_created\" } ```

  ### Parameters

  - `connection` (DocuSign.Connection): Connection to server
  - `jurisdiction_id` (String.t): The ID of the jurisdiction. The following jurisdictions are supported:  -  `5 - California` -  `6 - Colorado` -  `9 - Florida` -  `10 - Georgia` -  `12 - Idaho` -  `13 - Illinois` -  `14 - Indiana` -  `15 - Iowa` -  `17 - Kentucky` -  `23 - Minnesota` -  `25 - Missouri` -  `30 - New Jersey` -  `32 - New York` -  `33 - North Carolina` -  `35 - Ohio` -  `37 - Oregon` -  `38 - Pennsylvania` -  `40 - South Carolina` -  `43 - Texas` -  `44 - Utah` -  `47 - Washington` -  `48 - West Virginia` -  `49 - Wisconsin` -  `62 - Florida Commissioner of Deeds`
  - `opts` (keyword): Optional parameters
    - `:body` (NotaryJurisdiction):

  ### Returns

  - `{:ok, DocuSign.Model.NotaryJurisdiction.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec notary_jurisdictions_put_notary_jurisdiction(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, DocuSign.Model.NotaryJurisdiction.t()}
          | {:ok, DocuSign.Model.ErrorDetails.t()}
          | {:error, Tesla.Env.t()}
  def notary_jurisdictions_put_notary_jurisdiction(connection, jurisdiction_id, opts \\ []) do
    optional_params = %{
      :body => :body
    }

    request =
      %{}
      |> method(:put)
      |> url("/v2.1/current_user/notary/jurisdictions/#{jurisdiction_id}")
      |> add_optional_params(optional_params, opts)
      |> ensure_body()
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, %DocuSign.Model.NotaryJurisdiction{}},
      {400, %DocuSign.Model.ErrorDetails{}}
    ])
  end
end