Skip to main content

polyoxide_gamma/api/
events.rs

1use polyoxide_core::{HttpClient, QueryBuilder, Request};
2
3use crate::{
4    error::GammaError,
5    types::{CountResponse, Event, EventCreator, EventsPagination, KeysetEventsResponse, Tag},
6};
7
8/// Events namespace for event-related operations
9#[derive(Clone)]
10pub struct Events {
11    pub(crate) http_client: HttpClient,
12}
13
14impl Events {
15    /// List events with optional filtering
16    pub fn list(&self) -> ListEvents {
17        ListEvents {
18            request: Request::new(self.http_client.clone(), "/events"),
19        }
20    }
21
22    /// Get an event by ID
23    pub fn get(&self, id: impl Into<String>) -> GetEvent {
24        GetEvent {
25            request: Request::new(
26                self.http_client.clone(),
27                format!("/events/{}", urlencoding::encode(&id.into())),
28            ),
29        }
30    }
31
32    /// Get an event by slug
33    pub fn get_by_slug(&self, slug: impl Into<String>) -> GetEvent {
34        GetEvent {
35            request: Request::new(
36                self.http_client.clone(),
37                format!("/events/slug/{}", urlencoding::encode(&slug.into())),
38            ),
39        }
40    }
41
42    /// Get tags for an event
43    pub fn tags(&self, id: impl Into<String>) -> Request<Vec<Tag>, GammaError> {
44        Request::new(
45            self.http_client.clone(),
46            format!("/events/{}/tags", urlencoding::encode(&id.into())),
47        )
48    }
49
50    /// Get tweet count for an event
51    pub fn tweet_count(&self, id: impl Into<String>) -> Request<CountResponse, GammaError> {
52        Request::new(
53            self.http_client.clone(),
54            format!("/events/{}/tweet-count", urlencoding::encode(&id.into())),
55        )
56    }
57
58    /// Get comment count for an event
59    pub fn comment_count(&self, id: impl Into<String>) -> Request<CountResponse, GammaError> {
60        Request::new(
61            self.http_client.clone(),
62            format!("/events/{}/comments/count", urlencoding::encode(&id.into())),
63        )
64    }
65
66    /// List event creators with optional filtering
67    /// (`GET /events/creators`).
68    pub fn list_creators(&self) -> ListEventCreators {
69        ListEventCreators {
70            request: Request::new(self.http_client.clone(), "/events/creators"),
71        }
72    }
73
74    /// Get an event creator by ID (`GET /events/creators/{id}`).
75    pub fn get_creator(&self, id: impl Into<String>) -> Request<EventCreator, GammaError> {
76        Request::new(
77            self.http_client.clone(),
78            format!("/events/creators/{}", urlencoding::encode(&id.into())),
79        )
80    }
81
82    /// List events with offset-style pagination metadata
83    /// (`GET /events/pagination`).
84    pub fn list_paginated(&self) -> ListPaginatedEvents {
85        ListPaginatedEvents {
86            request: Request::new(self.http_client.clone(), "/events/pagination"),
87        }
88    }
89
90    /// List sport event results (`GET /events/results`).
91    pub fn list_results(&self) -> ListEventResults {
92        ListEventResults {
93            request: Request::new(self.http_client.clone(), "/events/results"),
94        }
95    }
96
97    /// List events using cursor-based (keyset) pagination
98    /// (`GET /events/keyset`).
99    ///
100    /// Prefer this over [`Self::list`] for stable paging through large result
101    /// sets. Use `next_cursor` from each response as `after_cursor` in the
102    /// next request; pagination is complete when `next_cursor` is `None`.
103    ///
104    /// Note: a handful of obscure upstream query parameters
105    /// (`start_time_min/max`, `event_date`, `event_week`, `recurrence`,
106    /// `created_by`, `parent_event_id`, `include_children`, `partner_slug`,
107    /// `include_best_lines`, `locale`, `decimalized`, `tag_match`) are not
108    /// yet exposed. The majority of filters are available; callers needing
109    /// the omitted params can reach the endpoint directly via
110    /// [`Request::query`].
111    pub fn list_keyset(&self) -> ListKeysetEvents {
112        ListKeysetEvents {
113            request: Request::new(self.http_client.clone(), "/events/keyset"),
114        }
115    }
116}
117
118/// Request builder for [`Events::list_creators`].
119pub struct ListEventCreators {
120    request: Request<Vec<EventCreator>, GammaError>,
121}
122
123impl ListEventCreators {
124    /// Limit the number of results (minimum: 0).
125    pub fn limit(mut self, limit: u32) -> Self {
126        self.request = self.request.query("limit", limit);
127        self
128    }
129
130    /// Pagination offset (minimum: 0).
131    pub fn offset(mut self, offset: u32) -> Self {
132        self.request = self.request.query("offset", offset);
133        self
134    }
135
136    /// Comma-separated list of fields to order by.
137    pub fn order(mut self, order: impl Into<String>) -> Self {
138        self.request = self.request.query("order", order.into());
139        self
140    }
141
142    /// Sort direction.
143    pub fn ascending(mut self, ascending: bool) -> Self {
144        self.request = self.request.query("ascending", ascending);
145        self
146    }
147
148    /// Filter by creator name.
149    pub fn creator_name(mut self, name: impl Into<String>) -> Self {
150        self.request = self.request.query("creator_name", name.into());
151        self
152    }
153
154    /// Filter by creator handle.
155    pub fn creator_handle(mut self, handle: impl Into<String>) -> Self {
156        self.request = self.request.query("creator_handle", handle.into());
157        self
158    }
159
160    /// Execute the request.
161    pub async fn send(self) -> Result<Vec<EventCreator>, GammaError> {
162        self.request.send().await
163    }
164}
165
166/// Request builder for [`Events::list_paginated`].
167pub struct ListPaginatedEvents {
168    request: Request<EventsPagination, GammaError>,
169}
170
171impl ListPaginatedEvents {
172    /// Limit the number of results.
173    pub fn limit(mut self, limit: u32) -> Self {
174        self.request = self.request.query("limit", limit);
175        self
176    }
177
178    /// Pagination offset.
179    pub fn offset(mut self, offset: u32) -> Self {
180        self.request = self.request.query("offset", offset);
181        self
182    }
183
184    /// Comma-separated list of fields to order by.
185    pub fn order(mut self, order: impl Into<String>) -> Self {
186        self.request = self.request.query("order", order.into());
187        self
188    }
189
190    /// Sort direction.
191    pub fn ascending(mut self, ascending: bool) -> Self {
192        self.request = self.request.query("ascending", ascending);
193        self
194    }
195
196    /// Include chat data in response.
197    pub fn include_chat(mut self, include: bool) -> Self {
198        self.request = self.request.query("include_chat", include);
199        self
200    }
201
202    /// Include template data in response.
203    pub fn include_template(mut self, include: bool) -> Self {
204        self.request = self.request.query("include_template", include);
205        self
206    }
207
208    /// Filter by recurrence pattern.
209    pub fn recurrence(mut self, recurrence: impl Into<String>) -> Self {
210        self.request = self.request.query("recurrence", recurrence.into());
211        self
212    }
213
214    /// Execute the request.
215    pub async fn send(self) -> Result<EventsPagination, GammaError> {
216        self.request.send().await
217    }
218}
219
220/// Request builder for [`Events::list_results`].
221pub struct ListEventResults {
222    request: Request<Vec<Event>, GammaError>,
223}
224
225impl ListEventResults {
226    /// Limit the number of results.
227    pub fn limit(mut self, limit: u32) -> Self {
228        self.request = self.request.query("limit", limit);
229        self
230    }
231
232    /// Pagination offset.
233    pub fn offset(mut self, offset: u32) -> Self {
234        self.request = self.request.query("offset", offset);
235        self
236    }
237
238    /// Comma-separated list of fields to order by.
239    pub fn order(mut self, order: impl Into<String>) -> Self {
240        self.request = self.request.query("order", order.into());
241        self
242    }
243
244    /// Sort direction.
245    pub fn ascending(mut self, ascending: bool) -> Self {
246        self.request = self.request.query("ascending", ascending);
247        self
248    }
249
250    /// Execute the request.
251    pub async fn send(self) -> Result<Vec<Event>, GammaError> {
252        self.request.send().await
253    }
254}
255
256/// Request builder for [`Events::list_keyset`].
257pub struct ListKeysetEvents {
258    request: Request<KeysetEventsResponse, GammaError>,
259}
260
261impl ListKeysetEvents {
262    /// Maximum number of results to return (upstream max 500).
263    pub fn limit(mut self, limit: u32) -> Self {
264        self.request = self.request.query("limit", limit);
265        self
266    }
267
268    /// Comma-separated list of JSON field names to order by.
269    pub fn order(mut self, order: impl Into<String>) -> Self {
270        self.request = self.request.query("order", order.into());
271        self
272    }
273
274    /// Sort direction (used only when `order` is set).
275    pub fn ascending(mut self, ascending: bool) -> Self {
276        self.request = self.request.query("ascending", ascending);
277        self
278    }
279
280    /// Opaque cursor token returned as `next_cursor` from a previous response.
281    pub fn after_cursor(mut self, cursor: impl Into<String>) -> Self {
282        self.request = self.request.query("after_cursor", cursor.into());
283        self
284    }
285
286    /// Filter by specific event IDs.
287    pub fn id(mut self, ids: impl IntoIterator<Item = i64>) -> Self {
288        self.request = self.request.query_many("id", ids);
289        self
290    }
291
292    /// Filter by event slugs.
293    pub fn slug(mut self, slugs: impl IntoIterator<Item = impl ToString>) -> Self {
294        self.request = self.request.query_many("slug", slugs);
295        self
296    }
297
298    /// Filter by closed status.
299    pub fn closed(mut self, closed: bool) -> Self {
300        self.request = self.request.query("closed", closed);
301        self
302    }
303
304    /// Filter live events only.
305    pub fn live(mut self, live: bool) -> Self {
306        self.request = self.request.query("live", live);
307        self
308    }
309
310    /// Filter featured events only.
311    pub fn featured(mut self, featured: bool) -> Self {
312        self.request = self.request.query("featured", featured);
313        self
314    }
315
316    /// Search by event title substring.
317    pub fn title_search(mut self, query: impl Into<String>) -> Self {
318        self.request = self.request.query("title_search", query.into());
319        self
320    }
321
322    /// Filter by tag IDs.
323    pub fn tag_id(mut self, tag_ids: impl IntoIterator<Item = i64>) -> Self {
324        self.request = self.request.query_many("tag_id", tag_ids);
325        self
326    }
327
328    /// Filter by tag slug.
329    pub fn tag_slug(mut self, slug: impl Into<String>) -> Self {
330        self.request = self.request.query("tag_slug", slug.into());
331        self
332    }
333
334    /// Set minimum liquidity threshold.
335    pub fn liquidity_min(mut self, min: f64) -> Self {
336        self.request = self.request.query("liquidity_min", min);
337        self
338    }
339
340    /// Set maximum liquidity threshold.
341    pub fn liquidity_max(mut self, max: f64) -> Self {
342        self.request = self.request.query("liquidity_max", max);
343        self
344    }
345
346    /// Set minimum trading volume.
347    pub fn volume_min(mut self, min: f64) -> Self {
348        self.request = self.request.query("volume_min", min);
349        self
350    }
351
352    /// Set maximum trading volume.
353    pub fn volume_max(mut self, max: f64) -> Self {
354        self.request = self.request.query("volume_max", max);
355        self
356    }
357
358    /// Filter to create-your-own-market events.
359    pub fn cyom(mut self, cyom: bool) -> Self {
360        self.request = self.request.query("cyom", cyom);
361        self
362    }
363
364    /// Filter by minimum start date (RFC3339).
365    pub fn start_date_min(mut self, date: impl Into<String>) -> Self {
366        self.request = self.request.query("start_date_min", date.into());
367        self
368    }
369
370    /// Filter by maximum start date (RFC3339).
371    pub fn start_date_max(mut self, date: impl Into<String>) -> Self {
372        self.request = self.request.query("start_date_max", date.into());
373        self
374    }
375
376    /// Filter by minimum end date (RFC3339).
377    pub fn end_date_min(mut self, date: impl Into<String>) -> Self {
378        self.request = self.request.query("end_date_min", date.into());
379        self
380    }
381
382    /// Filter by maximum end date (RFC3339).
383    pub fn end_date_max(mut self, date: impl Into<String>) -> Self {
384        self.request = self.request.query("end_date_max", date.into());
385        self
386    }
387
388    /// Filter by minimum game start time (RFC3339).
389    pub fn start_time_min(mut self, time: impl Into<String>) -> Self {
390        self.request = self.request.query("start_time_min", time.into());
391        self
392    }
393
394    /// Filter by maximum game start time (RFC3339).
395    pub fn start_time_max(mut self, time: impl Into<String>) -> Self {
396        self.request = self.request.query("start_time_max", time.into());
397        self
398    }
399
400    /// Exclude events carrying any of these tag IDs.
401    pub fn exclude_tag_id(mut self, tag_ids: impl IntoIterator<Item = i64>) -> Self {
402        self.request = self.request.query_many("exclude_tag_id", tag_ids);
403        self
404    }
405
406    /// Include events matching related tags.
407    pub fn related_tags(mut self, include: bool) -> Self {
408        self.request = self.request.query("related_tags", include);
409        self
410    }
411
412    /// Tag matching mode.
413    pub fn tag_match(mut self, mode: impl Into<String>) -> Self {
414        self.request = self.request.query("tag_match", mode.into());
415        self
416    }
417
418    /// Filter by series IDs.
419    pub fn series_id(mut self, series_ids: impl IntoIterator<Item = i64>) -> Self {
420        self.request = self.request.query_many("series_id", series_ids);
421        self
422    }
423
424    /// Filter by game IDs.
425    pub fn game_id(mut self, game_ids: impl IntoIterator<Item = i64>) -> Self {
426        self.request = self.request.query_many("game_id", game_ids);
427        self
428    }
429
430    /// Filter by event date (RFC3339).
431    pub fn event_date(mut self, date: impl Into<String>) -> Self {
432        self.request = self.request.query("event_date", date.into());
433        self
434    }
435
436    /// Filter by event week number.
437    pub fn event_week(mut self, week: i64) -> Self {
438        self.request = self.request.query("event_week", week);
439        self
440    }
441
442    /// Order results by the featured ranking.
443    pub fn featured_order(mut self, featured_order: bool) -> Self {
444        self.request = self.request.query("featured_order", featured_order);
445        self
446    }
447
448    /// Filter by recurrence.
449    pub fn recurrence(mut self, recurrence: impl Into<String>) -> Self {
450        self.request = self.request.query("recurrence", recurrence.into());
451        self
452    }
453
454    /// Filter by creator addresses.
455    pub fn created_by(mut self, creators: impl IntoIterator<Item = impl ToString>) -> Self {
456        self.request = self.request.query_many("created_by", creators);
457        self
458    }
459
460    /// Filter to children of a specific parent event.
461    pub fn parent_event_id(mut self, parent_event_id: i64) -> Self {
462        self.request = self.request.query("parent_event_id", parent_event_id);
463        self
464    }
465
466    /// Include child events in the response.
467    pub fn include_children(mut self, include: bool) -> Self {
468        self.request = self.request.query("include_children", include);
469        self
470    }
471
472    /// Attach `external_partners` for the given partner slug.
473    pub fn partner_slug(mut self, slug: impl Into<String>) -> Self {
474        self.request = self.request.query("partner_slug", slug.into());
475        self
476    }
477
478    /// Include chat data in the response.
479    pub fn include_chat(mut self, include: bool) -> Self {
480        self.request = self.request.query("include_chat", include);
481        self
482    }
483
484    /// Include template data in the response.
485    pub fn include_template(mut self, include: bool) -> Self {
486        self.request = self.request.query("include_template", include);
487        self
488    }
489
490    /// Include the `BestLines` relation in the response.
491    pub fn include_best_lines(mut self, include: bool) -> Self {
492        self.request = self.request.query("include_best_lines", include);
493        self
494    }
495
496    /// Set the response locale.
497    pub fn locale(mut self, locale: impl Into<String>) -> Self {
498        self.request = self.request.query("locale", locale.into());
499        self
500    }
501
502    // Note: `/events/keyset` documents `offset` as "Not allowed. Returns 422 if
503    // provided." — it is deliberately not exposed here. Page with
504    // [`after_cursor`](Self::after_cursor) instead.
505
506    /// Execute the request.
507    pub async fn send(self) -> Result<KeysetEventsResponse, GammaError> {
508        self.request.send().await
509    }
510}
511
512/// Request builder for getting a single event
513pub struct GetEvent {
514    request: Request<Event, GammaError>,
515}
516
517impl GetEvent {
518    /// Include chat data in response
519    pub fn include_chat(mut self, include: bool) -> Self {
520        self.request = self.request.query("include_chat", include);
521        self
522    }
523
524    /// Include template data in response
525    pub fn include_template(mut self, include: bool) -> Self {
526        self.request = self.request.query("include_template", include);
527        self
528    }
529
530    /// Execute the request
531    pub async fn send(self) -> Result<Event, GammaError> {
532        self.request.send().await
533    }
534}
535
536/// Request builder for listing events
537pub struct ListEvents {
538    request: Request<Vec<Event>, GammaError>,
539}
540
541impl ListEvents {
542    /// Set maximum number of results (minimum: 0)
543    pub fn limit(mut self, limit: u32) -> Self {
544        self.request = self.request.query("limit", limit);
545        self
546    }
547
548    /// Set pagination offset (minimum: 0)
549    pub fn offset(mut self, offset: u32) -> Self {
550        self.request = self.request.query("offset", offset);
551        self
552    }
553
554    /// Set order fields (comma-separated list)
555    pub fn order(mut self, order: impl Into<String>) -> Self {
556        self.request = self.request.query("order", order.into());
557        self
558    }
559
560    /// Set sort direction
561    pub fn ascending(mut self, ascending: bool) -> Self {
562        self.request = self.request.query("ascending", ascending);
563        self
564    }
565
566    /// Filter by specific event IDs
567    ///
568    /// Safe batch size: ≤ 400 per request. URLs over ~8 KB are rejected
569    /// upstream with `414 URI Too Long`.
570    pub fn id(mut self, ids: impl IntoIterator<Item = i64>) -> Self {
571        self.request = self.request.query_many("id", ids);
572        self
573    }
574
575    /// Filter by tag identifier
576    pub fn tag_id(mut self, tag_id: i64) -> Self {
577        self.request = self.request.query("tag_id", tag_id);
578        self
579    }
580
581    /// Exclude events with specified tag IDs
582    ///
583    /// Safe batch size: ≤ 500 per request. Tag IDs are short integers
584    /// (~5 B/entry); URLs over ~8 KB are rejected upstream with `414`.
585    pub fn exclude_tag_id(mut self, tag_ids: impl IntoIterator<Item = i64>) -> Self {
586        self.request = self.request.query_many("exclude_tag_id", tag_ids);
587        self
588    }
589
590    /// Filter by event slugs
591    ///
592    /// Safe batch size: ≤ 100 per request. URL length is capped at ~8 KB
593    /// upstream; slug entries vary so pick a cap based on your longest slug.
594    pub fn slug(mut self, slugs: impl IntoIterator<Item = impl ToString>) -> Self {
595        self.request = self.request.query_many("slug", slugs);
596        self
597    }
598
599    /// Filter by tag slug
600    pub fn tag_slug(mut self, slug: impl Into<String>) -> Self {
601        self.request = self.request.query("tag_slug", slug.into());
602        self
603    }
604
605    /// Include related tags in response
606    pub fn related_tags(mut self, include: bool) -> Self {
607        self.request = self.request.query("related_tags", include);
608        self
609    }
610
611    /// Filter active events only
612    pub fn active(mut self, active: bool) -> Self {
613        self.request = self.request.query("active", active);
614        self
615    }
616
617    /// Filter archived events
618    pub fn archived(mut self, archived: bool) -> Self {
619        self.request = self.request.query("archived", archived);
620        self
621    }
622
623    /// Filter featured events
624    pub fn featured(mut self, featured: bool) -> Self {
625        self.request = self.request.query("featured", featured);
626        self
627    }
628
629    /// Filter create-your-own-market events
630    pub fn cyom(mut self, cyom: bool) -> Self {
631        self.request = self.request.query("cyom", cyom);
632        self
633    }
634
635    /// Include chat data in response
636    pub fn include_chat(mut self, include: bool) -> Self {
637        self.request = self.request.query("include_chat", include);
638        self
639    }
640
641    /// Include template data
642    pub fn include_template(mut self, include: bool) -> Self {
643        self.request = self.request.query("include_template", include);
644        self
645    }
646
647    /// Filter by recurrence pattern
648    pub fn recurrence(mut self, recurrence: impl Into<String>) -> Self {
649        self.request = self.request.query("recurrence", recurrence.into());
650        self
651    }
652
653    /// Filter closed events
654    pub fn closed(mut self, closed: bool) -> Self {
655        self.request = self.request.query("closed", closed);
656        self
657    }
658
659    /// Set minimum liquidity threshold
660    pub fn liquidity_min(mut self, min: f64) -> Self {
661        self.request = self.request.query("liquidity_min", min);
662        self
663    }
664
665    /// Set maximum liquidity threshold
666    pub fn liquidity_max(mut self, max: f64) -> Self {
667        self.request = self.request.query("liquidity_max", max);
668        self
669    }
670
671    /// Set minimum trading volume
672    pub fn volume_min(mut self, min: f64) -> Self {
673        self.request = self.request.query("volume_min", min);
674        self
675    }
676
677    /// Set maximum trading volume
678    pub fn volume_max(mut self, max: f64) -> Self {
679        self.request = self.request.query("volume_max", max);
680        self
681    }
682
683    /// Set earliest start date (ISO 8601 format)
684    pub fn start_date_min(mut self, date: impl Into<String>) -> Self {
685        self.request = self.request.query("start_date_min", date.into());
686        self
687    }
688
689    /// Set latest start date (ISO 8601 format)
690    pub fn start_date_max(mut self, date: impl Into<String>) -> Self {
691        self.request = self.request.query("start_date_max", date.into());
692        self
693    }
694
695    /// Set earliest end date (ISO 8601 format)
696    pub fn end_date_min(mut self, date: impl Into<String>) -> Self {
697        self.request = self.request.query("end_date_min", date.into());
698        self
699    }
700
701    /// Set latest end date (ISO 8601 format)
702    pub fn end_date_max(mut self, date: impl Into<String>) -> Self {
703        self.request = self.request.query("end_date_max", date.into());
704        self
705    }
706
707    /// Execute the request
708    pub async fn send(self) -> Result<Vec<Event>, GammaError> {
709        self.request.send().await
710    }
711}
712
713#[cfg(test)]
714mod tests {
715    use crate::Gamma;
716
717    fn gamma() -> Gamma {
718        Gamma::new().unwrap()
719    }
720
721    /// Verify that all event builder methods chain correctly
722    #[test]
723    fn test_list_events_full_chain() {
724        let _list = gamma()
725            .events()
726            .list()
727            .limit(10)
728            .offset(20)
729            .order("volume")
730            .ascending(true)
731            .id(vec![1i64, 2])
732            .tag_id(42)
733            .exclude_tag_id(vec![99i64])
734            .slug(vec!["slug-a"])
735            .tag_slug("politics")
736            .related_tags(true)
737            .active(true)
738            .archived(false)
739            .featured(true)
740            .cyom(false)
741            .include_chat(true)
742            .include_template(false)
743            .recurrence("daily")
744            .closed(false)
745            .liquidity_min(1000.0)
746            .liquidity_max(50000.0)
747            .volume_min(100.0)
748            .volume_max(10000.0)
749            .start_date_min("2024-01-01")
750            .start_date_max("2025-01-01")
751            .end_date_min("2024-06-01")
752            .end_date_max("2025-12-31");
753    }
754
755    #[test]
756    fn test_get_event_accepts_str_and_string() {
757        let _req1 = gamma().events().get("evt-123");
758        let _req2 = gamma().events().get(String::from("evt-123"));
759    }
760
761    #[test]
762    fn test_get_by_slug_accepts_str_and_string() {
763        let _req1 = gamma().events().get_by_slug("slug");
764        let _req2 = gamma().events().get_by_slug(String::from("slug"));
765    }
766
767    #[test]
768    fn test_get_event_with_query_params() {
769        let _req = gamma()
770            .events()
771            .get("evt-123")
772            .include_chat(true)
773            .include_template(false);
774    }
775
776    #[test]
777    fn test_event_tags_accepts_str_and_string() {
778        let _req1 = gamma().events().tags("evt-123");
779        let _req2 = gamma().events().tags(String::from("evt-123"));
780    }
781
782    #[test]
783    fn test_event_tweet_count() {
784        let _req = gamma().events().tweet_count("evt-123");
785    }
786
787    #[test]
788    fn test_event_comment_count() {
789        let _req = gamma().events().comment_count("evt-123");
790    }
791
792    #[test]
793    fn test_list_creators_full_chain() {
794        let _req = gamma()
795            .events()
796            .list_creators()
797            .limit(10)
798            .offset(0)
799            .order("createdAt")
800            .ascending(true)
801            .creator_name("poly")
802            .creator_handle("polymarket");
803    }
804
805    #[test]
806    fn test_get_creator_accepts_str_and_string() {
807        let _req1 = gamma().events().get_creator("c-1");
808        let _req2 = gamma().events().get_creator(String::from("c-1"));
809    }
810
811    #[test]
812    fn test_list_paginated_full_chain() {
813        let _req = gamma()
814            .events()
815            .list_paginated()
816            .limit(25)
817            .offset(50)
818            .order("startDate")
819            .ascending(false)
820            .include_chat(false)
821            .include_template(true)
822            .recurrence("daily");
823    }
824
825    #[test]
826    fn test_list_results_full_chain() {
827        let _req = gamma()
828            .events()
829            .list_results()
830            .limit(5)
831            .offset(0)
832            .order("endDate")
833            .ascending(true);
834    }
835
836    #[test]
837    fn test_list_keyset_full_chain() {
838        let _req = gamma()
839            .events()
840            .list_keyset()
841            .limit(50)
842            .order("volume_num")
843            .ascending(true)
844            .after_cursor("abc")
845            .id(vec![1i64, 2])
846            .slug(vec!["slug-a"])
847            .closed(false)
848            .live(true)
849            .featured(true)
850            .title_search("bitcoin")
851            .tag_id(vec![42i64])
852            .tag_slug("politics")
853            .liquidity_min(0.0)
854            .liquidity_max(1e6)
855            .volume_min(0.0)
856            .volume_max(1e6);
857    }
858}