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
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ USAGE:
scw tem email get-statistics [arg=value ...]

ARGS:
[project-id] Number of emails for this Project (optional)
[domain-id] Number of emails sent from this domain (must be coherent with the `project_id` and the `organization_id`) (optional)
[since] Number of emails created after this date (optional)
[until] Number of emails created before this date (optional)
[mail-from] Number of emails sent with this `mail_from` sender's address (optional)
[project-id] (Optional) Number of emails for this Project
[domain-id] (Optional) Number of emails sent from this domain (must be coherent with the `project_id` and the `organization_id`)
[since] (Optional) Number of emails created after this date
[until] (Optional) Number of emails created before this date
[mail-from] (Optional) Number of emails sent with this sender's email address
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)

FLAGS:
Expand Down
29 changes: 20 additions & 9 deletions cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve the list of emails sent from a specific domain or for a specific Project or Organization. You must specify the `region`.
You can filter your emails in ascending or descending order using:
- created_at
- updated_at
- status
- mail_from
- mail_rcpt
- subject.

USAGE:
scw tem email list [arg=value ...]

ARGS:
[project-id] ID of the Project in which to list the emails (optional)
[domain-id] ID of the domain for which to list the emails (optional)
[message-id] ID of the message for which to list the emails (optional)
[subject] Subject of the email
[since] List emails created after this date (optional)
[until] List emails created before this date (optional)
[mail-from] List emails sent with this `mail_from` sender's address (optional)
[mail-to] List emails sent with this `mail_to` recipient's address (optional)
[statuses.{index}] List emails having any of this status (optional) (unknown | new | sending | sent | failed | canceled)
[project-id] (Optional) ID of the Project in which to list the emails
[domain-id] (Optional) ID of the domain for which to list the emails
[message-id] (Optional) ID of the message for which to list the emails
[since] (Optional) List emails created after this date
[until] (Optional) List emails created before this date
[mail-from] (Optional) List emails sent with this sender's email address
[mail-rcpt] (Optional) List emails sent to this recipient's email address
[statuses.{index}] (Optional) List emails with any of these statuses (unknown | new | sending | sent | failed | canceled)
[subject] (Optional) List emails with this subject
[order-by] (Optional) List emails corresponding to specific criteria (created_at_desc | created_at_asc | updated_at_desc | updated_at_asc | status_desc | status_asc | mail_from_desc | mail_from_asc | mail_rcpt_desc | mail_rcpt_asc | subject_desc | subject_asc)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | all)

DEPRECATED ARGS:
[mail-to] (Deprecated) List emails sent to this recipient's email address

FLAGS:
-h, --help help for list

Expand Down
37 changes: 23 additions & 14 deletions docs/commands/tem.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,25 @@ scw tem email get-statistics [arg=value ...]

| Name | | Description |
|------|---|-------------|
| project-id | | Number of emails for this Project (optional) |
| domain-id | | Number of emails sent from this domain (must be coherent with the `project_id` and the `organization_id`) (optional) |
| since | | Number of emails created after this date (optional) |
| until | | Number of emails created before this date (optional) |
| mail-from | | Number of emails sent with this `mail_from` sender's address (optional) |
| project-id | | (Optional) Number of emails for this Project |
| domain-id | | (Optional) Number of emails sent from this domain (must be coherent with the `project_id` and the `organization_id`) |
| since | | (Optional) Number of emails created after this date |
| until | | (Optional) Number of emails created before this date |
| mail-from | | (Optional) Number of emails sent with this sender's email address |
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |



### List emails

Retrieve the list of emails sent from a specific domain or for a specific Project or Organization. You must specify the `region`.
You can filter your emails in ascending or descending order using:
- created_at
- updated_at
- status
- mail_from
- mail_rcpt
- subject.

**Usage:**

Expand All @@ -245,15 +252,17 @@ scw tem email list [arg=value ...]

| Name | | Description |
|------|---|-------------|
| project-id | | ID of the Project in which to list the emails (optional) |
| domain-id | | ID of the domain for which to list the emails (optional) |
| message-id | | ID of the message for which to list the emails (optional) |
| subject | | Subject of the email |
| since | | List emails created after this date (optional) |
| until | | List emails created before this date (optional) |
| mail-from | | List emails sent with this `mail_from` sender's address (optional) |
| mail-to | | List emails sent with this `mail_to` recipient's address (optional) |
| statuses.{index} | One of: `unknown`, `new`, `sending`, `sent`, `failed`, `canceled` | List emails having any of this status (optional) |
| project-id | | (Optional) ID of the Project in which to list the emails |
| domain-id | | (Optional) ID of the domain for which to list the emails |
| message-id | | (Optional) ID of the message for which to list the emails |
| since | | (Optional) List emails created after this date |
| until | | (Optional) List emails created before this date |
| mail-from | | (Optional) List emails sent with this sender's email address |
| ~~mail-to~~ | Deprecated | (Deprecated) List emails sent to this recipient's email address |
| mail-rcpt | | (Optional) List emails sent to this recipient's email address |
| statuses.{index} | One of: `unknown`, `new`, `sending`, `sent`, `failed`, `canceled` | (Optional) List emails with any of these statuses |
| subject | | (Optional) List emails with this subject |
| order-by | One of: `created_at_desc`, `created_at_asc`, `updated_at_desc`, `updated_at_asc`, `status_desc`, `status_asc`, `mail_from_desc`, `mail_from_asc`, `mail_rcpt_desc`, `mail_rcpt_asc`, `subject_desc`, `subject_asc` | (Optional) List emails corresponding to specific criteria |
| region | Default: `fr-par`<br />One of: `fr-par`, `all` | Region to target. If none is passed will use default region from the config |


