pub struct KeyValueStoreClient { /* private fields */ }Expand description
Client for a specific key-value store.
Implementations§
Source§impl KeyValueStoreClient
impl KeyValueStoreClient
Sourcepub async fn get(&self) -> ApifyClientResult<Option<KeyValueStore>>
pub async fn get(&self) -> ApifyClientResult<Option<KeyValueStore>>
Fetches the store metadata, or None if it does not exist.
Sourcepub async fn update<T: Serialize>(
&self,
new_fields: &T,
) -> ApifyClientResult<KeyValueStore>
pub async fn update<T: Serialize>( &self, new_fields: &T, ) -> ApifyClientResult<KeyValueStore>
Updates the store metadata (e.g. name, title).
Sourcepub async fn delete(&self) -> ApifyClientResult<()>
pub async fn delete(&self) -> ApifyClientResult<()>
Deletes the store.
Sourcepub async fn list_keys(
&self,
options: ListKeysOptions,
) -> ApifyClientResult<KeyValueStoreKeysPage>
pub async fn list_keys( &self, options: ListKeysOptions, ) -> ApifyClientResult<KeyValueStoreKeysPage>
Lists the keys in the store (key-based pagination).
Sourcepub fn iterate_keys(
&self,
options: ListKeysOptions,
) -> KeyValueStoreKeysIterator
pub fn iterate_keys( &self, options: ListKeysOptions, ) -> KeyValueStoreKeysIterator
Lazily iterates over every key in the store, fetching pages on demand.
Returns a KeyValueStoreKeysIterator; call its next() to get one key at a time,
transparently fetching the following page once the local buffer drains, until the store
is exhausted. This is the auto-paginating counterpart to the single-page
list_keys, matching the reference client’s listKeys()
AsyncIterable.
Key-value stores use cursor-based (not offset) pagination: each page is anchored by the
previous page’s nextExclusiveStartKey, so the iterator threads that cursor through
automatically. The prefix, collection and signature filters from options are
carried into every page.
options.limit caps the total number of keys yielded across all pages; leaving it unset
(or 0) iterates the entire store, matching the reference client. It is honoured across as
many pages as needed — each individual request is bounded to the endpoint’s maximum page
size (KEY_LIST_MAX_LIMIT), so a cap larger than one page still works.
options.exclusive_start_key, when set, resumes iteration after that key.
Sourcepub async fn record_exists(&self, key: &str) -> ApifyClientResult<bool>
pub async fn record_exists(&self, key: &str) -> ApifyClientResult<bool>
Returns true if a record with the given key exists.
Sourcepub async fn get_record(
&self,
key: &str,
) -> ApifyClientResult<Option<KeyValueStoreRecord>>
pub async fn get_record( &self, key: &str, ) -> ApifyClientResult<Option<KeyValueStoreRecord>>
Gets a record’s raw value (and content type), or None if it does not exist.
Like the reference client’s getRecord, this sends attachment=true. Use
get_record_with_options to override the attachment
behaviour or to pass a URL-signing signature for a private store.
Sourcepub async fn get_record_with_options(
&self,
key: &str,
options: GetRecordOptions,
) -> ApifyClientResult<Option<KeyValueStoreRecord>>
pub async fn get_record_with_options( &self, key: &str, options: GetRecordOptions, ) -> ApifyClientResult<Option<KeyValueStoreRecord>>
Gets a record with explicit options.
The attachment option controls the Content-Disposition: attachment response header;
when unset it defaults to true, matching the reference client’s unconditional behaviour.
signature supplies a URL-signing signature for accessing a record in a private store.
Sourcepub async fn set_record_raw(
&self,
key: &str,
value: Vec<u8>,
content_type: &str,
) -> ApifyClientResult<()>
pub async fn set_record_raw( &self, key: &str, value: Vec<u8>, content_type: &str, ) -> ApifyClientResult<()>
Stores a record with raw bytes and an explicit content type.
Sourcepub async fn set_record_json<T: Serialize>(
&self,
key: &str,
value: &T,
) -> ApifyClientResult<()>
pub async fn set_record_json<T: Serialize>( &self, key: &str, value: &T, ) -> ApifyClientResult<()>
Stores a record as JSON (the value is serialized and content type set to JSON).
Sourcepub async fn get_record_public_url(
&self,
key: &str,
) -> ApifyClientResult<String>
pub async fn get_record_public_url( &self, key: &str, ) -> ApifyClientResult<String>
Builds a public URL for reading the record with the given key.
Mirrors the reference client’s getRecordPublicUrl: it fetches the store, and if the
store exposes a URL-signing secret key (private store), appends an HMAC-SHA256
signature over the record key so the URL works without an API token. The URL is
built from the configured public base URL.
Sourcepub async fn create_keys_public_url(
&self,
expires_in_secs: Option<i64>,
) -> ApifyClientResult<String>
pub async fn create_keys_public_url( &self, expires_in_secs: Option<i64>, ) -> ApifyClientResult<String>
Builds a public URL for listing this store’s keys.
Like get_record_public_url, signs the URL with an
HMAC-SHA256 signature for private stores. expires_in_secs optionally bounds a
signed URL’s validity.
Sourcepub async fn delete_record(&self, key: &str) -> ApifyClientResult<()>
pub async fn delete_record(&self, key: &str) -> ApifyClientResult<()>
Deletes the record with the given key.
Trait Implementations§
Source§impl Clone for KeyValueStoreClient
impl Clone for KeyValueStoreClient
Source§fn clone(&self) -> KeyValueStoreClient
fn clone(&self) -> KeyValueStoreClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more