@@ -266,20 +266,21 @@ impl LineBot {
266266 & self ,
267267 description : & str ,
268268 request_id : i64 ,
269- click_url : Option < & str > ,
269+ click_url : Option < String > ,
270270 ) -> Result < Response , Error > {
271- let mut url: & str = "" ;
272- match click_url {
273- Some ( v) => url = v,
274- None => { }
271+ #[ derive( Serialize ) ]
272+ struct Data {
273+ description : String ,
274+ #[ serde( rename = "requestId" ) ]
275+ request_id : i64 ,
276+ #[ serde( rename = "clickUrl" , skip_serializing_if = "Option::is_none" ) ]
277+ click_url : Option < String > ,
275278 }
276- let data: Value = json ! (
277- {
278- "description" : description,
279- "requestId" : request_id,
280- "clickUrl" : url
281- }
282- ) ;
279+ let data: Value = json ! ( Data {
280+ description: String :: from( description) ,
281+ request_id: request_id,
282+ click_url: click_url,
283+ } ) ;
283284 self . http_client . post ( "/audienceGroup/click" , data)
284285 }
285286
@@ -339,10 +340,33 @@ impl LineBot {
339340 }
340341
341342 // TODO: https://developers.line.biz/ja/reference/messaging-api/#get-audience-groups
342- pub fn get_many_audience_information ( & self ) -> Result < Response , Error > {
343- // dataの処理・引数を増やす
343+ pub fn get_many_audience_information (
344+ & self ,
345+ page : & str ,
346+ description : Option < & str > ,
347+ status : Option < & str > ,
348+ size : Option < & str > ,
349+ includes_external_public_groups : Option < & str > ,
350+ create_route : Option < & str > ,
351+ ) -> Result < Response , Error > {
352+ let mut query: Vec < ( & str , & str ) > = vec ! [ ( "page" , page) ] ;
353+ if let Some ( v) = description {
354+ & query. push ( ( "description" , v) ) ;
355+ }
356+ if let Some ( v) = status {
357+ & query. push ( ( "status" , v) ) ;
358+ }
359+ if let Some ( v) = size {
360+ & query. push ( ( "size" , v) ) ;
361+ }
362+ if let Some ( v) = includes_external_public_groups {
363+ & query. push ( ( "includesExternalPublicGroups" , v) ) ;
364+ }
365+ if let Some ( v) = create_route {
366+ & query. push ( ( "createRoute" , v) ) ;
367+ }
344368 self . http_client
345- . get ( "/audienceGroup/list" , vec ! [ ] , json ! ( { } ) )
369+ . get ( "/audienceGroup/list" , query , json ! ( { } ) )
346370 }
347371
348372 pub fn get_audience_authority_level ( & self ) -> Result < Response , Error > {
@@ -370,7 +394,7 @@ impl LineBot {
370394 )
371395 }
372396
373- pub fn get_number_of_followes ( & self , date : NaiveDate ) -> Result < Response , Error > {
397+ pub fn get_number_of_followers ( & self , date : NaiveDate ) -> Result < Response , Error > {
374398 self . http_client . get (
375399 "/bot/insight/followers" ,
376400 vec ! [ ( "date" , & date. format( "%Y%m%d" ) . to_string( ) ) ] ,
@@ -392,12 +416,9 @@ impl LineBot {
392416 }
393417
394418 pub fn get_follower_ids ( & self , continuation_token : Option < & str > ) -> Result < Response , Error > {
395- let mut query: Vec < ( & str , & str ) > = Vec :: new ( ) ;
396- match continuation_token {
397- Some ( v) => {
398- & query. push ( ( "start" , v) ) ;
399- }
400- None => { }
419+ let mut query: Vec < ( & str , & str ) > = vec ! [ ] ;
420+ if let Some ( v) = continuation_token {
421+ & query. push ( ( "start" , v) ) ;
401422 }
402423 self . http_client . get ( "/followers/ids" , query, json ! ( { } ) )
403424 }
0 commit comments