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: Add public API endpoint to fetch user sessions #840

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Sep 26, 2024

ref: https://github.com/codecov/internal-issues/issues/723

Add a new public V2 API endpoint to return list of users' login session status:

GET https://api.codecov.io/api/v2/{service}/{owner_username}/user-sessions?page={page}&page_size={page_size}

Returns a paginated list of users' login session for the specified owner (org)

Note: Only callable if user is an admin of the org.

Params:

service (string): [required] Git hosting service provider
owner_username (string): [required] username from service provider
page (integer): A page number within the paginated result set.
page_size (integer): Number of results to return per page.

Response:

{
    count: integer,
    next: uri, 
    previous: uri,
    results: [{
        name: string,
        username: string,
        has_active_session: boolean,
        expiry_date: date-time
    }]
}

has_active_session: user has a session and its expiry date is in the future
expiry_date: the longest remaining login session timestamp

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-notifications
Copy link

codecov-notifications bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.26%. Comparing base (f203361) to head (c4c2a34).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #840   +/-   ##
=======================================
  Coverage   96.25%   96.26%           
=======================================
  Files         814      814           
  Lines       18656    18680   +24     
=======================================
+ Hits        17958    17982   +24     
  Misses        698      698           
Flag Coverage Δ
unit 92.52% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 92.52% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerrySentry JerrySentry marked this pull request as ready for review September 26, 2024 19:20
@JerrySentry JerrySentry added this pull request to the merge queue Sep 27, 2024
Merged via the queue into main with commit aa0e363 Sep 27, 2024
32 checks passed
@JerrySentry JerrySentry deleted the sep_26_sessions branch September 27, 2024 19:02
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