Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove obsolete feature: Audience Match #530

Merged
merged 2 commits into from
Jan 20, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ _testmain.go
.idea*

/.vscode/

# github workflow
pr_info.json
2 changes: 1 addition & 1 deletion line-openapi
Submodule line-openapi updated 1 files
+0 −43 messaging-api.yml
1 change: 0 additions & 1 deletion linebot/messaging_api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ model_app_type_demographic.go
model_app_type_demographic_filter.go
model_area_demographic.go
model_area_demographic_filter.go
model_audience_match_messages_request.go
model_audience_recipient.go
model_audio_message.go
model_bot_info_response.go
Expand Down
67 changes: 0 additions & 67 deletions linebot/messaging_api/api_messaging_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,73 +116,6 @@ func WithEndpoint(endpoint string) MessagingApiAPIOption {
}
}

// AudienceMatch
//
// Send a message using phone number
// Parameters:
// audienceMatchMessagesRequest

// https://developers.line.biz/en/reference/partner-docs/#phone-audience-match
func (client *MessagingApiAPI) AudienceMatch(

audienceMatchMessagesRequest *AudienceMatchMessagesRequest,

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

audienceMatchMessagesRequest,
)
return body, error
}

// AudienceMatch
// If you want to take advantage of the HTTPResponse object for status codes and headers, use this signature.
//
// Send a message using phone number
// Parameters:
// audienceMatchMessagesRequest

// https://developers.line.biz/en/reference/partner-docs/#phone-audience-match
func (client *MessagingApiAPI) AudienceMatchWithHttpInfo(

audienceMatchMessagesRequest *AudienceMatchMessagesRequest,

) (*http.Response, struct{}, error) {
path := "/bot/ad/multicast/phone"

var buf bytes.Buffer
enc := json.NewEncoder(&buf)
if err := enc.Encode(audienceMatchMessagesRequest); err != nil {
return nil, struct{}{}, err
}
req, err := http.NewRequest(http.MethodPost, 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

}

// Broadcast
//
// Sends a message to multiple users at any time.
Expand Down
Loading