@@ -9,7 +9,7 @@ use crate::{
99 ContainsChatMessage , ContainsChatMessages , ContainsEntries , ContainsEntry , ContainsRace ,
1010 ContainsRaces ,
1111 } ,
12- Attachment , ChatMessage , Client , Download , Entry , Error , Race , Visibility ,
12+ Attachment , ChatMessage , Client , DownloadSnafu , Entry , Error , Race , Visibility ,
1313} ;
1414use http:: { header:: CONTENT_TYPE , Request } ;
1515use snafu:: ResultExt ;
@@ -121,7 +121,9 @@ impl Attachment {
121121 )
122122 . await ?;
123123
124- recv_bytes ( response. into_body ( ) ) . await . context ( Download )
124+ recv_bytes ( response. into_body ( ) )
125+ . await
126+ . context ( DownloadSnafu )
125127 }
126128}
127129
@@ -145,7 +147,7 @@ pub async fn get(client: &Client, id: Uuid) -> Result<Race, Error> {
145147 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
146148 url. path_segments_mut ( )
147149 . unwrap ( )
148- . push ( id. to_hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ) ;
150+ . push ( id. hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ) ;
149151
150152 let ContainsRace { race } = get_json (
151153 client,
@@ -247,7 +249,7 @@ pub async fn update(
247249 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
248250 url. path_segments_mut ( )
249251 . unwrap ( )
250- . push ( id. to_hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ) ;
252+ . push ( id. hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ) ;
251253
252254 let ContainsRace { race } = get_json (
253255 client,
@@ -265,7 +267,7 @@ pub async fn update(
265267pub async fn get_entries ( client : & Client , id : Uuid ) -> Result < Vec < Entry > , Error > {
266268 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
267269 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
268- id. to_hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
270+ id. hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
269271 "entries" ,
270272 ] ) ;
271273
@@ -282,7 +284,7 @@ pub async fn get_entries(client: &Client, id: Uuid) -> Result<Vec<Entry>, Error>
282284pub async fn get_entry ( client : & Client , id : Uuid ) -> Result < Entry , Error > {
283285 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
284286 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
285- id. to_hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
287+ id. hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
286288 "entry" ,
287289 ] ) ;
288290
@@ -326,7 +328,7 @@ pub async fn join(
326328 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
327329 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
328330 race_id
329- . to_hyphenated ( )
331+ . hyphenated ( )
330332 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
331333 "entries" ,
332334 ] ) ;
@@ -357,11 +359,11 @@ pub async fn leave(client: &Client, race_id: Uuid, entry_id: Uuid) -> Result<(),
357359 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
358360 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
359361 race_id
360- . to_hyphenated ( )
362+ . hyphenated ( )
361363 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
362364 "entries" ,
363365 entry_id
364- . to_hyphenated ( )
366+ . hyphenated ( )
365367 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
366368 ] ) ;
367369
@@ -399,11 +401,11 @@ pub async fn ready_up(client: &Client, race_id: Uuid, entry_id: Uuid) -> Result<
399401 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
400402 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
401403 race_id
402- . to_hyphenated ( )
404+ . hyphenated ( )
403405 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
404406 "entries" ,
405407 entry_id
406- . to_hyphenated ( )
408+ . hyphenated ( )
407409 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
408410 ] ) ;
409411
@@ -431,11 +433,11 @@ pub async fn unready(client: &Client, race_id: Uuid, entry_id: Uuid) -> Result<E
431433 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
432434 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
433435 race_id
434- . to_hyphenated ( )
436+ . hyphenated ( )
435437 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
436438 "entries" ,
437439 entry_id
438- . to_hyphenated ( )
440+ . hyphenated ( )
439441 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
440442 ] ) ;
441443
@@ -461,11 +463,11 @@ pub async fn finish(client: &Client, race_id: Uuid, entry_id: Uuid) -> Result<En
461463 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
462464 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
463465 race_id
464- . to_hyphenated ( )
466+ . hyphenated ( )
465467 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
466468 "entries" ,
467469 entry_id
468- . to_hyphenated ( )
470+ . hyphenated ( )
469471 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
470472 ] ) ;
471473
@@ -493,11 +495,11 @@ pub async fn undo_finish(client: &Client, race_id: Uuid, entry_id: Uuid) -> Resu
493495 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
494496 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
495497 race_id
496- . to_hyphenated ( )
498+ . hyphenated ( )
497499 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
498500 "entries" ,
499501 entry_id
500- . to_hyphenated ( )
502+ . hyphenated ( )
501503 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
502504 ] ) ;
503505
@@ -523,11 +525,11 @@ pub async fn forfeit(client: &Client, race_id: Uuid, entry_id: Uuid) -> Result<E
523525 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
524526 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
525527 race_id
526- . to_hyphenated ( )
528+ . hyphenated ( )
527529 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
528530 "entries" ,
529531 entry_id
530- . to_hyphenated ( )
532+ . hyphenated ( )
531533 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
532534 ] ) ;
533535
@@ -555,11 +557,11 @@ pub async fn undo_forfeit(client: &Client, race_id: Uuid, entry_id: Uuid) -> Res
555557 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
556558 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
557559 race_id
558- . to_hyphenated ( )
560+ . hyphenated ( )
559561 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
560562 "entries" ,
561563 entry_id
562- . to_hyphenated ( )
564+ . hyphenated ( )
563565 . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
564566 ] ) ;
565567
@@ -584,7 +586,7 @@ pub async fn undo_forfeit(client: &Client, race_id: Uuid, entry_id: Uuid) -> Res
584586pub async fn get_chat ( client : & Client , id : Uuid ) -> Result < Vec < ChatMessage > , Error > {
585587 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
586588 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
587- id. to_hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
589+ id. hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
588590 "chat" ,
589591 ] ) ;
590592
@@ -615,7 +617,7 @@ pub async fn send_chat_message(
615617) -> Result < ChatMessage , Error > {
616618 let mut url = Url :: parse ( "https://splits.io/api/v4/races" ) . unwrap ( ) ;
617619 url. path_segments_mut ( ) . unwrap ( ) . extend ( & [
618- id. to_hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
620+ id. hyphenated ( ) . encode_lower ( & mut Uuid :: encode_buffer ( ) ) ,
619621 "chat" ,
620622 ] ) ;
621623
0 commit comments