Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/courier-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')

steps:
Expand All @@ -48,7 +48,7 @@ jobs:
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/courier-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/courier-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.11.2"
".": "3.12.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 138
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-11e1931d767cef402bbed5a965746d1933ae72db0f41881860593a0b1424fd80.yml
openapi_spec_hash: 9def941805f233f8761c4bdae88f6137
config_hash: 6c3a754258f0f77e9032a90a478ab76d
configured_endpoints: 139
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-b03f5346718dcd7b22f15893445ea593ab87535c90c540fc5a796c6ecd54d779.yml
openapi_spec_hash: 15677d3be4ecd33eab154080b4bc437f
config_hash: dcd58abf1e56b114bdce22336ca3d570
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 3.12.0 (2026-07-20)

Full Changelog: [v3.11.2...v3.12.0](https://github.com/trycourier/courier-cli/compare/v3.11.2...v3.12.0)

### Features

* Document POST /notifications/{id}/duplicate [C-18607] ([#165](https://github.com/trycourier/courier-cli/issues/165)) ([3e1c7f9](https://github.com/trycourier/courier-cli/commit/3e1c7f937cdef899737f99a5b3d5563ce2314ebf))
* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([7cd231c](https://github.com/trycourier/courier-cli/commit/7cd231c7cb4917b51abdc1d2f7d4851a280d8116))

## 3.11.2 (2026-07-10)

Full Changelog: [v3.11.1...v3.11.2](https://github.com/trycourier/courier-cli/compare/v3.11.1...v3.11.2)
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ func init() {
&notificationsRetrieve,
&notificationsList,
&notificationsArchive,
&notificationsDuplicate,
&notificationsListVersions,
&notificationsPublish,
&notificationsPutContent,
Expand Down
57 changes: 57 additions & 0 deletions pkg/cmd/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@
HideHelpCommand: true,
}

var notificationsDuplicate = cli.Command{
Name: "duplicate",
Usage: "Duplicate a notification template. Creates a standalone copy within the same\nworkspace and environment, with \" COPY\" appended to the title. The copy clones\nthe source draft's tags, brand, subscription topic, routing strategy, channels,\nand content, and is always created as a standalone template (it is not linked to\nany journey or broadcast, even if the source was). Templates that are scoped to\na journey or a broadcast cannot be duplicated through this endpoint.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Name: "id",
Required: true,
PathParam: "id",
},
},
Action: handleNotificationsDuplicate,
HideHelpCommand: true,
}

var notificationsListVersions = cli.Command{
Name: "list-versions",
Usage: "List versions of a notification template.",
Expand Down Expand Up @@ -540,6 +555,48 @@
return client.Notifications.Archive(ctx, cmd.Value("id").(string), options...)
}

func handleNotificationsDuplicate(ctx context.Context, cmd *cli.Command) error {
client := courier.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if !cmd.IsSet("id") && len(unusedArgs) > 0 {
cmd.Set("id", unusedArgs[0])
unusedArgs = unusedArgs[1:]
}
if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}

options, err := flagOptions(
cmd,
apiquery.NestedQueryFormatBrackets,
apiquery.ArrayQueryFormatComma,
EmptyBody,
false,
)
if err != nil {
return err
}

var res []byte
options = append(options, option.WithResponseBodyInto(&res))
_, err = client.Notifications.Duplicate(ctx, cmd.Value("id").(string), options...)

Check failure on line 582 in pkg/cmd/notification.go

View workflow job for this annotation

GitHub Actions / lint

client.Notifications.Duplicate undefined (type courier.NotificationService has no field or method Duplicate)

Check failure on line 582 in pkg/cmd/notification.go

View workflow job for this annotation

GitHub Actions / test

client.Notifications.Duplicate undefined (type courier.NotificationService has no field or method Duplicate)
if err != nil {
return err
}

obj := gjson.ParseBytes(res)
format := cmd.Root().String("format")
explicitFormat := cmd.Root().IsSet("format")
transform := cmd.Root().String("transform")
return ShowJSON(obj, ShowJSONOpts{
ExplicitFormat: explicitFormat,
Format: format,
RawOutput: cmd.Root().Bool("raw-output"),
Title: "notifications duplicate",
Transform: transform,
})
}

func handleNotificationsListVersions(ctx context.Context, cmd *cli.Command) error {
client := courier.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
Expand Down
12 changes: 12 additions & 0 deletions pkg/cmd/notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ func TestNotificationsArchive(t *testing.T) {
})
}

func TestNotificationsDuplicate(t *testing.T) {
t.Skip("Mock server tests are disabled")
t.Run("regular flags", func(t *testing.T) {
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"notifications", "duplicate",
"--id", "id",
)
})
}

func TestNotificationsListVersions(t *testing.T) {
t.Skip("Mock server tests are disabled")
t.Run("regular flags", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package cmd

const Version = "3.11.2" // x-release-please-version
const Version = "3.12.0" // x-release-please-version
Loading