Skip to content

Commit 3e7cf50

Browse files
chore(notifications): regen SDK against renamed path placeholder
Picks up AudiusProject/api#838, which renamed the OpenAPI path placeholder on /notifications/{user_id} and /notifications/{user_id}/playlist_updates to /notifications/{id} and /notifications/{id}/playlist_updates. With the collision against the query param gone, the generator now emits clean shapes: GetNotificationsRequest { id: string; userId?: string; ... } GetPlaylistUpdatesRequest { id: string; userId?: string } Update the three call sites to use { id, userId } instead of the previous awkward { userId, userId2 }. Concrete URL is unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 5de4bc7 commit 3e7cf50

4 files changed

Lines changed: 25 additions & 25 deletions

File tree

packages/common/src/api/tan-query/notifications/useNotificationUnreadCount.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ export const useNotificationUnreadCount = () => {
3535
const response = await (
3636
sdk.notifications as {
3737
getNotifications: (params: {
38-
userId: string
38+
id: string
3939
limit?: number
4040
}) => Promise<{
4141
data?: { unreadCount?: number }
4242
}>
4343
}
4444
).getNotifications({
45-
userId: Id.parse(currentUserId),
45+
id: Id.parse(currentUserId),
4646
limit: 0
4747
})
4848
return response?.data?.unreadCount ?? 0

packages/common/src/api/tan-query/notifications/useNotifications.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ export const useNotifications = (options?: QueryOptions) => {
7676
queryFn: async ({ pageParam = null }) => {
7777
const sdk = await audiusSdk()
7878
const response = await sdk.notifications.getNotifications({
79+
id: Id.parse(currentUserId),
80+
// Requester id sent as `?user_id=` so the backend personalizes
81+
// embedded related.users (e.g. does_current_user_follow). The path
82+
// id alone identifies the notifications owner, not the requester.
7983
userId: Id.parse(currentUserId),
80-
// Requester id sent as `?user_id=`. Needed so the backend personalizes
81-
// embedded related.users (e.g. does_current_user_follow) — the path
82-
// userId alone identifies the notifications owner, not the requester.
83-
userId2: Id.parse(currentUserId),
8484
limit: DEFAULT_LIMIT,
8585
timestamp: pageParam?.timestamp,
8686
groupId: pageParam?.groupId

packages/common/src/api/tan-query/playlist-updates/usePlaylistUpdates.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ export const usePlaylistUpdates = <TResult = PlaylistUpdate[]>(
3838
const sdk = await audiusSdk()
3939
// sdk.notifications.getPlaylistUpdates is not currently typed in the
4040
// public SDK surface; cast to the expected shape used in the legacy saga.
41-
// userId2 carries the requester id as `?user_id=` so the backend can
41+
// userId carries the requester id as `?user_id=` so the backend can
4242
// personalize related.users in the response.
4343
const response = (await (
4444
sdk.notifications as {
4545
getPlaylistUpdates: (params: {
46-
userId: string
47-
userId2?: string
46+
id: string
47+
userId?: string
4848
}) => Promise<PlaylistUpdatesResponse>
4949
}
5050
).getPlaylistUpdates({
51-
userId: Id.parse(currentUserId),
52-
userId2: Id.parse(currentUserId)
51+
id: Id.parse(currentUserId),
52+
userId: Id.parse(currentUserId)
5353
})) as PlaylistUpdatesResponse | undefined
5454

5555
return transformAndCleanList(

packages/sdk/src/sdk/api/generated/default/apis/NotificationsApi.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ import {
2626
} from '../models';
2727

2828
export interface GetNotificationsRequest {
29-
userId: string;
30-
userId2?: string;
29+
id: string;
30+
userId?: string;
3131
timestamp?: number;
3232
groupId?: string;
3333
limit?: number;
3434
types?: Array<GetNotificationsTypesEnum>;
3535
}
3636

3737
export interface GetPlaylistUpdatesRequest {
38-
userId: string;
39-
userId2?: string;
38+
id: string;
39+
userId?: string;
4040
}
4141

4242
/**
@@ -49,14 +49,14 @@ export class NotificationsApi extends runtime.BaseAPI {
4949
* Get notifications for user ID
5050
*/
5151
async getNotificationsRaw(params: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationsResponse>> {
52-
if (params.userId === null || params.userId === undefined) {
53-
throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling getNotifications.');
52+
if (params.id === null || params.id === undefined) {
53+
throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getNotifications.');
5454
}
5555

5656
const queryParameters: any = {};
5757

58-
if (params.userId2 !== undefined) {
59-
queryParameters['user_id'] = params.userId2;
58+
if (params.userId !== undefined) {
59+
queryParameters['user_id'] = params.userId;
6060
}
6161

6262
if (params.timestamp !== undefined) {
@@ -78,7 +78,7 @@ export class NotificationsApi extends runtime.BaseAPI {
7878
const headerParameters: runtime.HTTPHeaders = {};
7979

8080
const response = await this.request({
81-
path: `/notifications/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(params.userId))),
81+
path: `/notifications/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))),
8282
method: 'GET',
8383
headers: headerParameters,
8484
query: queryParameters,
@@ -100,20 +100,20 @@ export class NotificationsApi extends runtime.BaseAPI {
100100
* Get playlists the user has saved that have been updated for user ID
101101
*/
102102
async getPlaylistUpdatesRaw(params: GetPlaylistUpdatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlaylistUpdatesResponse>> {
103-
if (params.userId === null || params.userId === undefined) {
104-
throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling getPlaylistUpdates.');
103+
if (params.id === null || params.id === undefined) {
104+
throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getPlaylistUpdates.');
105105
}
106106

107107
const queryParameters: any = {};
108108

109-
if (params.userId2 !== undefined) {
110-
queryParameters['user_id'] = params.userId2;
109+
if (params.userId !== undefined) {
110+
queryParameters['user_id'] = params.userId;
111111
}
112112

113113
const headerParameters: runtime.HTTPHeaders = {};
114114

115115
const response = await this.request({
116-
path: `/notifications/{user_id}/playlist_updates`.replace(`{${"user_id"}}`, encodeURIComponent(String(params.userId))),
116+
path: `/notifications/{id}/playlist_updates`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))),
117117
method: 'GET',
118118
headers: headerParameters,
119119
query: queryParameters,

0 commit comments

Comments
 (0)