Skip to content
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

Merged
merged 6 commits into from
Sep 6, 2018

Conversation

mjuniper
Copy link
Member

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.

Copy link
Contributor

@jgravois jgravois left a 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 {
Copy link
Contributor

@jgravois jgravois Aug 23, 2018

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

Copy link
Member Author

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks John!

@coveralls
Copy link

coveralls commented Aug 23, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 4bee414 on f/user-notifications into da410d3 on master.

Copy link
Member

@tomwayson tomwayson left a 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 {
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my thinking.

@mjuniper mjuniper changed the title [WIP] feat(users): add getUserNotifications function feat(users): add getUserNotifications function Aug 30, 2018
@mjuniper
Copy link
Member Author

mjuniper commented Sep 6, 2018

Added removeNotification + tests. Feedback welcome.

return request(url, options);
}

export function removeNotification(
Copy link
Member

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 :)

@mjuniper mjuniper merged commit 40bc5c1 into master Sep 6, 2018
@jgravois jgravois deleted the f/user-notifications branch September 14, 2018 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants