@@ -38,7 +38,6 @@ type DVRCapture struct {
38
38
TitleID int `json:"titleId"` // Game's ID
39
39
TitleName string `json:"titleName"` // Game's name
40
40
UploadDate time.Time `json:"uploadDate"`
41
- UploadDateRaw time.Time `json:"dateUploaded"` // For screenshots
42
41
UploadLanguage string `json:"uploadLanguage"`
43
42
UploadRegion string `json:"uploadRegion"`
44
43
UploadTitleID int `json:"uploadTitleId"`
@@ -84,8 +83,8 @@ type Clip struct {
84
83
FrameRate int `json:"frameRate"` // Only exists for clips
85
84
}
86
85
87
- func (c * Client ) DeleteDVRClip (gameClipID string ) error {
88
- if _ , err := c .makeRequest ("GET" , "dvr/gameclips/delete/" + gameClipID , nil , nil ); err != nil {
86
+ func (c * Client ) DeleteDVRClip (id string ) error {
87
+ if _ , err := c .makeRequest ("GET" , "dvr/gameclips/delete/" + id , nil , nil ); err != nil {
89
88
return err
90
89
}
91
90
@@ -95,7 +94,7 @@ func (c *Client) DeleteDVRClip(gameClipID string) error {
95
94
func (c * Client ) GetDVRClips (continuationToken string ) ([]* Clip , string , error ) {
96
95
response := struct {
97
96
ContinuationToken string `json:"continuationToken"`
98
- GameClips []* Clip `json:"values"`
97
+ Clips []* Clip `json:"values"`
99
98
}{}
100
99
101
100
// if a continuation token (their version of pagination) is supplied, pass it to the API
@@ -108,15 +107,15 @@ func (c *Client) GetDVRClips(continuationToken string) ([]*Clip, string, error)
108
107
return nil , "" , err
109
108
}
110
109
111
- if len (response .GameClips ) == 0 {
110
+ if len (response .Clips ) == 0 {
112
111
return nil , "" , errors .New ("failed to find clips" )
113
112
}
114
113
115
- for index := range response .GameClips {
116
- response .GameClips [index ].Type = DVRCaptureTypeClip
114
+ for index := range response .Clips {
115
+ response .Clips [index ].Type = DVRCaptureTypeClip
117
116
}
118
117
119
- return response .GameClips , response .ContinuationToken , nil
118
+ return response .Clips , response .ContinuationToken , nil
120
119
}
121
120
122
121
type Screenshot struct {
@@ -125,8 +124,11 @@ type Screenshot struct {
125
124
126
125
func (c * Client ) GetDVRScreenshots (continuationToken string ) ([]* Screenshot , string , error ) {
127
126
response := struct {
128
- ContinuationToken string `json:"continuationToken"`
129
- Screenshots []* Screenshot `json:"values"`
127
+ ContinuationToken string `json:"continuationToken"`
128
+ Screenshots []* struct {
129
+ DVRCapture
130
+ DateUploaded time.Time `json:"dateUploaded"`
131
+ } `json:"values"`
130
132
}{}
131
133
132
134
// if a continuation token (their version of pagination) is supplied, pass it to the API
@@ -143,12 +145,16 @@ func (c *Client) GetDVRScreenshots(continuationToken string) ([]*Screenshot, str
143
145
return nil , "" , errors .New ("failed to find screenshots" )
144
146
}
145
147
148
+ screenshots := make ([]* Screenshot , 0 , len (response .Screenshots ))
149
+
146
150
for index := range response .Screenshots {
147
- response .Screenshots [index ].Type = DVRCaptureTypeScreenshot
148
- response .Screenshots [index ].UploadDate = response .Screenshots [index ].UploadDateRaw // workaround as the JSON tag is different for screenshots
151
+ screenshot := Screenshot {DVRCapture : response .Screenshots [index ].DVRCapture }
152
+ screenshot .DVRCapture .Type = DVRCaptureTypeScreenshot
153
+ screenshot .UploadDate = response .Screenshots [index ].DateUploaded
154
+ screenshots = append (screenshots , & screenshot )
149
155
}
150
156
151
- return response . Screenshots , response .ContinuationToken , nil
157
+ return screenshots , response .ContinuationToken , nil
152
158
}
153
159
154
160
func (c * Client ) SetDVRPrivacy (privacy DVRPrivacy ) error {
0 commit comments