Skip to content

Commit

Permalink
Code are generated by openapi generator (#437)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
github-actions[bot] and github-actions committed Apr 17, 2024
1 parent 749ad2b commit 0e87468
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 1 deletion.
2 changes: 1 addition & 1 deletion line-openapi
Submodule line-openapi updated 1 files
+50 −0 messaging-api.yml
1 change: 1 addition & 0 deletions linebot/messaging_api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ model_room_user_profile_response.go
model_sender.go
model_sent_message.go
model_set_webhook_endpoint_request.go
model_show_loading_animation_request.go
model_sticker_message.go
model_subscribed_membership_plan.go
model_subscribed_membership_user.go
Expand Down
72 changes: 72 additions & 0 deletions linebot/messaging_api/api_messaging_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3638,6 +3638,78 @@ func (client *MessagingApiAPI) SetWebhookEndpointWithHttpInfo(

}

// ShowLoadingAnimation
//
// Display a loading animation in one-on-one chats between users and LINE Official Accounts.
// Parameters:
// showLoadingAnimationRequest

// https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator
func (client *MessagingApiAPI) ShowLoadingAnimation(

showLoadingAnimationRequest *ShowLoadingAnimationRequest,

) (*map[string]interface{}, error) {
_, body, error := client.ShowLoadingAnimationWithHttpInfo(

showLoadingAnimationRequest,
)
return body, error
}

// ShowLoadingAnimation
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
//
// Display a loading animation in one-on-one chats between users and LINE Official Accounts.
// Parameters:
// showLoadingAnimationRequest

// https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator
func (client *MessagingApiAPI) ShowLoadingAnimationWithHttpInfo(

showLoadingAnimationRequest *ShowLoadingAnimationRequest,

) (*http.Response, *map[string]interface{}, error) {
path := "/v2/bot/chat/loading/start"

var buf bytes.Buffer
enc := json.NewEncoder(&buf)
if err := enc.Encode(showLoadingAnimationRequest); err != nil {
return nil, nil, err
}
req, err := http.NewRequest(http.MethodPost, client.Url(path), &buf)
if err != nil {
return nil, nil, err
}
req.Header.Set("Content-Type", "application/json; charset=UTF-8")

res, err := client.Do(req)

if err != nil {
return res, nil, err
}

if res.StatusCode/100 != 2 {
bodyBytes, err := io.ReadAll(res.Body)
bodyReader := bytes.NewReader(bodyBytes)
if err != nil {
return res, nil, fmt.Errorf("failed to read response body: %w", err)
}
res.Body = io.NopCloser(bodyReader)
return res, nil, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(bodyBytes))
}

defer res.Body.Close()

decoder := json.NewDecoder(res.Body)
result := map[string]interface{}{}
if err := decoder.Decode(&result); err != nil {
return res, nil, fmt.Errorf("failed to decode JSON: %w", err)
}
return res, &result, nil

}

// TestWebhookEndpoint
//
// Test webhook endpoint
Expand Down
38 changes: 38 additions & 0 deletions linebot/messaging_api/model_show_loading_animation_request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* LINE Messaging API
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

//go:generate python3 ../../generate-code.py
package messaging_api

// ShowLoadingAnimationRequest
// ShowLoadingAnimationRequest
// https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator-request-body
type ShowLoadingAnimationRequest struct {

/**
* User ID of the target user for whom the loading animation is to be displayed. (Required)
*/
ChatId string `json:"chatId"`

/**
* The number of seconds to display the loading indicator. It must be a multiple of 5. The maximum value is 60 seconds.
* minimum: 5
* maximum: 60
*/
LoadingSeconds int32 `json:"loadingSeconds"`
}

0 comments on commit 0e87468

Please sign in to comment.