ReqFly.Apps (req_fly v1.0.0)

View Source

Functions for interacting with Fly.io Apps API.

The Apps API provides operations for managing Fly.io applications including listing, creating, retrieving, and destroying apps.

Examples

req = Req.new() |> ReqFly.attach(token: "fly_token")

# List all apps in an organization
{:ok, apps} = ReqFly.Apps.list(req, org_slug: "my-org")

# Create a new app
{:ok, app} = ReqFly.Apps.create(req, app_name: "my-app", org_slug: "my-org")

# Get app details
{:ok, app} = ReqFly.Apps.get(req, "my-app")

# Destroy an app
{:ok, _} = ReqFly.Apps.destroy(req, "my-app")

Summary

Functions

Creates a new Fly.io application.

Destroys (deletes) a Fly.io application.

Gets details for a specific app.

Lists all apps, optionally filtered by organization.

Functions

create(req, opts)

@spec create(
  Req.Request.t(),
  keyword()
) :: {:ok, map()} | {:error, ReqFly.Error.t()}

Creates a new Fly.io application.

Parameters

  • req - A Req.Request with ReqFly attached
  • opts - Options keyword list (required)
    • :app_name - Name of the app to create (required)
    • :org_slug - Organization slug (required)

Returns

  • {:ok, app} - Created app details
  • {:error, %ReqFly.Error{}} - Error details

Examples

req = Req.new() |> ReqFly.attach(token: "fly_token")
{:ok, app} = ReqFly.Apps.create(req, app_name: "my-app", org_slug: "my-org")

destroy(req, app_name)

@spec destroy(Req.Request.t(), String.t()) ::
  {:ok, term()} | {:error, ReqFly.Error.t()}

Destroys (deletes) a Fly.io application.

Parameters

  • req - A Req.Request with ReqFly attached
  • app_name - Name of the app to destroy

Returns

  • {:ok, response} - Deletion confirmation
  • {:error, %ReqFly.Error{}} - Error details

Examples

req = Req.new() |> ReqFly.attach(token: "fly_token")
{:ok, _} = ReqFly.Apps.destroy(req, "my-app")

get(req, app_name)

@spec get(Req.Request.t(), String.t()) :: {:ok, map()} | {:error, ReqFly.Error.t()}

Gets details for a specific app.

Parameters

  • req - A Req.Request with ReqFly attached
  • app_name - Name of the app to retrieve

Returns

  • {:ok, app} - App details
  • {:error, %ReqFly.Error{}} - Error details (e.g., 404 if not found)

Examples

req = Req.new() |> ReqFly.attach(token: "fly_token")
{:ok, app} = ReqFly.Apps.get(req, "my-app")

list(req, opts \\ [])

@spec list(
  Req.Request.t(),
  keyword()
) :: {:ok, [map()]} | {:error, ReqFly.Error.t()}

Lists all apps, optionally filtered by organization.

Parameters

  • req - A Req.Request with ReqFly attached
  • opts - Options keyword list
    • :org_slug - Filter apps by organization slug (optional)

Returns

  • {:ok, apps} - List of app maps
  • {:error, %ReqFly.Error{}} - Error details

Examples

req = Req.new() |> ReqFly.attach(token: "fly_token")

# List all apps
{:ok, apps} = ReqFly.Apps.list(req)

# List apps in a specific organization
{:ok, apps} = ReqFly.Apps.list(req, org_slug: "my-org")