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 async fn get_records(
&self,
options: GetRecordsOptions,
) -> ApifyClientResult<Vec<u8>>
pub async fn get_records( &self, options: GetRecordsOptions, ) -> ApifyClientResult<Vec<u8>>
Downloads all records from the store as a ZIP archive (raw bytes).
Each record is stored as a separate file in the archive, with the filename equal to the
record key. Use GetRecordsOptions to filter by collection or prefix, or to pass a
URL-signing signature for a private store. Wraps
GET /v2/key-value-stores/{storeId}/records.
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