@@ -12,11 +12,6 @@ import (
12
12
"github.com/replicatedhq/replicated/pkg/types"
13
13
)
14
14
15
- type GraphQLResponseGetChannel struct {
16
- Data * KotsGetChannelData `json:"data,omitempty"`
17
- Errors []graphql.GQLError `json:"errors,omitempty"`
18
- }
19
-
20
15
type GraphQLResponseCreateChannel struct {
21
16
Data * KotsCreateChannelData `json:"data,omitempty"`
22
17
Errors []graphql.GQLError `json:"errors,omitempty"`
@@ -172,85 +167,21 @@ func (c *GraphQLClient) CreateChannel(appID string, name string, description str
172
167
173
168
}
174
169
175
- const getKotsChannel = `
176
- query getKotsChannel($channelId: ID!) {
177
- getKotsChannel(channelId: $channelId) {
178
- id
179
- appId
180
- name
181
- description
182
- channelIcon
183
- channelSequence
184
- releaseSequence
185
- currentVersion
186
- currentReleaseDate
187
- installInstructions
188
- numReleases
189
- adoptionRate {
190
- releaseSequence
191
- semver
192
- count
193
- percent
194
- totalOnChannel
195
- }
196
- customers {
197
- id
198
- name
199
- avatar
200
- actions {
201
- shipApplyDocker
202
- }
203
- installationId
204
- shipInstallStatus {
205
- status
206
- updatedAt
207
- }
208
- }
209
- githubRef {
210
- owner
211
- repoFullName
212
- branch
213
- path
214
- }
215
- extraLintRules
216
- created
217
- updated
218
- isDefault
219
- isArchived
220
- releases {
221
- semver
222
- releaseNotes
223
- created
224
- updated
225
- releasedAt
226
- sequence
227
- channelSequence
228
- airgapBuildStatus
229
- }
230
- }
231
- }
232
- `
170
+ func (c * VendorV3Client ) GetChannel (appID string , channelID string ) (* channels.AppChannel , []channels.ChannelRelease , error ) {
171
+ var response = KotsGetChannelData {}
233
172
234
- func (c * GraphQLClient ) GetChannel (appID string , channelID string ) (* channels.AppChannel , []channels.ChannelRelease , error ) {
235
- response := GraphQLResponseGetChannel {}
236
-
237
- request := graphql.Request {
238
- Query : getKotsChannel ,
239
- Variables : map [string ]interface {}{
240
- "appID" : appID ,
241
- "channelId" : channelID ,
242
- },
243
- }
244
- if err := c .ExecuteRequest (request , & response ); err != nil {
245
- return nil , nil , err
173
+ url := fmt .Sprintf ("/v3/app/%s/channel/%s" , appID , channelID )
174
+ err := c .DoJSON ("GET" , url , http .StatusOK , nil , & response )
175
+ if err != nil {
176
+ return nil , nil , errors .Wrap (err , "get app channel" )
246
177
}
247
178
248
179
channelDetail := channels.AppChannel {
249
- Id : response .Data . KotsChannel .ID ,
250
- Name : response .Data . KotsChannel .Name ,
251
- Description : response .Data . KotsChannel .Description ,
252
- ReleaseLabel : response .Data . KotsChannel .CurrentVersion ,
253
- ReleaseSequence : response .Data . KotsChannel .ReleaseSequence ,
180
+ Id : response .KotsChannel .ID ,
181
+ Name : response .KotsChannel .Name ,
182
+ Description : response .KotsChannel .Description ,
183
+ ReleaseLabel : response .KotsChannel .CurrentVersion ,
184
+ ReleaseSequence : response .KotsChannel .ReleaseSequence ,
254
185
}
255
186
return & channelDetail , nil , nil
256
187
}
0 commit comments