-
Notifications
You must be signed in to change notification settings - Fork 37
add consumer key helpers #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
README.md
Outdated
|
|
||
| // Allow GET method on /me | ||
| ckReq.AddRule("GET", "/me") | ||
| ckReq.GenerateRulesSingle("/xdsl", ovh.ReadOnly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, xdsl -> me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thx.
|
Adding @LukeMarlin to the discussion for C# wrapper |
|
Cool feature. Only problem for me is that it can be too restrictive (RW contains too much). I'd add an overloaded method taking custom verbs as a |
|
It's only helpers, the goal is to make the developer life easier. There is still a "AddRule" method for fine-grained right control. |
|
Sure, but AddRule does not support the nice recurse param. |
Would it be better with like an intermediate |
|
yep, distinct delete could ba a good thing.. Maybe distinct write and others actions ? but i don't know how |
|
Adding |
|
v2 pushed with Typo fixes from @gregdel and @PouuleT and intermediate authorization level suggested by @LukeMarlin. |
|
Why not do something like |
|
API could be like: const (
ReadOnly = []string{"GET"}
ReadWrite = []string{"GET", "POST", "PUT", "DELETE"}
ReadWriteSafe = []string{"GET", "POST", "PUT"}
)
func AddRule(verb, pattern string) {}
func AddRules(verbs []string, pattern string) {}
func AddRecursiveRules(verbs []string, path string) {}Go ? |
|
Exactly, +1 |
|
@cygy does is look good to you too for Swift wrapper ? |
|
I have already some helpers but I can update if needed. |
|
And there it is. I much prefer this new API anyway. Less code, less magic. As far as I'm concerned, we're ready to go. |
README.md
Outdated
|
|
||
| // Allow GET method on /xdsl and all its sub routes | ||
| ckReq.AddRule("GET", "/xdsl/*") | ||
| ckReq.AddRules(ovh.ReadOnly, "/xdsl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be:
ckReq.AddRecursiveRules(ovh.ReadOnly, "/xdsl")To match the comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn it. Ur right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
|
As far as I'm concerned: Ready. |
|
Merged, thanks @yadutaf. Good work ! |
|
\o/ Starting Python version. |
Following discussion with @VincentCasse on php-ovh-sms, here is a design proposal for improved consumer key helper. See Readme and test for examples. But, in a nutshell, it allows to build autorization requests for a given api endpoint prefix and and all sub-path or only the specific route.
ReadOnly is mapped to "GET". ReadWrite to all HTTP Methods.
This PR is about the design itself. If we all agree, we'll implement this in the other wrappers.
At a later time, we may consider human readable aliases for sections of /me and /auth like
...
ping @gregdel, @VincentCasse