Expand Down
66 changes: 44 additions & 22 deletions internal/namespaces/tem/v1alpha1/tem_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,15 @@ func temEmailGet() *core.Command {

func temEmailList() *core.Command {
return &core.Command{
Short: `List emails`,
Long: `Retrieve the list of emails sent from a specific domain or for a specific Project or Organization. You must specify the ` + "`" + `region` + "`" + `.`,
Short: `List emails`,
Long: `Retrieve the list of emails sent from a specific domain or for a specific Project or Organization. You must specify the ` + "`" + `region` + "`" + `.
You can filter your emails in ascending or descending order using:
- created_at
- updated_at
- status
- mail_from
- mail_rcpt
- subject.`,
Namespace: "tem",
Resource: "email",
Verb: "list",
Expand All @@ -231,68 +238,83 @@ func temEmailList() *core.Command {
ArgSpecs: core.ArgSpecs{
{
Name: "project-id",
Short: `ID of the Project in which to list the emails (optional)`,
Short: `(Optional) ID of the Project in which to list the emails`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "domain-id",
Short: `ID of the domain for which to list the emails (optional)`,
Short: `(Optional) ID of the domain for which to list the emails`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "message-id",
Short: `ID of the message for which to list the emails (optional)`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "subject",
Short: `Subject of the email`,
Short: `(Optional) ID of the message for which to list the emails`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "since",
Short: `List emails created after this date (optional)`,
Short: `(Optional) List emails created after this date`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "until",
Short: `List emails created before this date (optional)`,
Short: `(Optional) List emails created before this date`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "mail-from",
Short: `List emails sent with this ` + "`" + `mail_from` + "`" + ` sender's address (optional)`,
Short: `(Optional) List emails sent with this sender's email address`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "mail-to",
Short: `List emails sent with this ` + "`" + `mail_to` + "`" + ` recipient's address (optional)`,
Short: `(Deprecated) List emails sent to this recipient's email address`,
Required: false,
Deprecated: true,
Positional: false,
},
{
Name: "mail-rcpt",
Short: `(Optional) List emails sent to this recipient's email address`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "statuses.{index}",
Short: `List emails having any of this status (optional)`,
Short: `(Optional) List emails with any of these statuses`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"unknown", "new", "sending", "sent", "failed", "canceled"},
},
{
Name: "subject",
Short: `(Optional) List emails with this subject`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "order-by",
Short: `(Optional) List emails corresponding to specific criteria`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"created_at_desc", "created_at_asc", "updated_at_desc", "updated_at_asc", "status_desc", "status_asc", "mail_from_desc", "mail_from_asc", "mail_rcpt_desc", "mail_rcpt_asc", "subject_desc", "subject_asc"},
},
core.RegionArgSpec(scw.RegionFrPar, scw.Region(core.AllLocalities)),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
Expand Down Expand Up @@ -327,35 +349,35 @@ func temEmailGetStatistics() *core.Command {
ArgSpecs: core.ArgSpecs{
{
Name: "project-id",
Short: `Number of emails for this Project (optional)`,
Short: `(Optional) Number of emails for this Project`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "domain-id",
Short: `Number of emails sent from this domain (must be coherent with the ` + "`" + `project_id` + "`" + ` and the ` + "`" + `organization_id` + "`" + `) (optional)`,
Short: `(Optional) Number of emails sent from this domain (must be coherent with the ` + "`" + `project_id` + "`" + ` and the ` + "`" + `organization_id` + "`" + `)`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "since",
Short: `Number of emails created after this date (optional)`,
Short: `(Optional) Number of emails created after this date`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "until",
Short: `Number of emails created before this date (optional)`,
Short: `(Optional) Number of emails created before this date`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "mail-from",
Short: `Number of emails sent with this ` + "`" + `mail_from` + "`" + ` sender's address (optional)`,
Short: `(Optional) Number of emails sent with this sender's email address`,
Required: false,
Deprecated: false,
Positional: false,
Expand Down