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

stars api #246

Merged
merged 3 commits into from
Dec 14, 2023
Merged

stars api #246

merged 3 commits into from
Dec 14, 2023

Conversation

khoroshevskyi
Copy link
Member

Added stars endpoint

Copy link

cloudflare-workers-and-pages bot commented Dec 13, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: fd82c09
Status:🚫  Build failed.

View logs

Copy link
Member

@nleroy917 nleroy917 left a comment

Choose a reason for hiding this comment

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

So I think this will be sufficient for us now, but I wonder if we thin about the API design in the future. This is how GitHub does it:

Lists the people that have starred the repository.
GET /repos/{owner}/{repo}/stargazers

Lists repositories the authenticated user has starred.
GET /user/starred

Star a repository for the authenticated user.
PUT /user/starred/{owner}/{repo}

Unstar a repository for the authenticated user.
DELETE /user/starred/{owner}/{repo}

List repositories starred by a user.
GET /users/{username}/starred

I'm curious if we want to emulate at all how this is done?

@@ -42,6 +42,12 @@ class ForkRequest(BaseModel):
fork_description: Optional[str] = None


class FavoriteRequest(BaseModel):
Copy link
Member

Choose a reason for hiding this comment

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

Maybe StarRequest ?

@nleroy917
Copy link
Member

yeah so I think if we wanted to emulate github, the only major change is just instead of having the namspace/project:tag in the body of the request, we'd add it to the actual URL path:

POST /api/v1/namespaces/{namespace}/stars/{namespace}/{project}

I kind of like our approach better, so I might stick with that and divert from github here.

@nleroy917 nleroy917 merged commit 3b3d16b into dev Dec 14, 2023
1 of 2 checks passed
@khoroshevskyi khoroshevskyi deleted the favorites_api branch January 9, 2024 21:10
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.

2 participants