@rivascva/dt-idl 1.1.185 → 1.1.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -761,7 +761,8 @@ interface paths$2 {
761
761
  get: operations$2["getPortfoliosByUser"];
762
762
  put?: never;
763
763
  post?: never;
764
- delete?: never;
764
+ /** @description Deletes all portfolios for the given user */
765
+ delete: operations$2["deletePortfoliosByUser"];
765
766
  options?: never;
766
767
  head?: never;
767
768
  patch?: never;
@@ -1137,6 +1138,24 @@ interface operations$2 {
1137
1138
  500: components$2["responses"]["InternalServerError"];
1138
1139
  };
1139
1140
  };
1141
+ deletePortfoliosByUser: {
1142
+ parameters: {
1143
+ query?: never;
1144
+ header?: never;
1145
+ path: {
1146
+ /** @description The user id */
1147
+ userId: string;
1148
+ };
1149
+ cookie?: never;
1150
+ };
1151
+ requestBody?: never;
1152
+ responses: {
1153
+ 204: components$2["responses"]["NoContent"];
1154
+ 400: components$2["responses"]["BadRequest"];
1155
+ 404: components$2["responses"]["NotFound"];
1156
+ 500: components$2["responses"]["InternalServerError"];
1157
+ };
1158
+ };
1140
1159
  addOrder: {
1141
1160
  parameters: {
1142
1161
  query?: never;
@@ -1318,7 +1337,8 @@ interface paths$1 {
1318
1337
  /** @description Updates an existing user */
1319
1338
  put: operations$1["updateUser"];
1320
1339
  post?: never;
1321
- delete?: never;
1340
+ /** @description Deletes an existing user */
1341
+ delete: operations$1["deleteUser"];
1322
1342
  options?: never;
1323
1343
  head?: never;
1324
1344
  patch?: never;
@@ -1341,6 +1361,23 @@ interface paths$1 {
1341
1361
  patch?: never;
1342
1362
  trace?: never;
1343
1363
  };
1364
+ "/users/{userId}/feedback": {
1365
+ parameters: {
1366
+ query?: never;
1367
+ header?: never;
1368
+ path?: never;
1369
+ cookie?: never;
1370
+ };
1371
+ get?: never;
1372
+ put?: never;
1373
+ /** @description Submit user feedback */
1374
+ post: operations$1["submitUserFeedback"];
1375
+ delete?: never;
1376
+ options?: never;
1377
+ head?: never;
1378
+ patch?: never;
1379
+ trace?: never;
1380
+ };
1344
1381
  "/users/fcm-token/{fcmToken}": {
1345
1382
  parameters: {
1346
1383
  query?: never;
@@ -1440,6 +1477,11 @@ interface components$1 {
1440
1477
  /** @example 123abc */
1441
1478
  fcmToken?: string;
1442
1479
  };
1480
+ /** @description Payload to submit user feedback */
1481
+ SubmitUserFeedbackPayload: {
1482
+ /** @example I love this app! */
1483
+ text: string;
1484
+ };
1443
1485
  /** @description Payload to send a push notification */
1444
1486
  SendPushNotificationPayload: {
1445
1487
  /** @example 123456 */
@@ -1745,6 +1787,24 @@ interface operations$1 {
1745
1787
  500: components$1["responses"]["InternalServerError"];
1746
1788
  };
1747
1789
  };
1790
+ deleteUser: {
1791
+ parameters: {
1792
+ query?: never;
1793
+ header?: never;
1794
+ path: {
1795
+ /** @description The user id */
1796
+ userId: string;
1797
+ };
1798
+ cookie?: never;
1799
+ };
1800
+ requestBody?: never;
1801
+ responses: {
1802
+ 204: components$1["responses"]["NoContent"];
1803
+ 400: components$1["responses"]["BadRequest"];
1804
+ 404: components$1["responses"]["NotFound"];
1805
+ 500: components$1["responses"]["InternalServerError"];
1806
+ };
1807
+ };
1748
1808
  updateUserDevice: {
1749
1809
  parameters: {
1750
1810
  query?: never;
@@ -1775,6 +1835,29 @@ interface operations$1 {
1775
1835
  500: components$1["responses"]["InternalServerError"];
1776
1836
  };
1777
1837
  };
1838
+ submitUserFeedback: {
1839
+ parameters: {
1840
+ query?: never;
1841
+ header?: never;
1842
+ path: {
1843
+ /** @description The user id */
1844
+ userId: string;
1845
+ };
1846
+ cookie?: never;
1847
+ };
1848
+ /** @description The request body to submit user feedback */
1849
+ requestBody: {
1850
+ content: {
1851
+ "application/json": components$1["schemas"]["SubmitUserFeedbackPayload"];
1852
+ };
1853
+ };
1854
+ responses: {
1855
+ 204: components$1["responses"]["NoContent"];
1856
+ 400: components$1["responses"]["BadRequest"];
1857
+ 404: components$1["responses"]["NotFound"];
1858
+ 500: components$1["responses"]["InternalServerError"];
1859
+ };
1860
+ };
1778
1861
  deleteFCMTokenFromAllUsers: {
1779
1862
  parameters: {
1780
1863
  query?: never;
@@ -2030,6 +2113,7 @@ type AddUserPayload = UserServiceSchemas['AddUserPayload'];
2030
2113
  type UpdateUserDevicePayload = UserServiceSchemas['UpdateUserDevicePayload'];
2031
2114
  type UpdateUserPayload = UserServiceSchemas['UpdateUserPayload'];
2032
2115
  type SendPushNotificationPayload = UserServiceSchemas['SendPushNotificationPayload'];
2116
+ type SubmitUserFeedbackPayload = UserServiceSchemas['SubmitUserFeedbackPayload'];
2033
2117
  type UserServiceError = UserServiceSchemas['Error'];
2034
2118
  type ImageType = AssetServiceSchemas['ImageType'];
2035
2119
  type UploadImagePayload = AssetServiceSchemas['UploadImagePayload'];
@@ -2037,4 +2121,4 @@ type UploadImageResponse = AssetServiceSchemas['UploadImageResponse'];
2037
2121
  type DeleteImagePayload = AssetServiceSchemas['DeleteImagePayload'];
2038
2122
  type AssetServiceError = AssetServiceSchemas['Error'];
2039
2123
 
2040
- export { type AddOrderPayload, type AddUserPayload, type AssetServiceError, type DeleteImagePayload, type FullQuote, type GetIndexesQueryParams, type GetOrdersByPortfolioParams, type GetPortfolioHistoryParams, type GetSearchStocksQueryParams, type GetStockHistoryQueryParams, type GetStocksBySymbolsQueryParams, type Holding, type ImageType, type Index, type LoginWithFirebasePayload, type LogoutPayload, type MarketHours, type MarketMetadata, type MarketServiceError, type NewsArticle, type Order, type OrderType, type Portfolio, type PortfolioHistoryTimeframe, type PortfolioHistoryValue, type PortfolioType, type RefreshAccessTokenPayload, type SendPushNotificationPayload, type SignupWithFirebasePayload, type SimpleQuote, type SortField, type SortOrder, type StockHistoryEntry, type StockHistoryTimeframe, type StockNewsArticle, type TradeServiceError, type UpdatePortfolioPayload, type UpdateUserDevicePayload, type UpdateUserPayload, type UploadImagePayload, type UploadImageResponse, type User, type UserServiceError, createAssetServiceClient, createMarketServiceClient, createTradeServiceClient, createUserServiceClient, isAssetServiceError, isMarketServiceError, isTradeServiceError, isUserServiceError };
2124
+ export { type AddOrderPayload, type AddUserPayload, type AssetServiceError, type DeleteImagePayload, type FullQuote, type GetIndexesQueryParams, type GetOrdersByPortfolioParams, type GetPortfolioHistoryParams, type GetSearchStocksQueryParams, type GetStockHistoryQueryParams, type GetStocksBySymbolsQueryParams, type Holding, type ImageType, type Index, type LoginWithFirebasePayload, type LogoutPayload, type MarketHours, type MarketMetadata, type MarketServiceError, type NewsArticle, type Order, type OrderType, type Portfolio, type PortfolioHistoryTimeframe, type PortfolioHistoryValue, type PortfolioType, type RefreshAccessTokenPayload, type SendPushNotificationPayload, type SignupWithFirebasePayload, type SimpleQuote, type SortField, type SortOrder, type StockHistoryEntry, type StockHistoryTimeframe, type StockNewsArticle, type SubmitUserFeedbackPayload, type TradeServiceError, type UpdatePortfolioPayload, type UpdateUserDevicePayload, type UpdateUserPayload, type UploadImagePayload, type UploadImageResponse, type User, type UserServiceError, createAssetServiceClient, createMarketServiceClient, createTradeServiceClient, createUserServiceClient, isAssetServiceError, isMarketServiceError, isTradeServiceError, isUserServiceError };
@@ -1,5 +1,7 @@
1
1
  package models
2
2
 
3
+ import "time"
4
+
3
5
  // ContextKey is a type used to define keys for a request context.
4
6
  type ContextKey string
5
7
 
@@ -34,4 +36,6 @@ const (
34
36
  // MarketCloseTime is the closing time of the market in a 24-hour format (HH:mm).
35
37
  // Based on the timezone specified in MarketTimezone.
36
38
  MarketCloseTime = "16:00"
39
+ // MarketCloseGracePeriod is a grace period added after the official close time to allow in-flight operations to finish.
40
+ MarketCloseGracePeriod = 45 * time.Second
37
41
  )
@@ -11,18 +11,25 @@ import (
11
11
  )
12
12
 
13
13
  // IsMarketHours determines if the given time falls within the preset market hours.
14
- // The given open and close offsets are used as buffer window on market open and close.
15
- //
16
- // For example, if the open offset is 5 seconds and the market opens at 9:30:00:
17
- //
18
- // - The function will only return true if the current time is 9:30:05 or later
19
- //
20
- // For example, if the close offset is 20 seconds and the market closes at 16:00:00:
14
+ func IsMarketHours(now time.Time) (bool, error) {
15
+ return isMarketHoursWithOpenAndCloseOffsets(now, 0, 0)
16
+ }
17
+
18
+ // IsMarketHoursWithCloseGracePeriod determines if the given time falls within the preset market hours with a close grace period added after the official close time.
19
+ // This is useful for in-flight operations to complete after the market officially closes.
20
+ func IsMarketHoursWithCloseGracePeriod(now time.Time) (bool, error) {
21
+ return isMarketHoursWithOpenAndCloseOffsets(now, 0, models.MarketCloseGracePeriod)
22
+ }
23
+
24
+ // isMarketHoursWithOpenAndCloseOffsets determines if the given time falls within the preset market hours.
25
+ // The given open and close offsets are used as buffer window on market open and close:
21
26
  //
22
- // - The function will only return true if the current time is 16:00:20 or earlier
27
+ // - If the open offset is 5 seconds and the market opens at 9:30:00:
28
+ // - The function will only return true if the current time is 9:30:05 or later
23
29
  //
24
- // The purpose of the offset is to prevent certain operations from being executed during the market open and close transition periods.
25
- func IsMarketHours(now time.Time, openOffset time.Duration, closeOffset time.Duration) (bool, error) {
30
+ // - If the close offset is 20 seconds and the market closes at 16:00:00:
31
+ // - The function will only return true if the current time is 16:00:20 or earlier
32
+ func isMarketHoursWithOpenAndCloseOffsets(now time.Time, openOffset time.Duration, closeOffset time.Duration) (bool, error) {
26
33
  // load the market timezone
27
34
  loc, err := time.LoadLocation(models.MarketTimezone)
28
35
  if err != nil {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.185",
3
+ "version": "1.1.187",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -147,6 +147,28 @@ paths:
147
147
  $ref: '#/components/responses/NotFound'
148
148
  500:
149
149
  $ref: '#/components/responses/InternalServerError'
150
+ delete:
151
+ description: Deletes all portfolios for the given user
152
+ operationId: deletePortfoliosByUser
153
+ tags:
154
+ - Portfolios
155
+ parameters:
156
+ - in: path
157
+ name: userId
158
+ description: The user id
159
+ required: true
160
+ schema:
161
+ type: string
162
+ example: 123456
163
+ responses:
164
+ 204:
165
+ $ref: '#/components/responses/NoContent'
166
+ 400:
167
+ $ref: '#/components/responses/BadRequest'
168
+ 404:
169
+ $ref: '#/components/responses/NotFound'
170
+ 500:
171
+ $ref: '#/components/responses/InternalServerError'
150
172
 
151
173
  /orders:
152
174
  post:
@@ -200,7 +200,29 @@ paths:
200
200
  $ref: '#/components/responses/NotFound'
201
201
  500:
202
202
  $ref: '#/components/responses/InternalServerError'
203
-
203
+ delete:
204
+ description: Deletes an existing user
205
+ operationId: deleteUser
206
+ tags:
207
+ - Users
208
+ parameters:
209
+ - in: path
210
+ name: userId
211
+ description: The user id
212
+ required: true
213
+ schema:
214
+ type: string
215
+ example: 123456
216
+ responses:
217
+ 204:
218
+ $ref: '#/components/responses/NoContent'
219
+ 400:
220
+ $ref: '#/components/responses/BadRequest'
221
+ 404:
222
+ $ref: '#/components/responses/NotFound'
223
+ 500:
224
+ $ref: '#/components/responses/InternalServerError'
225
+
204
226
  /users/{userId}/device:
205
227
  put:
206
228
  description: Update the user device information
@@ -233,7 +255,38 @@ paths:
233
255
  $ref: '#/components/responses/BadRequest'
234
256
  500:
235
257
  $ref: '#/components/responses/InternalServerError'
236
-
258
+
259
+ /users/{userId}/feedback:
260
+ post:
261
+ description: Submit user feedback
262
+ operationId: submitUserFeedback
263
+ tags:
264
+ - Users
265
+ parameters:
266
+ - in: path
267
+ name: userId
268
+ description: The user id
269
+ required: true
270
+ schema:
271
+ type: string
272
+ example: 123456
273
+ requestBody:
274
+ description: The request body to submit user feedback
275
+ required: true
276
+ content:
277
+ application/json:
278
+ schema:
279
+ $ref: '#/components/schemas/SubmitUserFeedbackPayload'
280
+ responses:
281
+ 204:
282
+ $ref: '#/components/responses/NoContent'
283
+ 400:
284
+ $ref: '#/components/responses/BadRequest'
285
+ 404:
286
+ $ref: '#/components/responses/NotFound'
287
+ 500:
288
+ $ref: '#/components/responses/InternalServerError'
289
+
237
290
  /users/fcm-token/{fcmToken}:
238
291
  delete:
239
292
  description: Delete the FCM token from all users that have it
@@ -257,7 +310,7 @@ paths:
257
310
  $ref: '#/components/responses/NotFound'
258
311
  500:
259
312
  $ref: '#/components/responses/InternalServerError'
260
-
313
+
261
314
  /notifications/push/send:
262
315
  post:
263
316
  description: Send a push notification
@@ -390,6 +443,15 @@ components:
390
443
  type: string
391
444
  example: 123abc
392
445
 
446
+ SubmitUserFeedbackPayload:
447
+ description: Payload to submit user feedback
448
+ properties:
449
+ text:
450
+ type: string
451
+ example: I love this app!
452
+ required:
453
+ - text
454
+
393
455
  SendPushNotificationPayload:
394
456
  description: Payload to send a push notification
395
457
  properties:
@@ -406,7 +468,7 @@ components:
406
468
  - userId
407
469
  - title
408
470
  - body
409
-
471
+
410
472
  Platform:
411
473
  type: string
412
474
  enum:
@@ -66,7 +66,8 @@ export interface paths {
66
66
  get: operations["getPortfoliosByUser"];
67
67
  put?: never;
68
68
  post?: never;
69
- delete?: never;
69
+ /** @description Deletes all portfolios for the given user */
70
+ delete: operations["deletePortfoliosByUser"];
70
71
  options?: never;
71
72
  head?: never;
72
73
  patch?: never;
@@ -444,6 +445,24 @@ export interface operations {
444
445
  500: components["responses"]["InternalServerError"];
445
446
  };
446
447
  };
448
+ deletePortfoliosByUser: {
449
+ parameters: {
450
+ query?: never;
451
+ header?: never;
452
+ path: {
453
+ /** @description The user id */
454
+ userId: string;
455
+ };
456
+ cookie?: never;
457
+ };
458
+ requestBody?: never;
459
+ responses: {
460
+ 204: components["responses"]["NoContent"];
461
+ 400: components["responses"]["BadRequest"];
462
+ 404: components["responses"]["NotFound"];
463
+ 500: components["responses"]["InternalServerError"];
464
+ };
465
+ };
447
466
  addOrder: {
448
467
  parameters: {
449
468
  query?: never;
@@ -102,7 +102,8 @@ export interface paths {
102
102
  /** @description Updates an existing user */
103
103
  put: operations["updateUser"];
104
104
  post?: never;
105
- delete?: never;
105
+ /** @description Deletes an existing user */
106
+ delete: operations["deleteUser"];
106
107
  options?: never;
107
108
  head?: never;
108
109
  patch?: never;
@@ -125,6 +126,23 @@ export interface paths {
125
126
  patch?: never;
126
127
  trace?: never;
127
128
  };
129
+ "/users/{userId}/feedback": {
130
+ parameters: {
131
+ query?: never;
132
+ header?: never;
133
+ path?: never;
134
+ cookie?: never;
135
+ };
136
+ get?: never;
137
+ put?: never;
138
+ /** @description Submit user feedback */
139
+ post: operations["submitUserFeedback"];
140
+ delete?: never;
141
+ options?: never;
142
+ head?: never;
143
+ patch?: never;
144
+ trace?: never;
145
+ };
128
146
  "/users/fcm-token/{fcmToken}": {
129
147
  parameters: {
130
148
  query?: never;
@@ -225,6 +243,11 @@ export interface components {
225
243
  /** @example 123abc */
226
244
  fcmToken?: string;
227
245
  };
246
+ /** @description Payload to submit user feedback */
247
+ SubmitUserFeedbackPayload: {
248
+ /** @example I love this app! */
249
+ text: string;
250
+ };
228
251
  /** @description Payload to send a push notification */
229
252
  SendPushNotificationPayload: {
230
253
  /** @example 123456 */
@@ -531,6 +554,24 @@ export interface operations {
531
554
  500: components["responses"]["InternalServerError"];
532
555
  };
533
556
  };
557
+ deleteUser: {
558
+ parameters: {
559
+ query?: never;
560
+ header?: never;
561
+ path: {
562
+ /** @description The user id */
563
+ userId: string;
564
+ };
565
+ cookie?: never;
566
+ };
567
+ requestBody?: never;
568
+ responses: {
569
+ 204: components["responses"]["NoContent"];
570
+ 400: components["responses"]["BadRequest"];
571
+ 404: components["responses"]["NotFound"];
572
+ 500: components["responses"]["InternalServerError"];
573
+ };
574
+ };
534
575
  updateUserDevice: {
535
576
  parameters: {
536
577
  query?: never;
@@ -561,6 +602,29 @@ export interface operations {
561
602
  500: components["responses"]["InternalServerError"];
562
603
  };
563
604
  };
605
+ submitUserFeedback: {
606
+ parameters: {
607
+ query?: never;
608
+ header?: never;
609
+ path: {
610
+ /** @description The user id */
611
+ userId: string;
612
+ };
613
+ cookie?: never;
614
+ };
615
+ /** @description The request body to submit user feedback */
616
+ requestBody: {
617
+ content: {
618
+ "application/json": components["schemas"]["SubmitUserFeedbackPayload"];
619
+ };
620
+ };
621
+ responses: {
622
+ 204: components["responses"]["NoContent"];
623
+ 400: components["responses"]["BadRequest"];
624
+ 404: components["responses"]["NotFound"];
625
+ 500: components["responses"]["InternalServerError"];
626
+ };
627
+ };
564
628
  deleteFCMTokenFromAllUsers: {
565
629
  parameters: {
566
630
  query?: never;
package/ts/types/types.ts CHANGED
@@ -56,6 +56,7 @@ export type AddUserPayload = UserServiceSchemas['AddUserPayload'];
56
56
  export type UpdateUserDevicePayload = UserServiceSchemas['UpdateUserDevicePayload'];
57
57
  export type UpdateUserPayload = UserServiceSchemas['UpdateUserPayload'];
58
58
  export type SendPushNotificationPayload = UserServiceSchemas['SendPushNotificationPayload'];
59
+ export type SubmitUserFeedbackPayload = UserServiceSchemas['SubmitUserFeedbackPayload'];
59
60
  export type UserServiceError = UserServiceSchemas['Error'];
60
61
 
61
62
  // Asset Service Types