-
Notifications
You must be signed in to change notification settings - Fork 119
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
feat(users): add getUserNotifications function #294
Conversation
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.
found one nitpick, but otherwise, looks really good.
welcome aboard! ⛵️
@@ -68,3 +68,35 @@ export function getUser( | |||
// send the request | |||
return request(url, options); | |||
} | |||
|
|||
export interface IGetUserNotificationRequestOptions extends IRequestOptions { |
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.
IRequestOptions
already includes optional authentication, so no need to extend it with a custom interface.
since you want a UserSession specifically, you could also use IUserRequestOptions
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.
I was wondering about that but copied it from here. Is that an error or is it not needed there either?
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.
Oh, now I remember the other thing. I actually tried that but TS complained because the autehentication
on IRequestOptions
is an IAuthenticationManager
, not a UserSession
which I think is what I want. I'm a TS noob so advice is welcome.
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.
Gotcha, thanks John!
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.
LGTM - just a couple questions
@@ -465,3 +465,12 @@ export type esriUnits = | |||
| "esriSRUnit_Kilometer" | |||
| "esriSRUnit_NauticalMile" | |||
| "esriSRUnit_USNauticalMile"; | |||
|
|||
export interface INotification { |
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.
I think this interface could live in @esri/arcgis-rest-users, since it may only be used in that package - or are we putting all interfaces in common-types these days?
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.
i like where it is, but it'd be fine in this package too.
this is why no one knows where to put interfaces.
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.
That makes sense.
let url; | ||
let options = { httpMethod: "GET" } as IUserRequestOptions; | ||
|
||
const username = requestOptions.authentication.username; |
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.
is the idea that users can only fetch their own notifications?
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.
That was my thinking.
AFFECTS PACKAGES: @esri/arcgis-rest-common-types @esri/arcgis-rest-users
AFFECTS PACKAGES: @esri/arcgis-rest-users
6a69490
to
b4a55d0
Compare
Added |
return request(url, options); | ||
} | ||
|
||
export function removeNotification( |
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.
Pls add comments so the generated doc has something in it :)
AFFECTS PACKAGES:
@esri/arcgis-rest-common-types
@esri/arcgis-rest-users
Thought I'd take a stab at this. Not really done-done (I would want to add createNotification and removeNotification) but I would like feedback, especially of the "OMG you did this RONG" variety.