Skip to content

Commit

Permalink
Code are generated by openapi generator
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Feb 13, 2025
1 parent 3c283b7 commit 3118a77
Show file tree
Hide file tree
Showing 11 changed files with 609 additions and 1 deletion.
2 changes: 1 addition & 1 deletion line-openapi
1 change: 1 addition & 0 deletions linebot/messaging_api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ model_gender_demographic_filter.go
model_get_aggregation_unit_name_list_response.go
model_get_aggregation_unit_usage_response.go
model_get_followers_response.go
model_get_joined_membership_users_response.go
model_get_membership_subscription_response.go
model_get_message_content_transcoding_response.go
model_get_webhook_endpoint_response.go
Expand Down
92 changes: 92 additions & 0 deletions linebot/messaging_api/api_messaging_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,98 @@ func (client *MessagingApiAPI) GetGroupSummaryWithHttpInfo(

}

// GetJoinedMembershipUsers
//
// Get a list of user IDs who joined the membership.
// Parameters:
// membershipId Membership plan ID.
// start A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds).
// limit The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000.

// https://developers.line.biz/en/reference/messaging-api/#get-membership-user-ids
func (client *MessagingApiAPI) GetJoinedMembershipUsers(

membershipId int32,

start string,

limit int32,

) (*GetJoinedMembershipUsersResponse, error) {
_, body, error := client.GetJoinedMembershipUsersWithHttpInfo(

membershipId,

start,

limit,
)
return body, error
}

// GetJoinedMembershipUsers
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
//
// Get a list of user IDs who joined the membership.
// Parameters:
// membershipId Membership plan ID.
// start A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds).
// limit The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000.

// https://developers.line.biz/en/reference/messaging-api/#get-membership-user-ids
func (client *MessagingApiAPI) GetJoinedMembershipUsersWithHttpInfo(

membershipId int32,

start string,

limit int32,

) (*http.Response, *GetJoinedMembershipUsersResponse, error) {
path := "/v2/bot/membership/{membershipId}/users/ids"

path = strings.Replace(path, "{membershipId}", strconv.FormatInt(int64(membershipId), 10), -1)

req, err := http.NewRequest(http.MethodGet, client.Url(path), nil)
if err != nil {
return nil, nil, err
}

query := url.Values{}
if start != "" {
query.Add("start", start)
}
query.Add("limit", strconv.FormatInt(int64(limit), 10))

req.URL.RawQuery = query.Encode()

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 := GetJoinedMembershipUsersResponse{}
if err := decoder.Decode(&result); err != nil {
return res, nil, fmt.Errorf("failed to decode JSON: %w", err)
}
return res, &result, nil

}

// GetMembershipList
//
// Get a list of memberships.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 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

// GetJoinedMembershipUsersResponse
// List of users who have joined the membership
// https://developers.line.biz/en/reference/messaging-api/#get-membership-user-ids
type GetJoinedMembershipUsersResponse struct {

/**
* A list of user IDs who joined the membership. Users who have not agreed to the bot user agreement, are not following the bot, or are not active will be excluded. If there are no users in the membership, an empty list will be returned. (Required)
*/
UserIds []string `json:"userIds"`

/**
* A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds).
*/
Next string `json:"next,omitempty"`
}
5 changes: 5 additions & 0 deletions linebot/webhook/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ model_image_message_content.go
model_image_set.go
model_join_event.go
model_joined_members.go
model_joined_membership_content.go
model_leave_event.go
model_left_members.go
model_left_membership_content.go
model_link_content.go
model_link_things_content.go
model_location_message_content.go
model_member_joined_event.go
model_member_left_event.go
model_membership_content.go
model_membership_event.go
model_mention.go
model_mentionee.go
model_message_content.go
Expand All @@ -42,6 +46,7 @@ model_pnp_delivery.go
model_pnp_delivery_completion_event.go
model_postback_content.go
model_postback_event.go
model_renewed_membership_content.go
model_room_source.go
model_scenario_result.go
model_scenario_result_things_content.go
Expand Down
16 changes: 16 additions & 0 deletions linebot/webhook/model_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ func setDiscriminatorPropertyEvent(r EventInterface) EventInterface {
v.Type = "memberLeft"
}
return v
case *MembershipEvent:
if v.Type == "" {
v.Type = "membership"
}
return v
case MembershipEvent:
if v.Type == "" {
v.Type = "membership"
}
return v
case *MessageEvent:
if v.Type == "" {
v.Type = "message"
Expand Down Expand Up @@ -347,6 +357,12 @@ func UnmarshalEvent(data []byte) (EventInterface, error) {
return nil, fmt.Errorf("UnmarshalEvent: Cannot read memberLeft: %w", err)
}
return memberLeft, nil
case "membership":
var membership MembershipEvent
if err := json.Unmarshal(data, &membership); err != nil {
return nil, fmt.Errorf("UnmarshalEvent: Cannot read membership: %w", err)
}
return membership, nil
case "message":
var message MessageEvent
if err := json.Unmarshal(data, &message); err != nil {
Expand Down
51 changes: 51 additions & 0 deletions linebot/webhook/model_joined_membership_content.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Webhook Type Definition
* Webhook event definition of the LINE Messaging API
*
* The version of the OpenAPI document: 1.0.0
*
*
* 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 webhook

import (
"encoding/json"
)

// JoinedMembershipContent
// JoinedMembershipContent

type JoinedMembershipContent struct {
MembershipContent

/**
* The ID of the membership that the user joined. This is defined for each membership. (Required)
*/
MembershipId int32 `json:"membershipId"`
}

// MarshalJSON customizes the JSON serialization of the JoinedMembershipContent struct.
func (r *JoinedMembershipContent) MarshalJSON() ([]byte, error) {

type Alias JoinedMembershipContent
return json.Marshal(&struct {
*Alias

Type string `json:"type"`
}{
Alias: (*Alias)(r),

Type: "joined",
})
}
51 changes: 51 additions & 0 deletions linebot/webhook/model_left_membership_content.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Webhook Type Definition
* Webhook event definition of the LINE Messaging API
*
* The version of the OpenAPI document: 1.0.0
*
*
* 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 webhook

import (
"encoding/json"
)

// LeftMembershipContent
// LeftMembershipContent

type LeftMembershipContent struct {
MembershipContent

/**
* The ID of the membership that the user left. This is defined for each membership. (Required)
*/
MembershipId int32 `json:"membershipId"`
}

// MarshalJSON customizes the JSON serialization of the LeftMembershipContent struct.
func (r *LeftMembershipContent) MarshalJSON() ([]byte, error) {

type Alias LeftMembershipContent
return json.Marshal(&struct {
*Alias

Type string `json:"type"`
}{
Alias: (*Alias)(r),

Type: "left",
})
}
Loading

0 comments on commit 3118a77

Please # to comment.