Skip to content

Commit

Permalink
Added branded content flag to /channels Mock API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Xemdo committed Jul 12, 2023
1 parent cddaa62 commit 6b5147e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions internal/mock_api/endpoints/channels/information.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type PatchInformationEndpointRequest struct {
BroadcasterLanguage string `json:"broadcaster_language"`
Title string `json:"title"`
Delay *int `json:"delay"`
BrandedContent *bool `json:"is_branded_content"`
// TODO: tags
ContentClassificationLabels []PatchInformationEndpointRequestLabel `json:"content_classification_labels"`
}
Expand Down Expand Up @@ -161,7 +162,10 @@ func patchInformation(w http.ResponseWriter, r *http.Request) {
delay = *params.Delay
}

// TODO: Branded content
isBrandedContent := u.IsBrandedContent
if params.BrandedContent != nil {
isBrandedContent = *params.BrandedContent
}

cclDbString, err := handleCCLs(u, params)
if err != nil {
Expand All @@ -171,12 +175,13 @@ func patchInformation(w http.ResponseWriter, r *http.Request) {

// Write
err = db.NewQuery(r, 100).UpdateChannel(broadcasterID, database.User{
ID: broadcasterID,
Title: params.Title,
Language: params.BroadcasterLanguage,
CategoryID: gameID,
Delay: delay,
UnparsedCCLs: cclDbString,
ID: broadcasterID,
Title: params.Title,
Language: params.BroadcasterLanguage,
CategoryID: gameID,
Delay: delay,
UnparsedCCLs: cclDbString,
IsBrandedContent: isBrandedContent,
})
if err != nil {
if database.DatabaseErrorIs(err, sqlite3.ErrConstraintForeignKey) {
Expand Down

0 comments on commit 6b5147e

Please sign in to comment.