botfair/
generated_methods.rs

1//! # automatically generated
2//! This module has been automatically generated by botfair
3//! from the Betfair APING documentation at
4//! https://docs.developer.betfair.com
5//!
6//! Any documentation here has been generated directly from the API
7//! docs.
8
9#![allow(non_snake_case)]
10use crate::generated_requests::*;
11use crate::generated_types::*;
12use crate::json_rpc::RpcRequest;
13use crate::result::Result;
14use chrono::{DateTime, Utc};
15impl crate::client::BFClient {
16    /// Returns a list of Event Types (i.e. Sports) associated with the markets selected by the MarketFilter.
17    #[allow(dead_code)]
18    pub fn listEventTypes(
19        &self,
20        filter: MarketFilter,
21        locale: Option<String>,
22    ) -> Result<Vec<EventTypeResult>> {
23        let req: listEventTypesRequest =
24            listEventTypesRequest { filter, locale };
25        let rpc_request: RpcRequest<listEventTypesRequest> =
26            RpcRequest::new("SportsAPING/v1.0/listEventTypes".to_owned(), req);
27        self.req(rpc_request)
28    }
29    /// Returns a list of Competitions (i.e., World Cup 2013) associated with the markets selected by the MarketFilter. Currently only Football markets have an associated competition.
30    #[allow(dead_code)]
31    pub fn listCompetitions(
32        &self,
33        filter: MarketFilter,
34        locale: Option<String>,
35    ) -> Result<Vec<CompetitionResult>> {
36        let req: listCompetitionsRequest =
37            listCompetitionsRequest { filter, locale };
38        let rpc_request: RpcRequest<listCompetitionsRequest> = RpcRequest::new(
39            "SportsAPING/v1.0/listCompetitions".to_owned(),
40            req,
41        );
42        self.req(rpc_request)
43    }
44    /// Returns a list of time ranges in the granularity specified in the request (i.e. 3PM to 4PM, Aug 14th to Aug 15th) associated with the markets selected by the MarketFilter.
45    #[allow(dead_code)]
46    pub fn listTimeRanges(
47        &self,
48        filter: MarketFilter,
49        granularity: TimeGranularity,
50    ) -> Result<Vec<TimeRangeResult>> {
51        let req: listTimeRangesRequest = listTimeRangesRequest {
52            filter,
53            granularity,
54        };
55        let rpc_request: RpcRequest<listTimeRangesRequest> =
56            RpcRequest::new("SportsAPING/v1.0/listTimeRanges".to_owned(), req);
57        self.req(rpc_request)
58    }
59    /// Returns a list of Events (i.e, Reading vs. Man United) associated with the markets selected by the MarketFilter.
60    #[allow(dead_code)]
61    pub fn listEvents(
62        &self,
63        filter: MarketFilter,
64        locale: Option<String>,
65    ) -> Result<Vec<EventResult>> {
66        let req: listEventsRequest = listEventsRequest { filter, locale };
67        let rpc_request: RpcRequest<listEventsRequest> =
68            RpcRequest::new("SportsAPING/v1.0/listEvents".to_owned(), req);
69        self.req(rpc_request)
70    }
71    /// Returns a list of market types (i.e. MATCH_ODDS, NEXT_GOAL) associated with the markets selected by the MarketFilter. The market types are always the same, regardless of locale.
72    #[allow(dead_code)]
73    pub fn listMarketTypes(
74        &self,
75        filter: MarketFilter,
76        locale: Option<String>,
77    ) -> Result<Vec<MarketTypeResult>> {
78        let req: listMarketTypesRequest =
79            listMarketTypesRequest { filter, locale };
80        let rpc_request: RpcRequest<listMarketTypesRequest> = RpcRequest::new(
81            "SportsAPING/v1.0/listMarketTypes".to_owned(),
82            req,
83        );
84        self.req(rpc_request)
85    }
86    /// Returns a list of Countries associated with the markets selected by the MarketFilter.
87    #[allow(dead_code)]
88    pub fn listCountries(
89        &self,
90        filter: MarketFilter,
91        locale: Option<String>,
92    ) -> Result<Vec<CountryCodeResult>> {
93        let req: listCountriesRequest =
94            listCountriesRequest { filter, locale };
95        let rpc_request: RpcRequest<listCountriesRequest> =
96            RpcRequest::new("SportsAPING/v1.0/listCountries".to_owned(), req);
97        self.req(rpc_request)
98    }
99    /// Returns a list of Venues (i.e. Cheltenham, Ascot) associated with the markets selected by the MarketFilter. Currently, only Horse Racing markets are associated with a Venue.
100    #[allow(dead_code)]
101    pub fn listVenues(
102        &self,
103        filter: MarketFilter,
104        locale: Option<String>,
105    ) -> Result<Vec<VenueResult>> {
106        let req: listVenuesRequest = listVenuesRequest { filter, locale };
107        let rpc_request: RpcRequest<listVenuesRequest> =
108            RpcRequest::new("SportsAPING/v1.0/listVenues".to_owned(), req);
109        self.req(rpc_request)
110    }
111    /// Returns a list of information about markets that does not change (or changes very rarely). You use listMarketCatalogue to retrieve the name of the market, the names of selections and other information about markets.
112    #[allow(dead_code)]
113    pub fn listMarketCatalogue(
114        &self,
115        filter: MarketFilter,
116        marketProjection: Option<Vec<MarketProjection>>,
117        sort: Option<MarketSort>,
118        maxResults: i32,
119        locale: Option<String>,
120    ) -> Result<Vec<MarketCatalogue>> {
121        let req: listMarketCatalogueRequest = listMarketCatalogueRequest {
122            filter,
123            marketProjection,
124            sort,
125            maxResults,
126            locale,
127        };
128        let rpc_request: RpcRequest<listMarketCatalogueRequest> =
129            RpcRequest::new(
130                "SportsAPING/v1.0/listMarketCatalogue".to_owned(),
131                req,
132            );
133        self.req(rpc_request)
134    }
135    /// Returns a list of dynamic data about markets. Dynamic data includes prices, the status of the market, the status of selections, the traded volume, and the status of any orders you have placed in the market.
136    #[allow(dead_code)]
137    pub fn listMarketBook(
138        &self,
139        marketIds: Vec<MarketId>,
140        priceProjection: Option<PriceProjection>,
141        orderProjection: Option<OrderProjection>,
142        matchProjection: Option<MatchProjection>,
143        includeOverallPosition: Option<bool>,
144        partitionMatchedByStrategyRef: Option<bool>,
145        customerStrategyRefs: Option<Vec<String>>,
146        currencyCode: Option<String>,
147        locale: Option<String>,
148        matchedSince: Option<DateTime<Utc>>,
149        betIds: Option<Vec<BetId>>,
150    ) -> Result<Vec<MarketBook>> {
151        let req: listMarketBookRequest = listMarketBookRequest {
152            marketIds,
153            priceProjection,
154            orderProjection,
155            matchProjection,
156            includeOverallPosition,
157            partitionMatchedByStrategyRef,
158            customerStrategyRefs,
159            currencyCode,
160            locale,
161            matchedSince,
162            betIds,
163        };
164        let rpc_request: RpcRequest<listMarketBookRequest> =
165            RpcRequest::new("SportsAPING/v1.0/listMarketBook".to_owned(), req);
166        self.req(rpc_request)
167    }
168    /// Returns a list of dynamic data about a market and a specified runner. Dynamic data includes prices, the status of the market, the status of selections, the traded volume, and the status of any orders you have placed in the market.
169    #[allow(dead_code)]
170    pub fn listRunnerBook(
171        &self,
172        marketId: MarketId,
173        selectionId: SelectionId,
174        handicap: Option<f64>,
175        priceProjection: Option<PriceProjection>,
176        orderProjection: Option<OrderProjection>,
177        matchProjection: Option<MatchProjection>,
178        includeOverallPosition: Option<bool>,
179        partitionMatchedByStrategyRef: Option<bool>,
180        customerStrategyRefs: Option<Vec<String>>,
181        currencyCode: Option<String>,
182        locale: Option<String>,
183        matchedSince: Option<DateTime<Utc>>,
184        betIds: Option<Vec<BetId>>,
185    ) -> Result<Vec<MarketBook>> {
186        let req: listRunnerBookRequest = listRunnerBookRequest {
187            marketId,
188            selectionId,
189            handicap,
190            priceProjection,
191            orderProjection,
192            matchProjection,
193            includeOverallPosition,
194            partitionMatchedByStrategyRef,
195            customerStrategyRefs,
196            currencyCode,
197            locale,
198            matchedSince,
199            betIds,
200        };
201        let rpc_request: RpcRequest<listRunnerBookRequest> =
202            RpcRequest::new("SportsAPING/v1.0/listRunnerBook".to_owned(), req);
203        self.req(rpc_request)
204    }
205    /// Returns a list of your current orders. Optionally you can filter and sort your current orders using the various parameters, setting none of the parameters will return all of your current orders, up to a maximum of 1000 bets, ordered BY_BET and sorted EARLIEST_TO_LATEST. To retrieve more than 1000 orders, you need to make use of the fromRecord and recordCount parameters.
206    #[allow(dead_code)]
207    pub fn listCurrentOrders(
208        &self,
209        betIds: Option<Vec<BetId>>,
210        marketIds: Option<Vec<MarketId>>,
211        orderProjection: Option<OrderProjection>,
212        customerOrderRefs: Option<Vec<CustomerOrderRef>>,
213        customerStrategyRefs: Option<Vec<CustomerStrategyRef>>,
214        placedDateRange: Option<TimeRange>,
215        dateRange: Option<TimeRange>,
216        orderBy: Option<OrderBy>,
217        sortDir: Option<SortDir>,
218        fromRecord: Option<i32>,
219        recordCount: Option<i32>,
220    ) -> Result<CurrentOrderSummaryReport> {
221        let req: listCurrentOrdersRequest = listCurrentOrdersRequest {
222            betIds,
223            marketIds,
224            orderProjection,
225            customerOrderRefs,
226            customerStrategyRefs,
227            placedDateRange,
228            dateRange,
229            orderBy,
230            sortDir,
231            fromRecord,
232            recordCount,
233        };
234        let rpc_request: RpcRequest<listCurrentOrdersRequest> =
235            RpcRequest::new(
236                "SportsAPING/v1.0/listCurrentOrders".to_owned(),
237                req,
238            );
239        self.req(rpc_request)
240    }
241    /// Returns a List of bets based on the bet status, ordered by settled date
242    #[allow(dead_code)]
243    pub fn listClearedOrders(
244        &self,
245        betStatus: BetStatus,
246        eventTypeIds: Option<Vec<EventTypeId>>,
247        eventIds: Option<Vec<EventId>>,
248        marketIds: Option<Vec<MarketId>>,
249        runnerIds: Option<Vec<RunnerId>>,
250        betIds: Option<Vec<BetId>>,
251        customerOrderRefs: Option<Vec<CustomerOrderRef>>,
252        customerStrategyRefs: Option<Vec<CustomerStrategyRef>>,
253        side: Option<Side>,
254        settledDateRange: Option<TimeRange>,
255        groupBy: Option<GroupBy>,
256        includeItemDescription: Option<bool>,
257        locale: Option<String>,
258        fromRecord: Option<i32>,
259        recordCount: Option<i32>,
260    ) -> Result<ClearedOrderSummaryReport> {
261        let req: listClearedOrdersRequest = listClearedOrdersRequest {
262            betStatus,
263            eventTypeIds,
264            eventIds,
265            marketIds,
266            runnerIds,
267            betIds,
268            customerOrderRefs,
269            customerStrategyRefs,
270            side,
271            settledDateRange,
272            groupBy,
273            includeItemDescription,
274            locale,
275            fromRecord,
276            recordCount,
277        };
278        let rpc_request: RpcRequest<listClearedOrdersRequest> =
279            RpcRequest::new(
280                "SportsAPING/v1.0/listClearedOrders".to_owned(),
281                req,
282            );
283        self.req(rpc_request)
284    }
285    /// Place new orders into market. LIMIT orders below the minimum bet size are allowed if there is an unmatched bet at the same price in the market. This operation is atomic in that all orders will be placed or none will be placed.
286    #[allow(dead_code)]
287    pub fn placeOrders(
288        &self,
289        marketId: MarketId,
290        instructions: Vec<PlaceInstruction>,
291        customerRef: Option<String>,
292        marketVersion: Option<MarketVersion>,
293        customerStrategyRef: Option<String>,
294        r#async: Option<bool>,
295    ) -> Result<PlaceExecutionReport> {
296        let req: placeOrdersRequest = placeOrdersRequest {
297            marketId,
298            instructions,
299            customerRef,
300            marketVersion,
301            customerStrategyRef,
302            r#async,
303        };
304        let rpc_request: RpcRequest<placeOrdersRequest> =
305            RpcRequest::new("SportsAPING/v1.0/placeOrders".to_owned(), req);
306        self.req(rpc_request)
307    }
308    /// Cancel all bets OR cancel all bets on a market OR fully or partially cancel particular orders on a market. Only LIMIT orders an be cancelled or partially cancelled once placed.
309    #[allow(dead_code)]
310    pub fn cancelOrders(
311        &self,
312        marketId: Option<MarketId>,
313        instructions: Option<Vec<CancelInstruction>>,
314        customerRef: Option<String>,
315    ) -> Result<CancelExecutionReport> {
316        let req: cancelOrdersRequest = cancelOrdersRequest {
317            marketId,
318            instructions,
319            customerRef,
320        };
321        let rpc_request: RpcRequest<cancelOrdersRequest> =
322            RpcRequest::new("SportsAPING/v1.0/cancelOrders".to_owned(), req);
323        self.req(rpc_request)
324    }
325    /// This operation is logically a bulk cancel followed by a bulk place. The cancel is completed first then the new orders are placed. The new orders will be placed atomically in that they will all be placed or none will be placed. In the case where the new orders cannot be placed the cancellations will not be rolled back. See ReplaceInstruction.
326    #[allow(dead_code)]
327    pub fn replaceOrders(
328        &self,
329        marketId: MarketId,
330        instructions: Vec<ReplaceInstruction>,
331        customerRef: Option<String>,
332        marketVersion: Option<MarketVersion>,
333        r#async: Option<bool>,
334    ) -> Result<ReplaceExecutionReport> {
335        let req: replaceOrdersRequest = replaceOrdersRequest {
336            marketId,
337            instructions,
338            customerRef,
339            marketVersion,
340            r#async,
341        };
342        let rpc_request: RpcRequest<replaceOrdersRequest> =
343            RpcRequest::new("SportsAPING/v1.0/replaceOrders".to_owned(), req);
344        self.req(rpc_request)
345    }
346    /// Update non-exposure changing fields
347    #[allow(dead_code)]
348    pub fn updateOrders(
349        &self,
350        marketId: MarketId,
351        instructions: Vec<UpdateInstruction>,
352        customerRef: Option<String>,
353    ) -> Result<UpdateExecutionReport> {
354        let req: updateOrdersRequest = updateOrdersRequest {
355            marketId,
356            instructions,
357            customerRef,
358        };
359        let rpc_request: RpcRequest<updateOrdersRequest> =
360            RpcRequest::new("SportsAPING/v1.0/updateOrders".to_owned(), req);
361        self.req(rpc_request)
362    }
363    /// Retrieve profit and loss for a given list of markets. The values are calculated using matched bets and optionally settled bets. Only odds markets are implemented, markets of other types are silently ignored.
364    #[allow(dead_code)]
365    pub fn listMarketProfitAndLoss(
366        &self,
367        marketIds: Vec<MarketId>,
368        includeSettledBets: Option<bool>,
369        includeBspBets: Option<bool>,
370        netOfCommission: Option<bool>,
371    ) -> Result<Vec<MarketProfitAndLoss>> {
372        let req: listMarketProfitAndLossRequest =
373            listMarketProfitAndLossRequest {
374                marketIds,
375                includeSettledBets,
376                includeBspBets,
377                netOfCommission,
378            };
379        let rpc_request: RpcRequest<listMarketProfitAndLossRequest> =
380            RpcRequest::new(
381                "SportsAPING/v1.0/listMarketProfitAndLoss".to_owned(),
382                req,
383            );
384        self.req(rpc_request)
385    }
386    /// Create/update default exposure limit for market groups of given type. New value and breach action will be immediately applied to existing instances of this type (unless overridden using setExposureLimitForMarketGroup). If default values are overridden for market groups (using setExposureLimitForMarketGroup), overrides will NOT be touched. In order to clear this limit "removeDefaultExposureLimitForMarketGroups" operation should be used. It's not allowed to set default limit to an empty limit (see type ExposureLimit).
387    #[allow(dead_code)]
388    pub fn setDefaultExposureLimitForMarketGroups(
389        &self,
390        marketGroupType: MarketGroupType,
391        limit: ExposureLimit,
392    ) -> Result<String> {
393        let req: setDefaultExposureLimitForMarketGroupsRequest =
394            setDefaultExposureLimitForMarketGroupsRequest {
395                marketGroupType,
396                limit,
397            };
398        let rpc_request: RpcRequest<
399            setDefaultExposureLimitForMarketGroupsRequest,
400        > = RpcRequest::new(
401            "SportsAPING/v1.0/setDefaultExposureLimitForMarketGroups"
402                .to_owned(),
403            req,
404        );
405        self.req(rpc_request)
406    }
407    /// Create/update exposure limit for a market group. New limit will be applied immediately (even if a default limit exists for this type). The limit will be deleted upon account action (see deleteMarketGroupExposureLimit) or when no active markets remain under market group. It is possible to "invalidate" default limit for a specific group by using a "empty" limit (see type ExposureLimit). Upon successful execution of the request, the effective limit for this group will be the one set by this request (Properties will NOT be inherited from default limit).
408    #[allow(dead_code)]
409    pub fn setExposureLimitForMarketGroup(
410        &self,
411        marketGroup: MarketGroup,
412        limit: ExposureLimit,
413    ) -> Result<String> {
414        let req: setExposureLimitForMarketGroupRequest =
415            setExposureLimitForMarketGroupRequest { marketGroup, limit };
416        let rpc_request: RpcRequest<setExposureLimitForMarketGroupRequest> =
417            RpcRequest::new(
418                "SportsAPING/v1.0/setExposureLimitForMarketGroup".to_owned(),
419                req,
420            );
421        self.req(rpc_request)
422    }
423    /// Remove default exposure limit for a market group type. This operation will NOT remove/update any market group limits.
424    #[allow(dead_code)]
425    pub fn removeDefaultExposureLimitForMarketGroups(
426        &self,
427        marketGroupType: MarketGroupType,
428    ) -> Result<String> {
429        let req: removeDefaultExposureLimitForMarketGroupsRequest =
430            removeDefaultExposureLimitForMarketGroupsRequest {
431                marketGroupType,
432            };
433        let rpc_request: RpcRequest<
434            removeDefaultExposureLimitForMarketGroupsRequest,
435        > = RpcRequest::new(
436            "SportsAPING/v1.0/removeDefaultExposureLimitForMarketGroups"
437                .to_owned(),
438            req,
439        );
440        self.req(rpc_request)
441    }
442    /// Delete exposure limit for a market group. If a default exposure limit exist for market type, it takes effect immediately.
443    #[allow(dead_code)]
444    pub fn removeExposureLimitForMarketGroup(
445        &self,
446        marketGroup: MarketGroup,
447    ) -> Result<String> {
448        let req: removeExposureLimitForMarketGroupRequest =
449            removeExposureLimitForMarketGroupRequest { marketGroup };
450        let rpc_request: RpcRequest<removeExposureLimitForMarketGroupRequest> =
451            RpcRequest::new(
452                "SportsAPING/v1.0/removeExposureLimitForMarketGroup"
453                    .to_owned(),
454                req,
455            );
456        self.req(rpc_request)
457    }
458    /// Response to this request returns default group limit and group limits grouped by type. If marketGroupTypeFilter is not populated values for all types are returned. The response will always contain the default limit. It is possible to control which groups to return using marketGroupsFilter parameter. If marketGroupsFilter is not set all group limits are returned. If an emtpy list is passed only default limit(s) is returned. When marketGroupTypeFilter and marketGroupsFilter used together, all groups in marketGroupsFilter are required to be of same type (type used in marketGroupTypeFilter).
459    #[allow(dead_code)]
460    pub fn listExposureLimitsForMarketGroups(
461        &self,
462        marketGroupTypeFilter: Option<MarketGroupType>,
463        marketGroupFilter: Option<Vec<MarketGroup>>,
464    ) -> Result<Vec<ExposureLimitsForMarketGroups>> {
465        let req: listExposureLimitsForMarketGroupsRequest =
466            listExposureLimitsForMarketGroupsRequest {
467                marketGroupTypeFilter,
468                marketGroupFilter,
469            };
470        let rpc_request: RpcRequest<listExposureLimitsForMarketGroupsRequest> =
471            RpcRequest::new(
472                "SportsAPING/v1.0/listExposureLimitsForMarketGroups"
473                    .to_owned(),
474                req,
475            );
476        self.req(rpc_request)
477    }
478    /// Unblock a market group after it has been blocked due to the breach of a previously set exposure limit.
479    #[allow(dead_code)]
480    pub fn unblockMarketGroup(
481        &self,
482        marketGroup: MarketGroup,
483    ) -> Result<String> {
484        let req: unblockMarketGroupRequest =
485            unblockMarketGroupRequest { marketGroup };
486        let rpc_request: RpcRequest<unblockMarketGroupRequest> =
487            RpcRequest::new(
488                "SportsAPING/v1.0/unblockMarketGroup".to_owned(),
489                req,
490            );
491        self.req(rpc_request)
492    }
493    /// Retrieves events from exposure reuse enabled events list. To edit this list use addExposureReuseEnabledEvents and removeExposureReuseEnabledEvents operations.
494    #[allow(dead_code)]
495    pub fn getExposureReuseEnabledEvents(&self) -> Result<Vec<i64>> {
496        let rpc_request: RpcRequest<()> = RpcRequest::new(
497            "SportsAPING/v1.0/getExposureReuseEnabledEvents".to_owned(),
498            (),
499        );
500        self.req(rpc_request)
501    }
502    /// Enables events for exposure reuse by appending them to the current list of events already enabled.
503    #[allow(dead_code)]
504    pub fn addExposureReuseEnabledEvents(
505        &self,
506        eventIds: Vec<i64>,
507    ) -> Result<String> {
508        let req: addExposureReuseEnabledEventsRequest =
509            addExposureReuseEnabledEventsRequest { eventIds };
510        let rpc_request: RpcRequest<addExposureReuseEnabledEventsRequest> =
511            RpcRequest::new(
512                "SportsAPING/v1.0/addExposureReuseEnabledEvents".to_owned(),
513                req,
514            );
515        self.req(rpc_request)
516    }
517    /// Removes events from exposure reuse enabled events list.
518    #[allow(dead_code)]
519    pub fn removeExposureReuseEnabledEvents(
520        &self,
521        eventIds: Vec<i64>,
522    ) -> Result<String> {
523        let req: removeExposureReuseEnabledEventsRequest =
524            removeExposureReuseEnabledEventsRequest { eventIds };
525        let rpc_request: RpcRequest<removeExposureReuseEnabledEventsRequest> =
526            RpcRequest::new(
527                "SportsAPING/v1.0/removeExposureReuseEnabledEvents".to_owned(),
528                req,
529            );
530        self.req(rpc_request)
531    }
532}