# 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.Organizations do
@moduledoc """
API calls for all endpoints tagged `Organizations`.
"""
alias Spatio.Connection
import Spatio.RequestBuilder
@doc """
Accept an invitation to this organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `accept_organization_invitation_request` (AcceptOrganizationInvitationRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec accept_organization_invitation(Tesla.Env.client, String.t, Spatio.Model.AcceptOrganizationInvitationRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def accept_organization_invitation(connection, org, accept_organization_invitation_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/accept-invitation")
|> add_param(:body, :body, accept_organization_invitation_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{410, Spatio.Model.ApiError}
])
end
@doc """
Add a member directly (skips invitation flow).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `add_organization_member_request` (AddOrganizationMemberRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec add_organization_member(Tesla.Env.client, String.t, Spatio.Model.AddOrganizationMemberRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def add_organization_member(connection, org, add_organization_member_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/members")
|> add_param(:body, :body, add_organization_member_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{402, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Create an organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `create_organization_request` (CreateOrganizationRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_organization(Tesla.Env.client, Spatio.Model.CreateOrganizationRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_organization(connection, create_organization_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations")
|> add_param(:body, :body, create_organization_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError}
])
end
@doc """
Create an org-brain concept (admin+ only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_organization_concept(Tesla.Env.client, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_organization_concept(connection, org, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/concepts")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Create a custom role (admin+ only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_organization_custom_role(Tesla.Env.client, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_organization_custom_role(connection, org, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/roles")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Invite a user to the organization.
Pending invitations count toward seat cap. Free-tier callers at the cap receive a `402` with billing-upgrade payload; paid-tier auto-scales the Stripe quantity.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `create_organization_invitation_request` (CreateOrganizationInvitationRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.OrganizationInvitation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_organization_invitation(Tesla.Env.client, String.t, Spatio.Model.CreateOrganizationInvitationRequest.t, keyword()) :: {:ok, Spatio.Model.OrganizationInvitation.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_organization_invitation(connection, org, create_organization_invitation_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/invitations")
|> add_param(:body, :body, create_organization_invitation_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.OrganizationInvitation},
{401, Spatio.Model.ApiError},
{402, Spatio.Model.ApiError}
])
end
@doc """
Create a workspace inside an organization.
Requires the `OrgActionCreateWorkspace` action permission. Slug collisions auto-suffix (`-2`, `-3`, ...).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `create_workspace_request` (CreateWorkspaceRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.WorkspaceEnvelope.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_organization_workspace(Tesla.Env.client, String.t, Spatio.Model.CreateWorkspaceRequest.t, keyword()) :: {:ok, Spatio.Model.WorkspaceEnvelope.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_organization_workspace(connection, org, create_workspace_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces")
|> add_param(:body, :body, create_workspace_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, Spatio.Model.WorkspaceEnvelope},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Delete an organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t): Organization id or slug.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_organization(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def delete_organization(connection, org, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Delete a concept (admin+ only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `slug` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_organization_concept(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def delete_organization_concept(connection, org, slug, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}/concepts/#{slug}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError}
])
end
@doc """
Delete a custom role (admin+ only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `role_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_organization_custom_role(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def delete_organization_custom_role(connection, org, role_id, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}/roles/#{role_id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError}
])
end
@doc """
Delete the organization logo.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_organization_logo(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def delete_organization_logo(connection, org, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}/logo")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError}
])
end
@doc """
Fetch a single organization.
**Wire format note:** response uses PascalCase keys (`ID`, `Name`, `Slug`, ...) — distinct from the rest of the SpatioAPI's camelCase convention. Documented as-is; a future cleanup will harmonize.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t): Organization id or slug.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.OrganizationDetailLegacy.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_organization(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.OrganizationDetailLegacy.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_organization(connection, org, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.OrganizationDetailLegacy},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Fetch a concept.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `slug` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_organization_concept(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_organization_concept(connection, org, slug, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/concepts/#{slug}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
List the caller's organizations.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.OrganizationListResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_my_organizations(Tesla.Env.client, keyword()) :: {:ok, Spatio.Model.OrganizationListResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_my_organizations(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.OrganizationListResponse},
{401, Spatio.Model.ApiError}
])
end
@doc """
Read the organization audit log (admin / billing-admin only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
- `:limit` (integer()):
- `:cursor` (String.t):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_organization_audit_log(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_organization_audit_log(connection, org, opts \\ []) do
optional_params = %{
:limit => :query,
:cursor => :query
}
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/audit-log")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List org-brain concepts (curated knowledge surfaced to agents).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_organization_concepts(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_organization_concepts(connection, org, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/concepts")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List custom roles defined on the organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_organization_custom_roles(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_organization_custom_roles(connection, org, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/roles")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List pending invitations for an organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.OrganizationInvitationListResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_organization_invitations(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.OrganizationInvitationListResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_organization_invitations(connection, org, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/invitations")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.OrganizationInvitationListResponse},
{401, Spatio.Model.ApiError}
])
end
@doc """
List members of an organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.OrganizationMemberListResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_organization_members(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.OrganizationMemberListResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_organization_members(connection, org, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/members")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.OrganizationMemberListResponse},
{401, Spatio.Model.ApiError}
])
end
@doc """
List workspaces in an organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.WorkspaceListResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_organization_workspaces(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.WorkspaceListResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_organization_workspaces(connection, org, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.WorkspaceListResponse},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Remove a member from the organization.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `member_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec remove_organization_member(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def remove_organization_member(connection, org, member_id, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}/members/#{member_id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Revoke and reissue an invitation with a fresh token.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `invitation_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.OrganizationInvitation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec resend_organization_invitation(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Spatio.Model.OrganizationInvitation.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def resend_organization_invitation(connection, org, invitation_id, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/invitations/#{invitation_id}/resend")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.OrganizationInvitation},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Revoke a pending invitation.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `invitation_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec revoke_organization_invitation(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def revoke_organization_invitation(connection, org, invitation_id, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}/invitations/#{invitation_id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Update organization metadata.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t): Organization id or slug.
- `update_organization_request` (UpdateOrganizationRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_organization(Tesla.Env.client, String.t, Spatio.Model.UpdateOrganizationRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def update_organization(connection, org, update_organization_request, _opts \\ []) do
request =
%{}
|> method(:patch)
|> url("/v1/organizations/#{org}")
|> add_param(:body, :body, update_organization_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Update a concept (admin+ only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `slug` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_organization_concept(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 update_organization_concept(connection, org, slug, request_body, _opts \\ []) do
request =
%{}
|> method(:patch)
|> url("/v1/organizations/#{org}/concepts/#{slug}")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Update a custom role (admin+ only).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `role_id` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_organization_custom_role(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 update_organization_custom_role(connection, org, role_id, request_body, _opts \\ []) do
request =
%{}
|> method(:patch)
|> url("/v1/organizations/#{org}/roles/#{role_id}")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Update a member's role.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `member_id` (String.t):
- `update_organization_member_request` (UpdateOrganizationMemberRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_organization_member(Tesla.Env.client, String.t, String.t, Spatio.Model.UpdateOrganizationMemberRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def update_organization_member(connection, org, member_id, update_organization_member_request, _opts \\ []) do
request =
%{}
|> method(:patch)
|> url("/v1/organizations/#{org}/members/#{member_id}")
|> add_param(:body, :body, update_organization_member_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Upload (or replace) the organization logo. Multipart.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `opts` (keyword): Optional parameters
- `:file` (String.t):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec upload_organization_logo(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def upload_organization_logo(connection, org, opts \\ []) do
optional_params = %{
:file => :form
}
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/logo")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
end