Cloudflare.WorkerVersion (Cloudflare v0.5.0)

Copy Markdown View Source

Worker Versions

Upload Version

POST /accounts/{account_id}/workers/scripts/{script_name}/versions

Upload a Worker Version without deploying to Cloudflare's network. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.

Responses

200 Upload Version response.

Data is at body["result"]

{
  "id": "*string*",
  "metadata": {
    "author_email": "*string*",
    "author_id": "*string*",
    "created_on": "*string*",
    "hasPreview": "*boolean*",
    "modified_on": "*string*",
    "source": "*string*"
  },
  "number": "*number*",
  "resources": {
    "bindings": [
      {}
    ],
    "script": {
      "etag": "*string*",
      "handlers": [
        "*string*"
      ],
      "last_deployed_from": "*string*",
      "named_handlers": [
        {
          "handlers": [
            null
          ],
          "name": "*string*"
        }
      ]
    },
    "script_runtime": {
      "compatibility_date": "*string*",
      "compatibility_flags": [
        "*string*"
      ],
      "limits": {
        "cpu_ms": "*integer*"
      },
      "migration_tag": "*string*",
      "usage_model": "*string*"
    }
  },
  "startup_time_ms": "*integer*"
}
4XX Upload Version response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

List Versions

GET /accounts/{account_id}/workers/scripts/{script_name}/versions

List of Worker Versions. The first version in the list is the latest version.

Responses

200 List Versions response.

Data is at body["result"]

{
  "items": [
    {
      "id": "*string*",
      "metadata": {
        "author_email": "*string*",
        "author_id": "*string*",
        "created_on": "*string*",
        "hasPreview": "*boolean*",
        "modified_on": "*string*",
        "source": "*string*"
      },
      "number": "*number*"
    }
  ]
}
4XX List Versions response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get Version Detail

GET /accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}

Responses

200 Get Version Detail response.

Data is at body["result"]

{
  "id": "*string*",
  "metadata": {
    "author_email": "*string*",
    "author_id": "*string*",
    "created_on": "*string*",
    "hasPreview": "*boolean*",
    "modified_on": "*string*",
    "source": "*string*"
  },
  "number": "*number*",
  "resources": {
    "bindings": [
      {}
    ],
    "script": {
      "etag": "*string*",
      "handlers": [
        "*string*"
      ],
      "last_deployed_from": "*string*",
      "named_handlers": [
        {
          "handlers": [
            null
          ],
          "name": "*string*"
        }
      ]
    },
    "script_runtime": {
      "compatibility_date": "*string*",
      "compatibility_flags": [
        "*string*"
      ],
      "limits": {
        "cpu_ms": "*integer*"
      },
      "migration_tag": "*string*",
      "usage_model": "*string*"
    }
  }
}
4XX Get Version Detail response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Summary

Functions

client(opts \\ [])

create(body, opts \\ [])

@spec create(
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) ::
  {:ok, map()} | {:error, term()}

create!(body, opts \\ [])

@spec create!(
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) ::
  map() | no_return()

index(opts \\ [])

@spec index(opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

index!(opts \\ [])

@spec index!(opts :: Restlax.Resource.action_options()) :: map() | no_return()

path_for(id, opts \\ [])

@spec path_for(term(), [{:action, String.t()}]) :: String.t()

show(id, opts \\ [])

@spec show(id :: term(), opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

show!(id, opts \\ [])

@spec show!(id :: term(), opts :: Restlax.Resource.action_options()) ::
  map() | no_return()