ApifyClient.API.Actors.Versions (apify_client v1.0.0)

Copy Markdown View Source

Provides API endpoints related to api/actors/versions

Summary

Functions

build_on_push(actor_id, version_number, body, opts \\ [])

@spec build_on_push(
  actor_id :: String.t(),
  version_number :: String.t(),
  body :: map() | ApifyClient.Schemas.UpdateBuildOnPushRequest.t(),
  opts :: keyword()
) :: :ok | {:error, ApifyClient.Error.t()}

Update Actor version build on push

Turns automatic builds on push on or off for an Actor version whose source is a git repository.

Enabling registers a push webhook on the repository through the connected git account given by providerId, so that every push to the repository builds the version. Disabling turns the webhook off on GitHub, or removes it on GitLab and Bitbucket.

You need write access to the Actor. The version must have its source type set to a git repository, and the connected account must have permission to manage the repository's webhooks.

Request Body

Content Types: application/json

create(actor_id, body, opts \\ [])

@spec create(
  actor_id :: String.t(),
  body :: map() | ApifyClient.Schemas.CreateVersionRequest.t(),
  opts :: keyword()
) :: {:ok, ApifyClient.Schemas.Version.t()} | {:error, ApifyClient.Error.t()}

Create Actor version

Creates a version of an Actor using values specified in a Version object passed as JSON in the POST payload.

The request must specify versionNumber and sourceType parameters (as strings) in the JSON payload and a Content-Type: application/json HTTP header.

Each sourceType requires its own additional properties to be passed to the JSON payload object. These are outlined in the Version object table below and in more detail in the Apify documentation.

For example, if an Actor's source code is stored in a GitHub repository, you will set the sourceType to GIT_REPO and pass the repository's URL in the gitRepoUrl property.

{
    "versionNumber": "0.1",
    "sourceType": "GIT_REPO",
    "gitRepoUrl": "https://github.com/my-github-account/actor-repo"
}

If the Actor is in a subdirectory of the uploaded SOURCE_FILES or TARBALL source, such as in a monorepo, set actorPath to that directory, for example "actorPath": "actors/typescript-actor".

The response is the Version object as returned by the Get Actor version endpoint.

Request Body

Content Types: application/json

delete(actor_id, version_number, opts \\ [])

@spec delete(actor_id :: String.t(), version_number :: String.t(), opts :: keyword()) ::
  :ok | {:error, ApifyClient.Error.t()}

Delete Actor version

Deletes a specific version of Actor's source code.

get(actor_id, version_number, opts \\ [])

@spec get(actor_id :: String.t(), version_number :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.Version.t()} | {:error, ApifyClient.Error.t()}

Get Actor version

Gets a Version object that contains all the details about a specific version of an Actor.

list(actor_id, opts \\ [])

@spec list(actor_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.ListOfVersions.t()}
  | {:error, ApifyClient.Error.t()}

Get list of Actor versions

Gets the list of versions of a specific Actor. The response is a JSON object with the list of Version objects, where each contains basic information about a single version.

update(actor_id, version_number, body, opts \\ [])

@spec update(
  actor_id :: String.t(),
  version_number :: String.t(),
  body :: map() | ApifyClient.Schemas.UpdateVersionRequest.t(),
  opts :: keyword()
) :: {:ok, ApifyClient.Schemas.Version.t()} | {:error, ApifyClient.Error.t()}

Update Actor version

Updates Actor version using values specified by a Version object passed as JSON in the POST payload.

If the object does not define a specific property, its value will not be updated.

An update that sends sourceType, sourceFiles, or tarballUrl without actorPath removes the version's stored actorPath. For a monorepo version, send actorPath again with every upload.

The request needs to specify the Content-Type: application/json HTTP header!

When providing your API authentication token, we recommend using the request's Authorization header, rather than the URL. For details, see Authentication.

The response is the Version object as returned by the Get Actor version endpoint.

Request Body

Content Types: application/json