From: Mira Limbeck <m.limbeck@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-api] API: Mailtracker: add values to rstatus and dstatus description
Date: Fri, 13 Aug 2021 09:44:11 +0200 [thread overview]
Message-ID: <4265c847-d303-609c-172c-2e6c32ada8ae@proxmox.com> (raw)
In-Reply-To: <20210812153010.2327589-1-a.lauterer@proxmox.com>
some comments inline
On 8/12/21 5:30 PM, Aaron Lauterer wrote:
> The possible values were only documented within the source code. Having
> them as part of the API description will help people wanting to use the
> tracker API endpoint interpreting the results.
>
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> src/PMG/API2/MailTracker.pm | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/PMG/API2/MailTracker.pm b/src/PMG/API2/MailTracker.pm
> index 187decf..952abc8 100644
> --- a/src/PMG/API2/MailTracker.pm
> +++ b/src/PMG/API2/MailTracker.pm
> @@ -38,6 +38,14 @@ my $statmap = {
> Q => 'quarantine',
> };
>
> +my $print_statmap = sub {
> + my $map = "";
> + foreach my $key (sort keys %$statmap) {
> + $map .= "$key: $statmap->{$key}\n";
> + }
> + return $map;
> +};
> +
> my $run_pmg_log_tracker = sub {
> my ($args, $includelog) = @_;
>
> @@ -247,13 +255,15 @@ my $email_log_property_desc = {
> type => 'integer',
> },
> dstatus => {
> - description => "Delivery status.",
> + description => "Delivery status. Can be one of the following values:\n" .
> + $print_statmap->(),
Maybe, instead of adding it to the description, change the type from
`string` to `enum` with the few possible values.
This should result in a nice overview of the possible return values in
the API viewer.
> type => 'string',
> minLength => 1,
> maxLength => 1,
> },
> rstatus => {
> - description => "Delivery status of relayed mail.",
> + description => "Delivery status of relayed mail. Can be one of the " .
> + "following values:\n" . $print_statmap->(),
Same here, as only `2`, `4` and `5` are valid `rstatus` values.
> type => 'string',
> minLength => 1,
> maxLength => 1,
prev parent reply other threads:[~2021-08-13 7:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 15:30 Aaron Lauterer
2021-08-13 7:44 ` Mira Limbeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4265c847-d303-609c-172c-2e6c32ada8ae@proxmox.com \
--to=m.limbeck@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox