You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The project object doesn't contain a list of channels associated with the project. The ChannelQuery struct only allows for ID or Partial Name, without having the list associated to the project, you're forced to use Partial Name. This can lead to a lot of results and you need to loop to retrieve all of them, then iterate through them until you find the one you're looking for.
Describe the solution you'd like
Two solutions could resolve this issue:
Include associated channel references on the project object
Include ProjectId in the ChannelQuery struct so you can limit results to channels pertinent to the project in question
Describe alternatives you've considered
This works, but has to retrieve all channels with the matching partial name
func GetChannel(client *octopusdeploy.Client, project *octopusdeploy.Project, ChannelName string) *octopusdeploy.Channel {
channelQuery := octopusdeploy.ChannelsQuery{
PartialName: ChannelName,
Skip: 0,
}
results := []*octopusdeploy.Channel{}
for true {
// Call for results
channels, err := client.Channels.Get(channelQuery)
if err != nil {
log.Println(err)
}
// Check returned number of items
if len(channels.Items) == 0 {
break
}
// append items to results
results = append(results, channels.Items...)
// Update query
channelQuery.Skip += len(channels.Items)
}
for i := 0; i < len(results); i++ {
if results[i].ProjectID == project.ID && results[i].Name == ChannelName {
return results[i]
}
}
return nil
}
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The project object doesn't contain a list of channels associated with the project. The
ChannelQuery
struct only allows for ID or Partial Name, without having the list associated to the project, you're forced to use Partial Name. This can lead to a lot of results and you need to loop to retrieve all of them, then iterate through them until you find the one you're looking for.Describe the solution you'd like
Two solutions could resolve this issue:
Describe alternatives you've considered
This works, but has to retrieve all channels with the matching partial name
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: