Current section
Files
Jump to
Current section
Files
lib/xdk/connections.ex
# AUTO-GENERATED FILE - DO NOT EDIT
# This file was automatically generated by the XDK build tool.
# Any manual changes will be overwritten on the next generation.
defmodule Xdk.Connections do
@moduledoc "Auto-generated client for connections operations"
@doc """
Get Connection History
GET /2/connections
Returns active and historical streaming connections with disconnect reasons for the authenticated application.
"""
@spec get_connection_history(Xdk.t(), opts :: keyword()) ::
{:ok, map()} | {:error, Xdk.Errors.error()}
def get_connection_history(client, opts \\ []) do
query =
[
{"status", Keyword.get(opts, :status)},
{"endpoints", Keyword.get(opts, :endpoints)},
{"max_results", Keyword.get(opts, :max_results)},
{"pagination_token", Keyword.get(opts, :pagination_token)},
{"connection.fields", Keyword.get(opts, :connection_fields)}
]
|> Xdk.Query.build()
Xdk.request(client, :get, "/2/connections", query: query)
end
@doc """
Terminate multiple connections
DELETE /2/connections
Terminates multiple streaming connections by their UUIDs for the authenticated application.
"""
@spec delete_by_uuids(Xdk.t(), body :: map()) :: {:ok, map()} | {:error, Xdk.Errors.error()}
def delete_by_uuids(client, body) do
Xdk.request(client, :delete, "/2/connections", json: body)
end
@doc """
Terminate connections by endpoint
DELETE /2/connections/{endpoint_id}
Terminates all streaming connections for a specific endpoint ID for the authenticated application.
"""
@spec delete_by_endpoint(Xdk.t(), endpoint_id :: String.t()) ::
{:ok, map()} | {:error, Xdk.Errors.error()}
def delete_by_endpoint(client, endpoint_id) do
Xdk.request(client, :delete, "/2/connections/{endpoint_id}",
params: %{
"endpoint_id" => endpoint_id
}
)
end
@doc """
Terminate all connections
DELETE /2/connections/all
Terminates all active streaming connections for the authenticated application.
"""
@spec delete_all(Xdk.t()) :: {:ok, map()} | {:error, Xdk.Errors.error()}
def delete_all(client) do
Xdk.request(client, :delete, "/2/connections/all")
end
end