Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Api notifications#153

Merged
technoweenie merged 23 commits intomasterfromapi-notifications
Oct 26, 2012
Merged

Api notifications#153

technoweenie merged 23 commits intomasterfromapi-notifications
Oct 26, 2012

Conversation

@technoweenie
Copy link
Contributor

Trying something new here: spike out some documentation in public while we work on the implementation of the Notifications API.

  • [x] Add etag/last-modified support for polling
  • [x] Show recent commenter + body
  • [ ] Allow marking issues/commits/pulls as read, without having to fetch a thread's summary id.
  • [x] Add some kind of type/ID to identify the thread type (commit vs pull vs issue).

You can read theunprocessed docs, or pull this down and build them locally (nanoc ; nanoc view ; open http://localhost:3000).

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to use a URI template here: `/notifications{?all,participating,since}

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Ah dang, I should make all the urls into templates. Thanks for reminding me.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Also, do you prefer parameters or endpoints like/notifications/all and/notifications/participating? I guess they are technically separate collections.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mark all notifications a read? If not now is the appropriate notification identified? Wouldn'tDELETE be more appropriate than POST?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, this endpoint is for all notifications. There's also a per-repository URL: "/repos/:owner/:name/mark". Summaries have their own endpoint,/notifications/summaries/:id/mark.

I used POST instead of DELETE because you can still see the notifications if you pass?all=1.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see.DELETE might be a little weird in that case. I don't really like those rpc style actions, though. I prefer the following

==>

PUT /notifications/summaries/:idcontent-type: app/v3{unread: false}

<===

200 OK

Copy link
Contributor

Choose a reason for hiding this comment

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

The double negative of the unread property in this case is a little awkward. Maybe this would be a better ux:

===>   PUT /notifications/summaries/:id  content-type: app/v3  {read: true}<----  200 OK

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Would this be applicable for collections too?

PUT /notifications{read: true}

Copy link
Contributor

Choose a reason for hiding this comment

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

I thinkPUT would be a better method for this. Even if we don't want clients to have to send the full representation we should still usePUT. A PUT w/o a complete long form representation is not a "partial put" unless the server is unable to take that representation and convert it into the full representation using the existing state of the system in an idempotent manner. So PUTs with a range header are partial and not ok because if you repeat them they are not idempotent. PUTs with a "lite" representation of the resource arenot partial puts, even though that "lite" representation does not include all the resource information.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Well, we use PATCH everywhere else. Had a big discussion internally and on Twitter back when I was designing the API. Seems like a difference in the vague specs are interpreted.

At least for now, I think going with PATCH for consistency is best.

Copy link
Contributor

Choose a reason for hiding this comment

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

probably, i just hate patch so much fo this type of use case.

technoweenie added a commit that referenced this pull requestOct 26, 2012
@technoweenietechnoweenie merged commitc0fae72 intomasterOct 26, 2012
spicycode pushed a commit that referenced this pull requestNov 24, 2014
…large-files-blog-postSuggested edits to Gist file truncation post
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@technoweenie@pezra@sigmavirus24@pengwynn

[8]ページ先頭

©2009-2025 Movatter.jp