ApifyClient.API.KeyValueStores (apify_client v1.0.0)

Copy Markdown View Source

Provides API endpoints related to api/key value stores

Summary

Functions

Create key-value store

Delete key-value store

Get key-value store

Get list of key-value stores

Update key-value store

Functions

create(opts \\ [])

@spec create(opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.KeyValueStoreResource.t()}
  | {:error, ApifyClient.Error.t()}

Create key-value store

Creates a key-value store and returns its object. The response is the same object as returned by the Get key-value store endpoint.

Keep in mind that data stored under unnamed store follows data retention period.

It creates a store with the given name if the parameter name is used. If there is another store with the same name, the endpoint does not create a new one and returns the existing object instead.

Options

  • name: Custom unique name to easily identify the store in the future.

delete(store_id, opts \\ [])

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

Delete key-value store

Deletes a key-value store.

get(store_id, opts \\ [])

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

Get key-value store

Gets an object that contains all the details about a specific key-value store.

list(opts \\ [])

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

Get list of key-value stores

Gets the list of key-value stores owned by the user.

The response is a list of objects, where each objects contains a basic information about a single key-value store.

The endpoint supports pagination using the limit and offset parameters and it will not return more than 1000 array elements.

By default, the records are sorted by the createdAt field in ascending order, therefore you can use pagination to incrementally fetch all key-value stores while new ones are still being created. To sort the records in descending order, use the desc=1 parameter.

Options

  • offset: Number of items that should be skipped at the start. The default value is 0.

  • limit: Maximum number of items to return. The default value as well as the maximum is 1000.

  • desc: If true or 1 then the objects are sorted by the createdAt field in descending order. By default, they are sorted in ascending order.

  • unnamed: If true or 1 then all the storages are returned. By default, only named storages are returned.

  • ownership: Filter by ownership. If this parameter is omitted, all accessible key-value stores are returned.

    • ownedByMe: Return only key-value stores owned by the user.
    • sharedWithMe: Return only key-value stores shared with the user by other users.

update(store_id, body, opts \\ [])

@spec update(
  store_id :: String.t(),
  body :: map() | ApifyClient.Schemas.UpdateKeyValueStoreRequest.t(),
  opts :: keyword()
) ::
  {:ok, ApifyClient.Schemas.KeyValueStoreResource.t()}
  | {:error, ApifyClient.Error.t()}

Update key-value store

Updates a key-value store's name and general resource access level using a value specified by a JSON object passed in the PUT payload.

The response is the updated key-value store object, as returned by the Get key-value store API endpoint.

Request Body

Content Types: application/json