Skip to content

Commit 3200097

Browse files
committed
refactor types
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 967ce14 commit 3200097

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

src/renderer/utils/api/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
GetCommitCommentResponse,
1616
GetCommitResponse,
1717
GetReleaseResponse,
18+
HeadNotificationsResponse,
1819
IgnoreNotificationThreadSubscriptionResponse,
1920
ListNotificationsForAuthenticatedUserResponse,
2021
MarkNotificationThreadAsDoneResponse,
@@ -56,7 +57,7 @@ import {
5657
export function headNotifications(
5758
hostname: Hostname,
5859
token: Token,
59-
): AxiosPromise<void> {
60+
): AxiosPromise<HeadNotificationsResponse> {
6061
const url = getGitHubAPIBaseUrl(hostname);
6162
url.pathname += 'notifications';
6263

src/renderer/utils/api/graphql/generated/graphql.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21652,6 +21652,7 @@ export type PullRequestSuggestedReviewerActorsArgs = {
2165221652
before?: InputMaybe<Scalars['String']['input']>;
2165321653
first?: InputMaybe<Scalars['Int']['input']>;
2165421654
last?: InputMaybe<Scalars['Int']['input']>;
21655+
query?: InputMaybe<Scalars['String']['input']>;
2165521656
};
2165621657

2165721658

src/renderer/utils/api/types.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { components } from '@octokit/openapi-types';
12
import type { Endpoints } from '@octokit/types';
23

34
import type { Link } from '../../types';
@@ -10,12 +11,6 @@ export interface GitHubRESTError {
1011
export type ListNotificationsForAuthenticatedUserResponse =
1112
Endpoints['GET /notifications']['response']['data'];
1213

13-
export type MarkNotificationThreadAsReadResponse =
14-
Endpoints['PATCH /notifications/threads/{thread_id}']['response']['data'];
15-
16-
export type MarkNotificationThreadAsDoneResponse =
17-
Endpoints['DELETE /notifications/threads/{thread_id}']['response']['data'];
18-
1914
export type IgnoreNotificationThreadSubscriptionResponse =
2015
Endpoints['PUT /notifications/threads/{thread_id}/subscription']['response']['data'];
2116

@@ -31,5 +26,18 @@ export type GetReleaseResponse =
3126
export type RawGitHubNotification =
3227
Endpoints['GET /notifications']['response']['data'][number];
3328

34-
// FIXME - replace this if possible
35-
export type RawUser = Endpoints['GET /users/{username}']['response']['data'];
29+
export type RawUser = components['schemas']['simple-user'];
30+
31+
/**
32+
* These API endpoints don't return a response body
33+
*/
34+
// HEAD request - no response body
35+
export type HeadNotificationsResponse = NoResponseBody;
36+
37+
// Endpoints['PATCH /notifications/threads/{thread_id}']['response']['data'];
38+
export type MarkNotificationThreadAsReadResponse = NoResponseBody;
39+
40+
// Endpoints['DELETE /notifications/threads/{thread_id}']['response']['data']
41+
export type MarkNotificationThreadAsDoneResponse = NoResponseBody;
42+
43+
type NoResponseBody = void;

0 commit comments

Comments
 (0)