cdg_api/requests/
param_chains.rs

1//! `param_chains` module
2//!
3//! Simply holds a macro that allows each Param model to call `build` methods for user ease
4
5use crate::cdg_types::*;
6use crate::param_models::*;
7
8/// Macro for constructing the chainables for a Param
9macro_rules! impl_builder {
10    ($struct_name:ident, { $($field:ident : $type:ty),* $(,)? }) => {
11        impl $struct_name {
12            $(
13                pub fn $field(mut self, value: $type) -> Self {
14                    self.$field = Some(value);
15                    self
16                }
17            )*
18        }
19    };
20}
21
22// Generic Params
23impl_builder!(GenericParams, {
24    format: FormatType,
25    offset: u32,
26    limit: u32,
27    from_date_time: String,
28    to_date_time: String,
29    sort: SortType,
30    conference: bool,
31    current_member: bool,
32    year: u32,
33    month: u32,
34    day: u32,
35    chamber: ChamberType,
36});
37
38// Bill Endpoints Parameters
39impl_builder!(BillListParams, {
40    format: FormatType,
41    offset: u32,
42    limit: u32,
43    from_date_time: String,
44    to_date_time: String,
45    sort: SortType,
46});
47
48impl_builder!(BillByCongressParams, {
49    format: FormatType,
50    offset: u32,
51    limit: u32,
52    from_date_time: String,
53    to_date_time: String,
54    sort: SortType,
55});
56
57impl_builder!(BillByTypeParams, {
58    format: FormatType,
59    offset: u32,
60    limit: u32,
61    from_date_time: String,
62    to_date_time: String,
63    sort: SortType,
64});
65
66impl_builder!(BillDetailsParams, {
67    format: FormatType,
68});
69
70impl_builder!(BillActionsParams, {
71    format: FormatType,
72    offset: u32,
73    limit: u32,
74});
75
76impl_builder!(BillAmendmentsParams, {
77    format: FormatType,
78    offset: u32,
79    limit: u32,
80});
81
82impl_builder!(BillCommitteesParams, {
83    format: FormatType,
84    offset: u32,
85    limit: u32,
86});
87
88impl_builder!(BillCosponsorsParams, {
89    format: FormatType,
90    offset: u32,
91    limit: u32,
92});
93
94impl_builder!(BillRelatedParams, {
95    format: FormatType,
96    offset: u32,
97    limit: u32,
98});
99
100impl_builder!(BillSubjectsParams, {
101    format: FormatType,
102    offset: u32,
103    limit: u32,
104    from_date_time: String,
105    to_date_time: String,
106});
107
108impl_builder!(BillSummariesParams, {
109    format: FormatType,
110    offset: u32,
111    limit: u32,
112});
113
114impl_builder!(BillTextParams, {
115    format: FormatType,
116    offset: u32,
117    limit: u32,
118});
119
120impl_builder!(BillTitlesParams, {
121    format: FormatType,
122    offset: u32,
123    limit: u32,
124    from_date_time: String,
125    to_date_time: String,
126});
127
128// Law Endpoints Parameters
129impl_builder!(LawParams, {
130    format: FormatType,
131    offset: u32,
132    limit: u32,
133});
134
135// Amendment Endpoints Parameters
136impl_builder!(AmendmentListParams, {
137    format: FormatType,
138    offset: u32,
139    limit: u32,
140    from_date_time: String,
141    to_date_time: String,
142    sort: SortType,
143});
144
145impl_builder!(AmendmentByCongressParams, {
146    format: FormatType,
147    offset: u32,
148    limit: u32,
149    from_date_time: String,
150    to_date_time: String,
151    sort: SortType,
152});
153
154impl_builder!(AmendmentByTypeParams, {
155    format: FormatType,
156    offset: u32,
157    limit: u32,
158    from_date_time: String,
159    to_date_time: String,
160    sort: SortType,
161});
162
163impl_builder!(AmendmentDetailsParams, {
164    format: FormatType,
165});
166
167impl_builder!(AmendmentActionsParams, {
168    format: FormatType,
169    offset: u32,
170    limit: u32,
171});
172
173impl_builder!(AmendmentCosponsorsParams, {
174    format: FormatType,
175    offset: u32,
176    limit: u32,
177});
178
179impl_builder!(AmendmentAmendmentsParams, {
180    format: FormatType,
181    offset: u32,
182    limit: u32,
183});
184
185impl_builder!(AmendmentTextParams, {
186    format: FormatType,
187});
188
189// Member Endpoints Parameters
190impl_builder!(MemberListParams, {
191    format: FormatType,
192    offset: u32,
193    limit: u32,
194    from_date_time: String,
195    to_date_time: String,
196    current_member: bool,
197});
198
199impl_builder!(MemberByStateParams, {
200    format: FormatType,
201    offset: u32,
202    limit: u32,
203    current_member: bool,
204});
205
206impl_builder!(MemberByCongressParams, {
207    format: FormatType,
208    offset: u32,
209    limit: u32,
210    current_member: bool,
211});
212
213impl_builder!(MemberByStateDistrictParams, {
214    format: FormatType,
215    offset: u32,
216    limit: u32,
217    current_member: bool,
218});
219
220impl_builder!(MemberByCongressStateDistrictParams, {
221    format: FormatType,
222    offset: u32,
223    limit: u32,
224    current_member: bool,
225});
226
227impl_builder!(MemberDetailsParams, {
228    format: FormatType,
229});
230
231impl_builder!(SponsorshipListParams, {
232    format: FormatType,
233    offset: u32,
234    limit: u32,
235});
236
237impl_builder!(CosponsorshipListParams, {
238    format: FormatType,
239    offset: u32,
240    limit: u32,
241});
242
243// Committee Endpoints Parameters
244impl_builder!(CommitteeListParams, {
245    format: FormatType,
246    offset: u32,
247    limit: u32,
248    from_date_time: String,
249    to_date_time: String,
250});
251
252impl_builder!(CommitteeByChamberParams, {
253    format: FormatType,
254    offset: u32,
255    limit: u32,
256    from_date_time: String,
257    to_date_time: String,
258});
259
260impl_builder!(CommitteeByCongressParams, {
261    format: FormatType,
262    offset: u32,
263    limit: u32,
264    from_date_time: String,
265    to_date_time: String,
266});
267
268impl_builder!(CommitteeByCongressChamberParams, {
269    format: FormatType,
270    offset: u32,
271    limit: u32,
272    from_date_time: String,
273    to_date_time: String,
274});
275
276impl_builder!(CommitteeDetailsParams, {
277    format: FormatType,
278});
279
280impl_builder!(CommitteeBillsParams, {
281    format: FormatType,
282    offset: u32,
283    limit: u32,
284});
285
286impl_builder!(CommitteeReportsParams, {
287    format: FormatType,
288    offset: u32,
289    limit: u32,
290});
291
292impl_builder!(CommitteeNominationsParams, {
293    format: FormatType,
294    offset: u32,
295    limit: u32,
296});
297
298impl_builder!(CommitteeHouseCommunicationParams, {
299    format: FormatType,
300    offset: u32,
301    limit: u32,
302});
303
304impl_builder!(CommitteeSenateCommunicationParams, {
305    format: FormatType,
306    offset: u32,
307    limit: u32,
308});
309
310// Committee Report Endpoints Parameters
311impl_builder!(CommitteeReportListParams, {
312    format: FormatType,
313    conference: bool,
314    offset: u32,
315    limit: u32,
316    from_date_time: String,
317    to_date_time: String,
318});
319
320impl_builder!(CommitteeReportByCongressParams, {
321    format: FormatType,
322    conference: bool,
323    offset: u32,
324    limit: u32,
325    from_date_time: String,
326    to_date_time: String,
327});
328
329impl_builder!(CommitteeReportByTypeParams, {
330    format: FormatType,
331    conference: bool,
332    offset: u32,
333    limit: u32,
334    from_date_time: String,
335    to_date_time: String,
336});
337
338impl_builder!(CommitteeReportDetailsParams, {
339    format: FormatType,
340});
341
342impl_builder!(CommitteeReportTextParams, {
343    format: FormatType,
344    offset: u32,
345    limit: u32,
346});
347
348// Committee Print Endpoints Parameters
349impl_builder!(CommitteePrintListParams, {
350    format: FormatType,
351    offset: u32,
352    limit: u32,
353    from_date_time: String,
354    to_date_time: String,
355});
356
357impl_builder!(CommitteePrintByCongressParams, {
358    format: FormatType,
359    offset: u32,
360    limit: u32,
361    from_date_time: String,
362    to_date_time: String,
363});
364
365impl_builder!(CommitteePrintByCongressChamberParams, {
366    format: FormatType,
367    offset: u32,
368    limit: u32,
369    from_date_time: String,
370    to_date_time: String,
371});
372
373impl_builder!(CommitteePrintByJacketNumberParams, {
374    format: FormatType,
375});
376
377impl_builder!(CommitteePrintDetailsParams, {
378    format: FormatType,
379    offset: u32,
380    limit: u32,
381});
382
383// Committee Meeting Endpoints Parameters
384impl_builder!(CommitteeMeetingListParams, {
385    format: FormatType,
386    offset: u32,
387    limit: u32,
388});
389
390impl_builder!(CommitteeMeetingByCongressParams, {
391    format: FormatType,
392    offset: u32,
393    limit: u32,
394});
395
396impl_builder!(CommitteeMeetingByChamberParams, {
397    format: FormatType,
398    offset: u32,
399    limit: u32,
400});
401
402impl_builder!(CommitteeMeetingByEventParams, {
403    format: FormatType,
404});
405
406// Hearing Endpoints Parameters
407impl_builder!(HearingListParams, {
408    format: FormatType,
409    offset: u32,
410    limit: u32,
411});
412
413impl_builder!(HearingByCongressParams, {
414    format: FormatType,
415    offset: u32,
416    limit: u32,
417});
418
419impl_builder!(HearingByChamberParams, {
420    format: FormatType,
421    offset: u32,
422    limit: u32,
423});
424
425impl_builder!(HearingByJacketNumberParams, {
426    format: FormatType,
427});
428
429// Congressional Record Endpoints Parameters
430impl_builder!(CongressionalRecordListParams, {
431    format: FormatType,
432    year: u32,
433    month: u32,
434    day: u32,
435    offset: u32,
436    limit: u32,
437});
438
439// Daily Congressional Record Endpoints Parameters
440impl_builder!(DailyCongressionalRecordListParams, {
441    format: FormatType,
442    offset: u32,
443    limit: u32,
444});
445
446impl_builder!(DailyCongressionalVolumeNumberParams, {
447    format: FormatType,
448    offset: u32,
449    limit: u32,
450});
451
452impl_builder!(DailyCongressionalVolumeNumberIssueNumberParams, {
453    format: FormatType,
454    offset: u32,
455    limit: u32,
456});
457
458// Bound Congressional Record Endpoints Parameters
459impl_builder!(BoundCongressionalRecordParams, {
460    format: FormatType,
461    offset: u32,
462    limit: u32,
463});
464
465// House Requirement Endpoints Parameters
466impl_builder!(RequirementParams, {
467    format: FormatType,
468    offset: u32,
469    limit: u32,
470});
471
472impl_builder!(RequirementDetailsParams, {
473    format: FormatType,
474});
475
476// House and Senate Communication Endpoints Parameters
477impl_builder!(CommunicationParams, {
478    format: FormatType,
479    offset: u32,
480    limit: u32,
481});
482
483impl_builder!(CommunicationDetailsParams, {
484    format: FormatType,
485});
486
487// Nomination Endpoints Parameters
488impl_builder!(NominationListParams, {
489    format: FormatType,
490    offset: u32,
491    limit: u32,
492    from_date_time: String,
493    to_date_time: String,
494    sort: SortType,
495});
496
497impl_builder!(NominationByCongressParams, {
498    format: FormatType,
499    offset: u32,
500    limit: u32,
501    from_date_time: String,
502    to_date_time: String,
503    sort: SortType,
504});
505
506impl_builder!(NominationDetailsParams, {
507    format: FormatType,
508});
509
510impl_builder!(NomineesParams, {
511    format: FormatType,
512    offset: u32,
513    limit: u32,
514});
515
516impl_builder!(NominationActionsParams, {
517    format: FormatType,
518    offset: u32,
519    limit: u32,
520});
521
522impl_builder!(NominationCommitteesParams, {
523    format: FormatType,
524    offset: u32,
525    limit: u32,
526});
527
528impl_builder!(NominationHearingsParams, {
529    format: FormatType,
530    offset: u32,
531    limit: u32,
532});
533
534// Treaty Endpoints Parameters
535impl_builder!(TreatyListParams, {
536    format: FormatType,
537    offset: u32,
538    limit: u32,
539    from_date_time: String,
540    to_date_time: String,
541    sort: SortType,
542});
543
544impl_builder!(TreatyByCongressParams, {
545    format: FormatType,
546    offset: u32,
547    limit: u32,
548    from_date_time: String,
549    to_date_time: String,
550    sort: SortType,
551});
552
553impl_builder!(TreatyDetailsParams, {
554    format: FormatType,
555});
556
557impl_builder!(TreatyPartitionedParams, {
558    format: FormatType,
559});
560
561impl_builder!(TreatyCommitteesParams, {
562    format: FormatType,
563    offset: u32,
564    limit: u32,
565});
566
567impl_builder!(TreatyActionsParams, {
568    format: FormatType,
569    offset: u32,
570    limit: u32,
571});
572
573// Summaries Endpoints Parameters
574impl_builder!(SummariesListParams, {
575    format: FormatType,
576    offset: u32,
577    limit: u32,
578    from_date_time: String,
579    to_date_time: String,
580    sort: SortType,
581});
582
583impl_builder!(SummariesByCongressParams, {
584    format: FormatType,
585    offset: u32,
586    limit: u32,
587    from_date_time: String,
588    to_date_time: String,
589    sort: SortType,
590});
591
592impl_builder!(SummariesByTypeParams, {
593    format: FormatType,
594    offset: u32,
595    limit: u32,
596    from_date_time: String,
597    to_date_time: String,
598    sort: SortType,
599});
600
601// Congress Endpoints Parameters
602impl_builder!(CongressListParams, {
603    format: FormatType,
604    offset: u32,
605    limit: u32,
606});
607
608impl_builder!(CongressDetailsParams, {
609    format: FormatType,
610});
611
612impl_builder!(CongressCurrentParams, {
613    format: FormatType,
614    offset: u32,
615    limit: u32,
616});