pub struct ApifyClient {
pub optional_token: Option<String>,
pub http_client: Client,
pub base_time_to_retry: u32,
pub debug_log: bool,
}
Fields§
§optional_token: Option<String>
§http_client: Client
§base_time_to_retry: u32
§debug_log: bool
Implementations§
Source§impl ApifyClient
impl ApifyClient
Sourcepub fn new(optional_token: Option<String>) -> ApifyClient
pub fn new(optional_token: Option<String>) -> ApifyClient
Creates a new Apify client with an optional token Be aware that all write operations requires token Some read operations require token, some have optional token and some don’t Using a method that requires token without a token in a client will result in Error
Source§impl ApifyClient
impl ApifyClient
Sourcepub fn list_datasets(&self) -> ListDatasetsBuilder<'_>
pub fn list_datasets(&self) -> ListDatasetsBuilder<'_>
List datasets of the provided account. Requires API token.
Sourcepub fn create_dataset(&self, dataset_name: &str) -> SimpleBuilder<'_, Dataset>
pub fn create_dataset(&self, dataset_name: &str) -> SimpleBuilder<'_, Dataset>
Requires API token
Sourcepub fn get_dataset(
&self,
dataset_id_or_name: &IdOrName,
) -> SimpleBuilder<'_, Dataset>
pub fn get_dataset( &self, dataset_id_or_name: &IdOrName, ) -> SimpleBuilder<'_, Dataset>
Gets a dataset info object If you provide dataset ID, you don’t need a token If you provide username~datasetName, you need a token (otherwise it will return an Error)
Sourcepub fn update_dataset(
&self,
dataset_id_or_name: &IdOrName,
new_dataset_name: &str,
) -> SimpleBuilder<'_, Dataset>
pub fn update_dataset( &self, dataset_id_or_name: &IdOrName, new_dataset_name: &str, ) -> SimpleBuilder<'_, Dataset>
Requires API token
Sourcepub fn delete_dataset(
&self,
dataset_id_or_name: &IdOrName,
) -> SimpleBuilder<'_, NoContent>
pub fn delete_dataset( &self, dataset_id_or_name: &IdOrName, ) -> SimpleBuilder<'_, NoContent>
Requires API token
Sourcepub fn put_items<T: Serialize>(
&self,
dataset_id_or_name: &IdOrName,
items: &T,
) -> SimpleBuilder<'_, NoContent>
pub fn put_items<T: Serialize>( &self, dataset_id_or_name: &IdOrName, items: &T, ) -> SimpleBuilder<'_, NoContent>
Appends item(s) at the end of the dataset.
items
must serialize into JSON object or array of objects and the JSON must have size less than 5 MB.
Otherwise the Apify API returns an error.
Requires API token.
API reference
Sourcepub fn get_items<T: DeserializeOwned>(
&self,
dataset_id_or_name: IdOrName,
) -> GetItemsBuilder<'_, T>
pub fn get_items<T: DeserializeOwned>( &self, dataset_id_or_name: IdOrName, ) -> GetItemsBuilder<'_, T>
Gets items from the dataset in JSON format and parses them into PaginationList<T>
.
If you need non-parsed String and/or different formats choose get_items_raw
instead.
API reference.
Sourcepub fn get_items_raw(
&self,
dataset_id_or_name: IdOrName,
) -> GetItemsBuilderRaw<'_>
pub fn get_items_raw( &self, dataset_id_or_name: IdOrName, ) -> GetItemsBuilderRaw<'_>
Gets items from the dataset in any format and return them as String
(no PaginationList).
API reference.