Skip to content

Commit

Permalink
feat(tem): add support for search (#3159)
Browse files Browse the repository at this point in the history
Co-authored-by: Rémy Léone <rleone@scaleway.com>
  • Loading branch information
scaleway-bot and remyleone committed Jun 1, 2023
1 parent e8d3cc6 commit fe599d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
8 changes: 1 addition & 7 deletions cmd/scw/testdata/test-all-usage-tem-email-list-usage.golden
@@ -1,13 +1,6 @@
🎲🎲🎲 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 ...]
Expand All @@ -22,6 +15,7 @@ ARGS:
[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
[search] (Optional) List emails by searching to all fields
[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)

Expand Down
8 changes: 1 addition & 7 deletions docs/commands/tem.md
Expand Up @@ -233,13 +233,6 @@ scw tem email get-statistics [arg=value ...]
### 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 @@ -262,6 +255,7 @@ scw tem email list [arg=value ...]
| 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 |
| search | | (Optional) List emails by searching to all fields |
| 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
18 changes: 9 additions & 9 deletions internal/namespaces/tem/v1alpha1/tem_cli.go
Expand Up @@ -221,15 +221,8 @@ 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` + "`" + `.
You can filter your emails in ascending or descending order using:
- created_at
- updated_at
- status
- mail_from
- mail_rcpt
- subject.`,
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` + "`" + `.`,
Namespace: "tem",
Resource: "email",
Verb: "list",
Expand Down Expand Up @@ -307,6 +300,13 @@ You can filter your emails in ascending or descending order using:
Deprecated: false,
Positional: false,
},
{
Name: "search",
Short: `(Optional) List emails by searching to all fields`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "order-by",
Short: `(Optional) List emails corresponding to specific criteria`,
Expand Down

0 comments on commit fe599d4

Please sign in to comment.