Skip to content

Commit 19c1796

Browse files
authored
feat: add support of title and duration to CreateClip (#249)
https://dev.twitch.tv/docs/api/reference/#create-clip
1 parent 3b94224 commit 19c1796

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

clips.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ func (ccr *CreateClipResponse) GetClipsCreationRateLimitRemaining() int {
8585
}
8686

8787
type CreateClipParams struct {
88+
// BroadcasterID The ID of the broadcaster whose stream you want to create a clip from.
8889
BroadcasterID string `query:"broadcaster_id"`
89-
90-
// Optional
91-
HasDelay bool `query:"has_delay,false"`
90+
// Optional. The title of the clip.
91+
Title string `query:"title"`
92+
// Optional. The length of the clip in seconds. Possible values range from 5 to 60 inclusively with a precision of 0.1. The default is 30.
93+
Duration float32 `query:"duration"`
9294
}
9395

9496
// CreateClip creates a clip programmatically. This returns both an ID and

clips_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ func TestCreateClip(t *testing.T) {
122122
"600",
123123
"598",
124124
},
125+
{
126+
http.StatusAccepted,
127+
&Options{ClientID: "my-client-id"},
128+
&CreateClipParams{BroadcasterID: "26490481", Title: "Title", Duration: 0.5}, // summit1g
129+
`{"data":[{"id":"IronicHedonisticOryxSquadGoals","edit_url":"https://clips.twitch.tv/IronicHedonisticOryxSquadGoals/edit"}]}`,
130+
"600",
131+
"598",
132+
},
125133
{
126134
http.StatusUnauthorized,
127135
&Options{ClientID: "my-client-id"},

0 commit comments

Comments
 (0)