@@ -369,20 +369,21 @@ impl LineBot {
369369 & self ,
370370 description : & str ,
371371 request_id : i64 ,
372- click_url : Option < & str > ,
372+ click_url : Option < String > ,
373373 ) -> Result < Response , Error > {
374- let mut url: & str = "" ;
375- match click_url {
376- Some ( v) => url = v,
377- None => { }
374+ #[ derive( Serialize ) ]
375+ struct Data {
376+ description : String ,
377+ #[ serde( rename = "requestId" ) ]
378+ request_id : i64 ,
379+ #[ serde( rename = "clickUrl" , skip_serializing_if = "Option::is_none" ) ]
380+ click_url : Option < String > ,
378381 }
379- let data: Value = json ! (
380- {
381- "description" : description,
382- "requestId" : request_id,
383- "clickUrl" : url
384- }
385- ) ;
382+ let data: Value = json ! ( Data {
383+ description: String :: from( description) ,
384+ request_id: request_id,
385+ click_url: click_url,
386+ } ) ;
386387 self . http_client . post ( "/audienceGroup/click" , data)
387388 }
388389
@@ -442,10 +443,33 @@ impl LineBot {
442443 }
443444
444445 // TODO: https://developers.line.biz/ja/reference/messaging-api/#get-audience-groups
445- pub fn get_many_audience_information ( & self ) -> Result < Response , Error > {
446- // dataの処理・引数を増やす
446+ pub fn get_many_audience_information (
447+ & self ,
448+ page : & str ,
449+ description : Option < & str > ,
450+ status : Option < & str > ,
451+ size : Option < & str > ,
452+ includes_external_public_groups : Option < & str > ,
453+ create_route : Option < & str > ,
454+ ) -> Result < Response , Error > {
455+ let mut query: Vec < ( & str , & str ) > = vec ! [ ( "page" , page) ] ;
456+ if let Some ( v) = description {
457+ & query. push ( ( "description" , v) ) ;
458+ }
459+ if let Some ( v) = status {
460+ & query. push ( ( "status" , v) ) ;
461+ }
462+ if let Some ( v) = size {
463+ & query. push ( ( "size" , v) ) ;
464+ }
465+ if let Some ( v) = includes_external_public_groups {
466+ & query. push ( ( "includesExternalPublicGroups" , v) ) ;
467+ }
468+ if let Some ( v) = create_route {
469+ & query. push ( ( "createRoute" , v) ) ;
470+ }
447471 self . http_client
448- . get ( "/audienceGroup/list" , vec ! [ ] , json ! ( { } ) )
472+ . get ( "/audienceGroup/list" , query , json ! ( { } ) )
449473 }
450474
451475 pub fn get_audience_authority_level ( & self ) -> Result < Response , Error > {
@@ -473,7 +497,7 @@ impl LineBot {
473497 )
474498 }
475499
476- pub fn get_number_of_followes ( & self , date : NaiveDate ) -> Result < Response , Error > {
500+ pub fn get_number_of_followers ( & self , date : NaiveDate ) -> Result < Response , Error > {
477501 self . http_client . get (
478502 "/bot/insight/followers" ,
479503 vec ! [ ( "date" , & date. format( "%Y%m%d" ) . to_string( ) ) ] ,
@@ -495,12 +519,9 @@ impl LineBot {
495519 }
496520
497521 pub fn get_follower_ids ( & self , continuation_token : Option < & str > ) -> Result < Response , Error > {
498- let mut query: Vec < ( & str , & str ) > = Vec :: new ( ) ;
499- match continuation_token {
500- Some ( v) => {
501- & query. push ( ( "start" , v) ) ;
502- }
503- None => { }
522+ let mut query: Vec < ( & str , & str ) > = vec ! [ ] ;
523+ if let Some ( v) = continuation_token {
524+ & query. push ( ( "start" , v) ) ;
504525 }
505526 self . http_client . get ( "/followers/ids" , query, json ! ( { } ) )
506527 }
0 commit comments