Skip to content

Commit 147bddb

Browse files
authored
feat: update to api spec v147.3.0 (#78)
1 parent 73691ae commit 147bddb

File tree

3 files changed

+219
-120
lines changed

3 files changed

+219
-120
lines changed

src/gen/chat/ChatApi.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ import {
116116
UpdatePollRequest,
117117
UpdateThreadPartialRequest,
118118
UpdateThreadPartialResponse,
119+
UpsertPushPreferencesRequest,
120+
UpsertPushPreferencesResponse,
119121
WrappedUnreadCountsResponse,
120122
} from '../models';
121123
import { decoders } from '../model-decoders';
@@ -1817,6 +1819,22 @@ export class ChatApi extends BaseApi {
18171819
return { ...response.body, metadata: response.metadata };
18181820
};
18191821

1822+
updatePushNotificationPreferences = async (
1823+
request: UpsertPushPreferencesRequest,
1824+
): Promise<StreamResponse<UpsertPushPreferencesResponse>> => {
1825+
const body = {
1826+
preferences: request?.preferences,
1827+
};
1828+
1829+
const response = await this.sendRequest<
1830+
StreamResponse<UpsertPushPreferencesResponse>
1831+
>('POST', '/api/v2/chat/push_preferences', undefined, undefined, body);
1832+
1833+
decoders.UpsertPushPreferencesResponse?.(response.body);
1834+
1835+
return { ...response.body, metadata: response.metadata };
1836+
};
1837+
18201838
queryBannedUsers = async (request?: {
18211839
payload?: QueryBannedUsersPayload;
18221840
}): Promise<StreamResponse<QueryBannedUsersResponse>> => {

src/gen/model-decoders/index.ts

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ decoders.ChannelMute = (input?: Record<string, any>) => {
381381
return decode(typeMappings, input);
382382
};
383383

384+
decoders.ChannelPushPreferences = (input?: Record<string, any>) => {
385+
const typeMappings: TypeMapping = {
386+
disabled_until: { type: 'DatetimeType', isSingle: true },
387+
};
388+
return decode(typeMappings, input);
389+
};
390+
384391
decoders.ChannelResponse = (input?: Record<string, any>) => {
385392
const typeMappings: TypeMapping = {
386393
created_at: { type: 'DatetimeType', isSingle: true },
@@ -429,6 +436,8 @@ decoders.ChannelStateResponse = (input?: Record<string, any>) => {
429436
channel: { type: 'ChannelResponse', isSingle: true },
430437

431438
membership: { type: 'ChannelMember', isSingle: true },
439+
440+
push_preferences: { type: 'ChannelPushPreferences', isSingle: true },
432441
};
433442
return decode(typeMappings, input);
434443
};
@@ -454,6 +463,8 @@ decoders.ChannelStateResponseFields = (input?: Record<string, any>) => {
454463
channel: { type: 'ChannelResponse', isSingle: true },
455464

456465
membership: { type: 'ChannelMember', isSingle: true },
466+
467+
push_preferences: { type: 'ChannelPushPreferences', isSingle: true },
457468
};
458469
return decode(typeMappings, input);
459470
};
@@ -622,8 +633,6 @@ decoders.EntityCreator = (input?: Record<string, any>) => {
622633
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
623634

624635
updated_at: { type: 'DatetimeType', isSingle: true },
625-
626-
push_notifications: { type: 'PushNotificationSettings', isSingle: true },
627636
};
628637
return decode(typeMappings, input);
629638
};
@@ -634,8 +643,6 @@ decoders.EntityCreatorResponse = (input?: Record<string, any>) => {
634643

635644
updated_at: { type: 'DatetimeType', isSingle: true },
636645

637-
devices: { type: 'DeviceResponse', isSingle: false },
638-
639646
ban_expires: { type: 'DatetimeType', isSingle: true },
640647

641648
deactivated_at: { type: 'DatetimeType', isSingle: true },
@@ -646,6 +653,8 @@ decoders.EntityCreatorResponse = (input?: Record<string, any>) => {
646653

647654
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
648655

656+
devices: { type: 'DeviceResponse', isSingle: false },
657+
649658
push_notifications: {
650659
type: 'PushNotificationSettingsResponse',
651660
isSingle: true,
@@ -727,11 +736,6 @@ decoders.FullUserResponse = (input?: Record<string, any>) => {
727736
last_active: { type: 'DatetimeType', isSingle: true },
728737

729738
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
730-
731-
push_notifications: {
732-
type: 'PushNotificationSettingsResponse',
733-
isSingle: true,
734-
},
735739
};
736740
return decode(typeMappings, input);
737741
};
@@ -1109,9 +1113,11 @@ decoders.MessageReadEvent = (input?: Record<string, any>) => {
11091113
const typeMappings: TypeMapping = {
11101114
created_at: { type: 'DatetimeType', isSingle: true },
11111115

1116+
channel_last_message_at: { type: 'DatetimeType', isSingle: true },
1117+
11121118
thread: { type: 'ThreadResponse', isSingle: true },
11131119

1114-
user: { type: 'UserResponse', isSingle: true },
1120+
user: { type: 'UserResponseCommonFields', isSingle: true },
11151121
};
11161122
return decode(typeMappings, input);
11171123
};
@@ -1217,13 +1223,6 @@ decoders.MuteResponse = (input?: Record<string, any>) => {
12171223
return decode(typeMappings, input);
12181224
};
12191225

1220-
decoders.NullTime = (input?: Record<string, any>) => {
1221-
const typeMappings: TypeMapping = {
1222-
value: { type: 'DatetimeType', isSingle: true },
1223-
};
1224-
return decode(typeMappings, input);
1225-
};
1226-
12271226
decoders.OwnUser = (input?: Record<string, any>) => {
12281227
const typeMappings: TypeMapping = {
12291228
created_at: { type: 'DatetimeType', isSingle: true },
@@ -1244,7 +1243,7 @@ decoders.OwnUser = (input?: Record<string, any>) => {
12441243

12451244
last_engaged_at: { type: 'DatetimeType', isSingle: true },
12461245

1247-
push_notifications: { type: 'PushNotificationSettings', isSingle: true },
1246+
push_preferences: { type: 'PushPreferences', isSingle: true },
12481247
};
12491248
return decode(typeMappings, input);
12501249
};
@@ -1269,10 +1268,7 @@ decoders.OwnUserResponse = (input?: Record<string, any>) => {
12691268

12701269
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
12711270

1272-
push_notifications: {
1273-
type: 'PushNotificationSettingsResponse',
1274-
isSingle: true,
1275-
},
1271+
push_preferences: { type: 'PushPreferences', isSingle: true },
12761272
};
12771273
return decode(typeMappings, input);
12781274
};
@@ -1368,14 +1364,14 @@ decoders.PushNotificationFields = (input?: Record<string, any>) => {
13681364
return decode(typeMappings, input);
13691365
};
13701366

1371-
decoders.PushNotificationSettings = (input?: Record<string, any>) => {
1367+
decoders.PushNotificationSettingsResponse = (input?: Record<string, any>) => {
13721368
const typeMappings: TypeMapping = {
13731369
disabled_until: { type: 'DatetimeType', isSingle: true },
13741370
};
13751371
return decode(typeMappings, input);
13761372
};
13771373

1378-
decoders.PushNotificationSettingsResponse = (input?: Record<string, any>) => {
1374+
decoders.PushPreferences = (input?: Record<string, any>) => {
13791375
const typeMappings: TypeMapping = {
13801376
disabled_until: { type: 'DatetimeType', isSingle: true },
13811377
};
@@ -1607,10 +1603,6 @@ decoders.ReviewQueueItem = (input?: Record<string, any>) => {
16071603

16081604
flags: { type: 'Flag2', isSingle: false },
16091605

1610-
completed_at: { type: 'NullTime', isSingle: true },
1611-
1612-
reviewed_at: { type: 'NullTime', isSingle: true },
1613-
16141606
assigned_to: { type: 'User', isSingle: true },
16151607

16161608
entity_creator: { type: 'EntityCreator', isSingle: true },
@@ -1980,6 +1972,13 @@ decoders.UpsertModerationTemplateResponse = (input?: Record<string, any>) => {
19801972
return decode(typeMappings, input);
19811973
};
19821974

1975+
decoders.UpsertPushPreferencesResponse = (input?: Record<string, any>) => {
1976+
const typeMappings: TypeMapping = {
1977+
user_preferences: { type: 'PushPreferences', isSingle: false },
1978+
};
1979+
return decode(typeMappings, input);
1980+
};
1981+
19831982
decoders.UpsertPushProviderResponse = (input?: Record<string, any>) => {
19841983
const typeMappings: TypeMapping = {
19851984
push_provider: { type: 'PushProviderResponse', isSingle: true },
@@ -2004,8 +2003,6 @@ decoders.User = (input?: Record<string, any>) => {
20042003
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
20052004

20062005
updated_at: { type: 'DatetimeType', isSingle: true },
2007-
2008-
push_notifications: { type: 'PushNotificationSettings', isSingle: true },
20092006
};
20102007
return decode(typeMappings, input);
20112008
};
@@ -2053,8 +2050,6 @@ decoders.UserResponse = (input?: Record<string, any>) => {
20532050

20542051
updated_at: { type: 'DatetimeType', isSingle: true },
20552052

2056-
devices: { type: 'DeviceResponse', isSingle: false },
2057-
20582053
ban_expires: { type: 'DatetimeType', isSingle: true },
20592054

20602055
deactivated_at: { type: 'DatetimeType', isSingle: true },
@@ -2065,6 +2060,8 @@ decoders.UserResponse = (input?: Record<string, any>) => {
20652060

20662061
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
20672062

2063+
devices: { type: 'DeviceResponse', isSingle: false },
2064+
20682065
push_notifications: {
20692066
type: 'PushNotificationSettingsResponse',
20702067
isSingle: true,
@@ -2073,10 +2070,29 @@ decoders.UserResponse = (input?: Record<string, any>) => {
20732070
return decode(typeMappings, input);
20742071
};
20752072

2073+
decoders.UserResponseCommonFields = (input?: Record<string, any>) => {
2074+
const typeMappings: TypeMapping = {
2075+
created_at: { type: 'DatetimeType', isSingle: true },
2076+
2077+
updated_at: { type: 'DatetimeType', isSingle: true },
2078+
2079+
deactivated_at: { type: 'DatetimeType', isSingle: true },
2080+
2081+
deleted_at: { type: 'DatetimeType', isSingle: true },
2082+
2083+
last_active: { type: 'DatetimeType', isSingle: true },
2084+
2085+
revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
2086+
};
2087+
return decode(typeMappings, input);
2088+
};
2089+
20762090
decoders.WSEvent = (input?: Record<string, any>) => {
20772091
const typeMappings: TypeMapping = {
20782092
created_at: { type: 'DatetimeType', isSingle: true },
20792093

2094+
channel_last_message_at: { type: 'DatetimeType', isSingle: true },
2095+
20802096
channel: { type: 'ChannelResponse', isSingle: true },
20812097

20822098
created_by: { type: 'UserResponse', isSingle: true },

0 commit comments

Comments
 (0)