apify_client/clients/
webhook_dispatch_collection.rs1use crate::clients::base::{list_resource, ResourceContext};
4use crate::clients::pagination::{list_iterator, ListIterator};
5use crate::common::{ListOptions, PaginationList, QueryParams};
6use crate::error::ApifyClientResult;
7use crate::http_client::HttpClient;
8use crate::models::WebhookDispatch;
9
10#[derive(Debug, Clone)]
12pub struct WebhookDispatchCollectionClient {
13 ctx: ResourceContext,
14}
15
16impl WebhookDispatchCollectionClient {
17 pub(crate) fn new(http: HttpClient, base_url: &str) -> Self {
18 Self {
19 ctx: ResourceContext::collection(http, base_url, "webhook-dispatches"),
20 }
21 }
22
23 pub(crate) fn with_base(http: HttpClient, base_url: &str, resource_path: &str) -> Self {
25 Self {
26 ctx: ResourceContext::collection(http, base_url, resource_path),
27 }
28 }
29
30 pub async fn list(
32 &self,
33 options: ListOptions,
34 ) -> ApifyClientResult<PaginationList<WebhookDispatch>> {
35 let mut params = QueryParams::new();
36 params
37 .add_int("offset", options.offset)
38 .add_int("limit", options.limit)
39 .add_bool("desc", options.desc);
40 list_resource(&self.ctx, None, ¶ms).await
41 }
42
43 pub fn iterate(&self, options: ListOptions) -> ListIterator<WebhookDispatch> {
50 list_iterator!(self, options, list)
51 }
52}