Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add /v2/bot/audienceGroup/shared path #541

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion line-openapi
Submodule line-openapi updated 1 files
+276 −0 manage-audience.yml
4 changes: 4 additions & 0 deletions linebot/manage_audience/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
177 changes: 177 additions & 0 deletions linebot/manage_audience/api_manage_audience.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions linebot/manage_audience/model_adaccount.go
Original file line number Diff line number Diff line change
@@ -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"`
}
41 changes: 41 additions & 0 deletions linebot/manage_audience/model_detailed_owner.go
Original file line number Diff line number Diff line change
@@ -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"`
}
5 changes: 5 additions & 0 deletions linebot/manage_audience/model_get_audience_data_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
41 changes: 41 additions & 0 deletions linebot/manage_audience/model_get_shared_audience_data_response.go
Original file line number Diff line number Diff line change
@@ -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"`
}
Original file line number Diff line number Diff line change
@@ -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"`
}