diff --git a/line-openapi b/line-openapi index 5eeed11c..04b9b633 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit 5eeed11c04680245bb535279686d7d28e0521857 +Subproject commit 04b9b633e6558600ee94bc5156e228643f020c79 diff --git a/linebot/manage_audience/.openapi-generator/FILES b/linebot/manage_audience/.openapi-generator/FILES index aff9cf9a..6df2811c 100644 --- a/linebot/manage_audience/.openapi-generator/FILES +++ b/linebot/manage_audience/.openapi-generator/FILES @@ -1,5 +1,6 @@ api_manage_audience.go api_manage_audience_blob.go +model_adaccount.go model_add_audience_to_audience_group_request.go model_audience.go model_audience_group.go @@ -19,10 +20,13 @@ model_create_click_based_audience_group_request.go model_create_click_based_audience_group_response.go model_create_imp_based_audience_group_request.go model_create_imp_based_audience_group_response.go +model_detailed_owner.go model_error_detail.go model_error_response.go model_get_audience_data_response.go model_get_audience_group_authority_level_response.go model_get_audience_groups_response.go +model_get_shared_audience_data_response.go +model_get_shared_audience_groups_response.go model_update_audience_group_authority_level_request.go model_update_audience_group_description_request.go diff --git a/linebot/manage_audience/api_manage_audience.go b/linebot/manage_audience/api_manage_audience.go index b77736c2..7539a321 100644 --- a/linebot/manage_audience/api_manage_audience.go +++ b/linebot/manage_audience/api_manage_audience.go @@ -764,6 +764,183 @@ func (client *ManageAudienceAPI) GetAudienceGroupsWithHttpInfo( } +// GetSharedAudienceData +// +// Gets audience data. +// Parameters: +// audienceGroupId The audience ID. + +// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience +func (client *ManageAudienceAPI) GetSharedAudienceData( + + audienceGroupId int64, + +) (*GetSharedAudienceDataResponse, error) { + _, body, error := client.GetSharedAudienceDataWithHttpInfo( + + audienceGroupId, + ) + return body, error +} + +// GetSharedAudienceData +// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature. +// +// Gets audience data. +// Parameters: +// audienceGroupId The audience ID. + +// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience +func (client *ManageAudienceAPI) GetSharedAudienceDataWithHttpInfo( + + audienceGroupId int64, + +) (*http.Response, *GetSharedAudienceDataResponse, error) { + path := "/v2/bot/audienceGroup/shared/{audienceGroupId}" + + path = strings.Replace(path, "{audienceGroupId}", strconv.FormatInt(audienceGroupId, 10), -1) + + req, err := http.NewRequest(http.MethodGet, client.Url(path), nil) + if err != nil { + return nil, nil, err + } + + 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 := GetSharedAudienceDataResponse{} + if err := decoder.Decode(&result); err != nil { + return res, nil, fmt.Errorf("failed to decode JSON: %w", err) + } + return res, &result, nil + +} + +// GetSharedAudienceGroups +// +// Gets data for more than one audience, including those shared by the Business Manager. +// Parameters: +// page The page to return when getting (paginated) results. Must be 1 or higher. +// description The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. +// status The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. +// size The number of audiences per page. Default: 20 Max: 40 +// createRoute How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + +// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list +func (client *ManageAudienceAPI) GetSharedAudienceGroups( + + page int64, + + description string, + + status AudienceGroupStatus, + + size int64, + + createRoute AudienceGroupCreateRoute, + +) (*GetSharedAudienceGroupsResponse, error) { + _, body, error := client.GetSharedAudienceGroupsWithHttpInfo( + + page, + + description, + + status, + + size, + + createRoute, + ) + return body, error +} + +// GetSharedAudienceGroups +// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature. +// +// Gets data for more than one audience, including those shared by the Business Manager. +// Parameters: +// page The page to return when getting (paginated) results. Must be 1 or higher. +// description The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. +// status The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. +// size The number of audiences per page. Default: 20 Max: 40 +// createRoute How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + +// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list +func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo( + + page int64, + + description string, + + status AudienceGroupStatus, + + size int64, + + createRoute AudienceGroupCreateRoute, + +) (*http.Response, *GetSharedAudienceGroupsResponse, error) { + path := "/v2/bot/audienceGroup/shared/list" + + req, err := http.NewRequest(http.MethodGet, client.Url(path), nil) + if err != nil { + return nil, nil, err + } + + query := url.Values{} + query.Add("page", strconv.FormatInt(page, 10)) + if description != "" { + query.Add("description", description) + } + query.Add("status", string(status)) + query.Add("size", strconv.FormatInt(size, 10)) + query.Add("createRoute", string(createRoute)) + + 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 := GetSharedAudienceGroupsResponse{} + if err := decoder.Decode(&result); err != nil { + return res, nil, fmt.Errorf("failed to decode JSON: %w", err) + } + return res, &result, nil + +} + // UpdateAudienceGroupAuthorityLevel // // Change the authority level of the audience diff --git a/linebot/manage_audience/model_adaccount.go b/linebot/manage_audience/model_adaccount.go new file mode 100644 index 00000000..9789b04c --- /dev/null +++ b/linebot/manage_audience/model_adaccount.go @@ -0,0 +1,31 @@ +/** + * 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 manage_audience + +// Adaccount +// Adaccount + +type Adaccount struct { + + /** + * Ad account name. + */ + Name string `json:"name,omitempty"` +} diff --git a/linebot/manage_audience/model_detailed_owner.go b/linebot/manage_audience/model_detailed_owner.go new file mode 100644 index 00000000..aea15a94 --- /dev/null +++ b/linebot/manage_audience/model_detailed_owner.go @@ -0,0 +1,41 @@ +/** + * 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 manage_audience + +// DetailedOwner +// Owner of this audience group. + +type DetailedOwner struct { + + /** + * Service name where the audience group has been created. + */ + ServiceType string `json:"serviceType,omitempty"` + + /** + * Owner ID in the service. + */ + Id string `json:"id,omitempty"` + + /** + * Owner account name. + */ + Name string `json:"name,omitempty"` +} diff --git a/linebot/manage_audience/model_get_audience_data_response.go b/linebot/manage_audience/model_get_audience_data_response.go index 59456c59..3ff4cea6 100644 --- a/linebot/manage_audience/model_get_audience_data_response.go +++ b/linebot/manage_audience/model_get_audience_data_response.go @@ -33,4 +33,9 @@ type GetAudienceDataResponse struct { * An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs. Empty array is returned for any other type of audience. Max: 50 */ Jobs []AudienceGroupJob `json:"jobs,omitempty"` + + /** + * Get Adaccount + */ + Adaccount *Adaccount `json:"adaccount,omitempty"` } diff --git a/linebot/manage_audience/model_get_shared_audience_data_response.go b/linebot/manage_audience/model_get_shared_audience_data_response.go new file mode 100644 index 00000000..d83995a0 --- /dev/null +++ b/linebot/manage_audience/model_get_shared_audience_data_response.go @@ -0,0 +1,41 @@ +/** + * 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 manage_audience + +// GetSharedAudienceDataResponse +// Get audience data +// https://developers.line.biz/en/reference/messaging-api/#get-audience-group +type GetSharedAudienceDataResponse struct { + + /** + * Get AudienceGroup + */ + AudienceGroup *AudienceGroup `json:"audienceGroup,omitempty"` + + /** + * An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs. Empty array is returned for any other type of audience. Max: 50 + */ + Jobs []AudienceGroupJob `json:"jobs,omitempty"` + + /** + * Get Owner + */ + Owner *DetailedOwner `json:"owner,omitempty"` +} diff --git a/linebot/manage_audience/model_get_shared_audience_groups_response.go b/linebot/manage_audience/model_get_shared_audience_groups_response.go new file mode 100644 index 00000000..790243c1 --- /dev/null +++ b/linebot/manage_audience/model_get_shared_audience_groups_response.go @@ -0,0 +1,56 @@ +/** + * 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 manage_audience + +// GetSharedAudienceGroupsResponse +// Gets data for more than one audience. +// https://developers.line.biz/en/reference/messaging-api/#get-audience-groups +type GetSharedAudienceGroupsResponse struct { + + /** + * An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned. + */ + AudienceGroups []AudienceGroup `json:"audienceGroups,omitempty"` + + /** + * true when this is not the last page. + */ + HasNextPage bool `json:"hasNextPage"` + + /** + * The total number of audiences that can be returned with the specified filter. + */ + TotalCount int64 `json:"totalCount"` + + /** + * Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE. + */ + ReadWriteAudienceGroupTotalCount int64 `json:"readWriteAudienceGroupTotalCount"` + + /** + * The current page number. + */ + Page int64 `json:"page"` + + /** + * The maximum number of audiences on the current page. + */ + Size int64 `json:"size"` +}