# 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.Platforms do
@moduledoc """
API calls for all endpoints tagged `Platforms`.
"""
alias Spatio.Connection
import Spatio.RequestBuilder
@doc """
Add a connected account for a platform/provider pair.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `provider` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec add_platform_provider_account(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 add_platform_provider_account(connection, platform_id, provider, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/platforms/#{platform_id}/providers/#{provider}/accounts")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Create or update a secret value.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_or_update_platform_secret(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_or_update_platform_secret(connection, platform_id, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/platforms/#{platform_id}/secrets")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Delete a secret.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `name` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_platform_secret(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def delete_platform_secret(connection, platform_id, name, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/platforms/#{platform_id}/secrets/#{name}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError}
])
end
@doc """
Run an INSERT/UPDATE/DELETE statement against a platform's store.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec exec_platform_data(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 exec_platform_data(connection, platform_id, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/platforms/#{platform_id}/exec")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Export all secrets for a platform (values included). Caller must be the platform owner.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec export_platform_secrets(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def export_platform_secrets(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms/#{platform_id}/secrets/export")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Generate a short-lived backend JWT a platform's worker can use to call back into platform-service.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec generate_platform_backend_token(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def generate_platform_backend_token(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/platforms/#{platform_id}/backend-token")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List the global platform catalog — every platform that exists, not just the ones the caller has installed.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_platform_catalog(Tesla.Env.client, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_platform_catalog(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/catalog/platforms")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Fetch a platform's manifest (capabilities, schema, UI metadata).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_platform_manifest(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_platform_manifest(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms/#{platform_id}/manifest")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List accounts the caller has connected for a platform.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_platform_accounts(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_platform_accounts(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms/#{platform_id}/accounts")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Discover supported providers + capabilities for a platform.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_platform_providers(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_platform_providers(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms/#{platform_id}/providers")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List secret keys (values redacted).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_platform_secrets(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_platform_secrets(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms/#{platform_id}/secrets")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List tables in a platform's data store.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_platform_tables(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_platform_tables(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms/#{platform_id}/tables")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List installed platforms for the sidebar.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_platforms(Tesla.Env.client, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_platforms(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/platforms")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Run a SELECT query against a platform's data store.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec query_platform_data(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 query_platform_data(connection, platform_id, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/platforms/#{platform_id}/query")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Run pending migrations for a platform.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `platform_id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec run_platform_migrations(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def run_platform_migrations(connection, platform_id, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/platforms/#{platform_id}/migrate")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
end