Skip to content

Commit c8b54e9

Browse files
committed
Add new endpoint for repositories overview
1 parent aa2f031 commit c8b54e9

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/collections/RepositoryCollection.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { OmahaCollection } from '../client/OmahaCollection';
22
import { Repository } from '../entities/Repository';
33
import { DeleteObjectResponse } from './generic/DeleteObjectResponse';
44
import { CreateRepositoryRequest } from './repository/CreateRepositoryRequest';
5+
import { RepositoryOverview } from './repository/RepositoryOverview';
56
import { RepositoryWithCollaboration } from './repository/RepositoryWithCollaboration';
67
import { UpdateRepositoryRequest } from './repository/UpdateRepositoryRequest';
78
import { RepositoryTokensCollection } from './RepositoryTokensCollection';
@@ -22,6 +23,15 @@ export class RepositoryCollection extends OmahaCollection {
2223
return this.client.get<RepositoryWithCollaboration[]>('/v1/repositories');
2324
}
2425

26+
/**
27+
* Gets a list of all repositories that the current token has access to, along with the collaboration, latest
28+
* release, and the last year's worth of weekly download statistics for each.
29+
* @scope None, but an account-based token is required.
30+
*/
31+
public async overview() {
32+
return this.client.get<RepositoryOverview[]>('/v1/repositories/overview');
33+
}
34+
2535
/**
2636
* Gets a specific repository that the current token has access to.
2737
*/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Collaboration } from '../../entities/Collaboration';
2+
import { Release } from '../../entities/Release';
3+
import { Repository } from '../../entities/Repository';
4+
import { WeeklyDownloadCount } from '../downloads/WeeklyDownloadCount';
5+
6+
export interface RepositoryOverview {
7+
8+
/**
9+
* The repository.
10+
*/
11+
repository: Repository;
12+
13+
/**
14+
* The user's collaboration for this repository.
15+
*/
16+
collaboration: Collaboration;
17+
18+
/**
19+
* The greatest published release for the repository or `undefined` if there aren't any published releases.
20+
*/
21+
release?: Release;
22+
23+
/**
24+
* The last year's worth of weekly download statistics for this repository.
25+
*/
26+
downloads: WeeklyDownloadCount[];
27+
28+
}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export * from './collections/repository/tokens/UpdateRepositoryTokenRequest';
8484
export * from './collections/repository/tokens/UpdateRepositoryTokenResponse';
8585
export * from './collections/repository/CreateRepositoryRequest';
8686
export * from './collections/repository/RepositoryWithCollaboration';
87+
export * from './collections/repository/RepositoryOverview';
8788
export * from './collections/repository/UpdateRepositoryRequest';
8889

8990
export * from './collections/tags/CreateTagRequest';

0 commit comments

Comments
 (0)