-
Notifications
You must be signed in to change notification settings - Fork 607
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
Add the /api/private/crate-owner-invitations
endpoint
#3763
Add the /api/private/crate-owner-invitations
endpoint
#3763
Conversation
a69aa9f
to
27bcaf3
Compare
So there is no way to list all outstanding invitations you created? Only for specific crates or invitees? |
Not in the current implementation. This API is going to be used only by the crates.io frontend, and I'm not aware of plans to display all the invitations sent by the current user. Adding a new list filter is trivial though, and if @Turbo87 wants to implement showing all the invitations sent by the current user in the frontend I'm happy to add the extra filter. |
27bcaf3
to
cdd06d6
Compare
sorry, forgot that this was still waiting on me 😞 looks great though, so: @bors r+ |
📌 Commit cdd06d6 has been approved by |
…bo87 Add the `/api/private/crate-owner-invitations` endpoint The endpoint provides a listing of all the invitations sent to the current user or all the invitations to a crate the user owns. Unauthenticated users or unrelated users won't be able to see others' invitations to prevent abuses. The two ways to query the endpoint are: GET /api/private/crate-owner-invitations?crate_name={name} GET /api/private/crate-owner-invitations?invitee_id={uid} The endpoint is paginated using only seek-based pagination, and the next page field is provided when more results are available. Once the frontend switches to use the new endpoint we can remove safely remove the old "v1" endpoint, as that's only used for the frontend. Because of this, the "v1" endpoint internally uses the same logic as the new one and converts the data to the old schema. Part of #2868 r? `@Turbo87`
💔 Test failed - checks-actions |
The endpoint provides a listing of all the invitations sent to the current user or all the invitations to a crate the user owns. Unauthenticated users or unrelated users won't be able to see others' invitations to prevent abuses. The two ways to query the endpoint are: GET /api/private/crate-owner-invitations?crate_name={name} GET /api/private/crate-owner-invitations?invitee_id={uid} The endpoint is paginated using only seek-based pagination, and the next page field is provided when more results are available. Once the frontend switches to use the new endpoint we can remove safely remove the old "v1" endpoint, as that's only used for the frontend. Because of this, the "v1" endpoint internally uses the same logic as the new one and converts the data to the old schema.
cdd06d6
to
2d1ac26
Compare
rebased to get rid of the merge failure :) |
@bors r+ |
📌 Commit 2d1ac26 has been approved by |
☀️ Test successful - checks-actions |
@@ -127,6 +127,12 @@ pub fn build_router(app: &App) -> RouteBuilder { | |||
// Metrics | |||
router.get("/api/private/metrics/:kind", C(metrics::prometheus)); | |||
|
|||
// Crate ownership invitations management in the frontend | |||
router.get( | |||
"/api/private/crate-owner-invitations", |
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.
hmm, probably should've noticed this earlier: we've been using snake_case for all the URLs so far, instead of kebab-case
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.
Ugh, could you send a PR renaming the endpoints?
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.
yep, will do :)
Rename `GET /api/private/crate-owner-invitations` to `GET /api/private/crate_owner_invitations` ... because the rest of the API also uses underscores Addresses #3763 (comment) :)
mirage/crate-owner-invitation: Adjust fake API to match the real API #3763 changed a few minor things about the crate owner invitations responses. This PR adjusts our mirage code to match these changes (excluding pagination).
The endpoint provides a listing of all the invitations sent to the current user or all the invitations to a crate the user owns. Unauthenticated users or unrelated users won't be able to see others' invitations to prevent abuses.
The two ways to query the endpoint are:
The endpoint is paginated using only seek-based pagination, and the next page field is provided when more results are available.
Once the frontend switches to use the new endpoint we can remove safely remove the old "v1" endpoint, as that's only used for the frontend. Because of this, the "v1" endpoint internally uses the same logic as the new one and converts the data to the old schema.
Part of #2868
r? @Turbo87