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