Cli-microsoft365: New command: graph subscription add

Created on 7 Sep 2019  ·  16Comments  ·  Source: pnp/cli-microsoft365

graph subscription add [options]

Subscribes a listener application to receive notifications when the requested type of changes occur to the specified resource in Microsoft Graph.

| Options | |
| ------------- |-------------|
| -r, --resource <resource> | The resource that will be monitored for changes |
| -c, --changeType <changeType> | The type of change(s) in the monitored resource that will raise a notification. Allowed values are created updated deleted |
| -u, --notificationUrl <notificationUrl> | The URL that will receive the notifications |
| -e, --expirationDateTime [datetime] | When the webhook subscription expires. Will be set to maximum value for resource if not provided |
| -s, --clientState [clientState] | A client state value sent in each notification |

More information: https://docs.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&tabs=http

good first issue new feature work in progress

All 16 comments

Nice suggestion. How would you spec it @garrytrinder?

I just threw it in to capture a quick thought I had this morning, so was planning to come back with a design😊

I’m struggling to depict —changeType as it has a defined list of options to choose from [‘created’,’updated’,’deleted’] which can be one or all.

I’d see this as a list of options that the user can tab through as it is a defined list and would look like this on the command line

graph subscription add —changeType created updated deleted —resource ...

Are there any commands that use this approach already in the CLI?

@waldekmastykarz updated the issue with an initial spec. That look ok?

In general the spec looks ok. We have a number of commands that allow only predefined values. For one, check the base class for command where we defined that output can be either json or text. In specs, we typically denote it as json|text

The short name of an option must be single-letter. In bash, -cs is the same as -c -s, so we need to trim it to a single letter. Short name is not a requirement btw, so if it doesn't feel natural, we don't need to offer it. Typically, for URLs we use -u 🙂

We're almost there. Nice job!

Thanks @waldekmastykarz 👍🏻 spec has been updated

Looks good to me! You want to take it? 😄

Absolutely 😁

Awesome! Appreciate your help! 👍

Just an update on this, no progress has been made due to me working on the personal site command which required investigation into a bug in the SharePoint API.

I’ll be planning to work on this in the coming week however

Perfect. Thanks for the update 👍

Opening this up for someone else to pick up

Hi @garrytrinder , can I take this one ?

All yours @ypcode thanks for your help 👍🏻

Hi @garrytrinder , I am going to begin this one.

One note regarding the specs for the changeType that allow multiple combined values, I would suggest the --changeType argument's value to be a comma-separated list of values as a single string (e.g. --changeType "Created,Updated".

I'll start it in that direction, let me know if you have any remarks !

Good catch @ypcode 👍

Good catch @ypcode

My initial thought on this command is that --changeType would accept multi predefined values as it would be the easier approach for the end user, however from looking at the Vorpal docs and doing some extra research this doesn't appear to be implemented, so would require some customisations to Vorpal.

Happy with your approach, thanks for the PR 👍🏻

Was this page helpful?
0 / 5 - 0 ratings