Skip to content

Commit

Permalink
Merge branch 'master' into fix-duration-of-video-type
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz authored Jan 30, 2023
2 parents fd36872 + ce93aa3 commit b78b89e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .changelog/1188.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:breaking-change
queues: UpdateQueue has been updated to match the API and now correctly updates a Queue's name
```
3 changes: 3 additions & 0 deletions .changelog/1191.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
deps: bumps github.com/urfave/cli/v2 from 2.24.1 to 2.24.2
```
3 changes: 3 additions & 0 deletions .changelog/1192.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
deps: bumps goreleaser/goreleaser-action from 4.1.0 to 4.2.0
```
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4.1.0
uses: goreleaser/goreleaser-action@v4.2.0
with:
version: latest
args: release --rm-dist
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.2
github.com/olekukonko/tablewriter v0.0.5
github.com/stretchr/testify v1.8.1
github.com/urfave/cli/v2 v2.24.1
github.com/urfave/cli/v2 v2.24.2
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/urfave/cli/v2 v2.24.1 h1:/QYYr7g0EhwXEML8jO+8OYt5trPnLHS0p3mrgExJ5NU=
github.com/urfave/cli/v2 v2.24.1/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/urfave/cli/v2 v2.24.2 h1:q1VA+ofZ8SWfEKB9xXHUD4QZaeI9e+ItEqSbfH2JBXk=
github.com/urfave/cli/v2 v2.24.2/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
Expand Down
14 changes: 4 additions & 10 deletions queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,8 @@ type QueueConsumerResponse struct {
}

type UpdateQueueParams struct {
ID string `json:"queue_id,omitempty"`
Name string `json:"queue_name,omitempty"`
CreatedOn *time.Time `json:"created_on,omitempty"`
ModifiedOn *time.Time `json:"modified_on,omitempty"`
ProducersTotalCount int `json:"producers_total_count,omitempty"`
Producers []QueueProducer `json:"producers,omitempty"`
ConsumersTotalCount int `json:"consumers_total_count,omitempty"`
Consumers []QueueConsumer `json:"consumers,omitempty"`
Name string `json:"-"`
UpdatedName string `json:"queue_name,omitempty"`
}

type ListQueueConsumersParams struct {
Expand Down Expand Up @@ -233,12 +227,12 @@ func (api *API) UpdateQueue(ctx context.Context, rc *ResourceContainer, params U
return Queue{}, ErrMissingAccountID
}

if params.Name == "" {
if params.Name == "" || params.UpdatedName == "" {
return Queue{}, ErrMissingQueueName
}

uri := fmt.Sprintf("/accounts/%s/workers/queues/%s", rc.Identifier, params.Name)
res, err := api.makeRequestContext(ctx, http.MethodPut, uri, nil)
res, err := api.makeRequestContext(ctx, http.MethodPut, uri, params)
if err != nil {
return Queue{}, fmt.Errorf("%s: %w", errMakeRequestError, err)
}
Expand Down
6 changes: 3 additions & 3 deletions queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,17 @@ func TestQueue_Update(t *testing.T) {
}
}`)
})
_, err := client.UpdateQueue(context.Background(), AccountIdentifier(""), UpdateQueueParams{})
_, err := client.UpdateQueue(context.Background(), AccountIdentifier(""), UpdateQueueParams{Name: testQueueName})
if assert.Error(t, err) {
assert.Equal(t, ErrMissingAccountID, err)
}

_, err = client.UpdateQueue(context.Background(), AccountIdentifier(testAccountID), UpdateQueueParams{})
_, err = client.UpdateQueue(context.Background(), AccountIdentifier(testAccountID), UpdateQueueParams{Name: testQueueName})
if assert.Error(t, err) {
assert.Equal(t, ErrMissingQueueName, err)
}

results, err := client.UpdateQueue(context.Background(), AccountIdentifier(testAccountID), UpdateQueueParams{Name: "example-queue"})
results, err := client.UpdateQueue(context.Background(), AccountIdentifier(testAccountID), UpdateQueueParams{Name: testQueueName, UpdatedName: "renamed-example-queue"})
if assert.NoError(t, err) {
CreatedOn, _ := time.Parse(time.RFC3339, "2023-01-01T00:00:00Z")
ModifiedOn, _ := time.Parse(time.RFC3339, "2023-01-01T00:00:00Z")
Expand Down

0 comments on commit b78b89e

Please sign in to comment.