Skip to content
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
3 changes: 0 additions & 3 deletions linebot/manage_audience/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ model_adaccount.go
model_add_audience_to_audience_group_request.go
model_audience.go
model_audience_group.go
model_audience_group_authority_level.go
model_audience_group_create_route.go
model_audience_group_failed_type.go
model_audience_group_job.go
Expand All @@ -24,9 +23,7 @@ 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
192 changes: 9 additions & 183 deletions linebot/manage_audience/api_manage_audience.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,69 +116,6 @@ func WithEndpoint(endpoint string) ManageAudienceAPIOption {
}
}

// ActivateAudienceGroup
//
// Activate audience
// Parameters:
// audienceGroupId The audience ID.

// https://developers.line.biz/en/reference/messaging-api/#activate-audience-group
func (client *ManageAudienceAPI) ActivateAudienceGroup(

audienceGroupId int64,

) (struct{}, error) {
_, body, error := client.ActivateAudienceGroupWithHttpInfo(

audienceGroupId,
)
return body, error
}

// ActivateAudienceGroup
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
//
// Activate audience
// Parameters:
// audienceGroupId The audience ID.

// https://developers.line.biz/en/reference/messaging-api/#activate-audience-group
func (client *ManageAudienceAPI) ActivateAudienceGroupWithHttpInfo(

audienceGroupId int64,

) (*http.Response, struct{}, error) {
path := "/v2/bot/audienceGroup/{audienceGroupId}/activate"

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

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

res, err := client.Do(req)

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

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

defer res.Body.Close()

return res, struct{}{}, nil

}

// AddAudienceToAudienceGroup
//
// Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON)
Expand Down Expand Up @@ -593,59 +530,6 @@ func (client *ManageAudienceAPI) GetAudienceDataWithHttpInfo(

}

// GetAudienceGroupAuthorityLevel
//
// Get the authority level of the audience
// Parameters:

// https://developers.line.biz/en/reference/messaging-api/#get-authority-level
func (client *ManageAudienceAPI) GetAudienceGroupAuthorityLevel() (*GetAudienceGroupAuthorityLevelResponse, error) {
_, body, error := client.GetAudienceGroupAuthorityLevelWithHttpInfo()
return body, error
}

// GetAudienceGroupAuthorityLevel
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
//
// Get the authority level of the audience
// Parameters:

// https://developers.line.biz/en/reference/messaging-api/#get-authority-level
func (client *ManageAudienceAPI) GetAudienceGroupAuthorityLevelWithHttpInfo() (*http.Response, *GetAudienceGroupAuthorityLevelResponse, error) {
path := "/v2/bot/audienceGroup/authorityLevel"

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

}

// GetAudienceGroups
//
// Gets data for more than one audience.
Expand Down Expand Up @@ -841,6 +725,7 @@ func (client *ManageAudienceAPI) GetSharedAudienceDataWithHttpInfo(
// 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.
// includesOwnedAudienceGroups true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager

// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list
func (client *ManageAudienceAPI) GetSharedAudienceGroups(
Expand All @@ -855,6 +740,8 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroups(

createRoute AudienceGroupCreateRoute,

includesOwnedAudienceGroups bool,

) (*GetSharedAudienceGroupsResponse, error) {
_, body, error := client.GetSharedAudienceGroupsWithHttpInfo(

Expand All @@ -867,6 +754,8 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroups(
size,

createRoute,

includesOwnedAudienceGroups,
)
return body, error
}
Expand All @@ -881,6 +770,7 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroups(
// 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.
// includesOwnedAudienceGroups true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager

// https://developers.line.biz/en/reference/messaging-api/#get-shared-audience-list
func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
Expand All @@ -895,6 +785,8 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(

createRoute AudienceGroupCreateRoute,

includesOwnedAudienceGroups bool,

) (*http.Response, *GetSharedAudienceGroupsResponse, error) {
path := "/v2/bot/audienceGroup/shared/list"

Expand All @@ -911,6 +803,7 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(
query.Add("status", string(status))
query.Add("size", strconv.FormatInt(size, 10))
query.Add("createRoute", string(createRoute))
query.Add("includesOwnedAudienceGroups", strconv.FormatBool(includesOwnedAudienceGroups))

req.URL.RawQuery = query.Encode()

Expand Down Expand Up @@ -941,73 +834,6 @@ func (client *ManageAudienceAPI) GetSharedAudienceGroupsWithHttpInfo(

}

// UpdateAudienceGroupAuthorityLevel
//
// Change the authority level of the audience
// Parameters:
// updateAudienceGroupAuthorityLevelRequest

// https://developers.line.biz/en/reference/messaging-api/#change-authority-level
func (client *ManageAudienceAPI) UpdateAudienceGroupAuthorityLevel(

updateAudienceGroupAuthorityLevelRequest *UpdateAudienceGroupAuthorityLevelRequest,

) (struct{}, error) {
_, body, error := client.UpdateAudienceGroupAuthorityLevelWithHttpInfo(

updateAudienceGroupAuthorityLevelRequest,
)
return body, error
}

// UpdateAudienceGroupAuthorityLevel
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
//
// Change the authority level of the audience
// Parameters:
// updateAudienceGroupAuthorityLevelRequest

// https://developers.line.biz/en/reference/messaging-api/#change-authority-level
func (client *ManageAudienceAPI) UpdateAudienceGroupAuthorityLevelWithHttpInfo(

updateAudienceGroupAuthorityLevelRequest *UpdateAudienceGroupAuthorityLevelRequest,

) (*http.Response, struct{}, error) {
path := "/v2/bot/audienceGroup/authorityLevel"

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

res, err := client.Do(req)

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

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

defer res.Body.Close()

return res, struct{}{}, nil

}

// UpdateAudienceGroupDescription
//
// Renames an existing audience.
Expand Down