@@ -91,7 +91,7 @@ var ImMessagesSearch = common.Shortcut{
9191 return err
9292 }
9393
94- rawItems , hasMore , nextPageToken , truncatedByLimit , pageLimit , err := searchMessages (runtime , req )
94+ rawItems , hasMore , nextPageToken , truncatedByLimit , pageLimit , notice , err := searchMessages (runtime , req )
9595 if err != nil {
9696 return err
9797 }
@@ -103,6 +103,9 @@ var ImMessagesSearch = common.Shortcut{
103103 "has_more" : hasMore ,
104104 "page_token" : nextPageToken ,
105105 }
106+ if notice != "" {
107+ outData ["notice" ] = notice
108+ }
106109 runtime .OutFormat (outData , nil , func (w io.Writer ) {
107110 fmt .Fprintln (w , "No matching messages found." )
108111 })
@@ -131,6 +134,9 @@ var ImMessagesSearch = common.Shortcut{
131134 "page_token" : nextPageToken ,
132135 "note" : "failed to fetch message details, returning ID list only" ,
133136 }
137+ if notice != "" {
138+ outData ["notice" ] = notice
139+ }
134140 runtime .OutFormat (outData , nil , func (w io.Writer ) {
135141 fmt .Fprintf (w , "Found %d messages (failed to fetch details):\n " , len (messageIds ))
136142 for _ , id := range messageIds {
@@ -206,6 +212,9 @@ var ImMessagesSearch = common.Shortcut{
206212 "has_more" : hasMore ,
207213 "page_token" : nextPageToken ,
208214 }
215+ if notice != "" {
216+ outData ["notice" ] = notice
217+ }
209218 runtime .OutFormat (outData , nil , func (w io.Writer ) {
210219 if len (enriched ) == 0 {
211220 fmt .Fprintln (w , "No matching messages found." )
@@ -392,7 +401,7 @@ func messagesSearchPaginationConfig(runtime *common.RuntimeContext) (autoPaginat
392401 return autoPaginate , pageLimit
393402}
394403
395- func searchMessages (runtime * common.RuntimeContext , req * messagesSearchRequest ) ([]interface {}, bool , string , bool , int , error ) {
404+ func searchMessages (runtime * common.RuntimeContext , req * messagesSearchRequest ) ([]interface {}, bool , string , bool , int , string , error ) {
396405 autoPaginate , pageLimit := messagesSearchPaginationConfig (runtime )
397406 pageToken := ""
398407 if tokens := req .params ["page_token" ]; len (tokens ) > 0 {
@@ -410,6 +419,7 @@ func searchMessages(runtime *common.RuntimeContext, req *messagesSearchRequest)
410419 lastPageToken string
411420 truncatedByLimit bool
412421 pageCount int
422+ notice string
413423 )
414424
415425 for {
@@ -423,9 +433,12 @@ func searchMessages(runtime *common.RuntimeContext, req *messagesSearchRequest)
423433
424434 searchData , err := runtime .DoAPIJSONTyped (http .MethodPost , "/open-apis/im/v1/messages/search" , params , req .body )
425435 if err != nil {
426- return nil , false , "" , false , pageLimit , err
436+ return nil , false , "" , false , pageLimit , "" , err
427437 }
428438
439+ if notice == "" {
440+ notice , _ = searchData ["notice" ].(string )
441+ }
429442 items , _ := searchData ["items" ].([]interface {})
430443 allItems = append (allItems , items ... )
431444 lastHasMore , lastPageToken = common .PaginationMeta (searchData )
@@ -441,7 +454,7 @@ func searchMessages(runtime *common.RuntimeContext, req *messagesSearchRequest)
441454 pageToken = lastPageToken
442455 }
443456
444- return allItems , lastHasMore , lastPageToken , truncatedByLimit , pageLimit , nil
457+ return allItems , lastHasMore , lastPageToken , truncatedByLimit , pageLimit , notice , nil
445458}
446459
447460func batchMGetMessages (runtime * common.RuntimeContext , messageIds []string ) ([]interface {}, error ) {
0 commit comments