4
4
*/
5
5
import type { AxiosError } from '@nextcloud/axios'
6
6
7
+ import type { AutocompleteResult } from './openapi/core/index.ts'
7
8
import type { components , operations } from './openapi/openapi-full.ts'
8
- import { TASK_PROCESSING } from '../constants.ts'
9
9
10
10
// General
11
11
type ApiResponse < T > = Promise < { data : T } >
@@ -113,13 +113,7 @@ export type ParticipantStatus = {
113
113
clearAt ?: number | null ,
114
114
}
115
115
export type Participant = components [ 'schemas' ] [ 'Participant' ]
116
- export type ParticipantSearchResult = {
117
- id : string ,
118
- label : string ,
119
- icon : string ,
120
- source : string ,
121
- subline : string ,
122
- shareWithDisplayNameUnique : string ,
116
+ export type ParticipantSearchResult = AutocompleteResult & {
123
117
status : ParticipantStatus | '' ,
124
118
}
125
119
@@ -246,123 +240,37 @@ export type getMentionsParams = operations['chat-mentions']['parameters']['query
246
240
export type getMentionsResponse = ApiResponse < operations [ 'chat-mentions' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
247
241
248
242
// AI Summary
249
- export type TaskProcessingResponse = ApiResponseUnwrapped < {
250
- task : {
251
- id : number ,
252
- lastUpdated : number ,
253
- type : string ,
254
- status : typeof TASK_PROCESSING . STATUS [ keyof typeof TASK_PROCESSING . STATUS ] ,
255
- userId : string ,
256
- appId : string ,
257
- input : Record < string , unknown > ,
258
- output : Record < string , unknown > | null ,
259
- customId : string ,
260
- completionExpectedAt : number ,
261
- progress : number ,
262
- scheduledAt : number ,
263
- startedAt : number ,
264
- endedAt : number
265
- }
266
- } >
267
-
268
- // Groupware
269
- export type DavPrincipal = {
270
- calendarHomes : string [ ] ,
271
- calendarUserType : string ,
272
- displayname : string ,
273
- email : string ,
274
- language : string ,
275
- principalScheme : string ,
276
- principalUrl : string ,
277
- scheduleDefaultCalendarUrl : string ,
278
- scheduleInbox : string ,
279
- scheduleOutbox : string ,
280
- url : string ,
281
- userId : string ,
282
- [ key : string ] : unknown ,
283
- }
284
- export type DavCalendar = {
285
- displayname : string ,
286
- color ?: string ,
287
- components : string [ ] ,
288
- allowedSharingModes : string [ ] ,
289
- currentUserPrivilegeSet : string [ ] ,
290
- enabled ?: boolean ,
291
- order : number ,
292
- owner : string ,
293
- resourcetype : string [ ] ,
294
- timezone ?: string ,
295
- transparency : string ,
296
- url : string ,
297
- [ key : string ] : unknown ,
298
- isWriteable : ( ) => boolean ,
299
- }
300
- export type DavCalendarHome = {
301
- displayname : string ,
302
- url : string ,
303
- findAllCalendars : ( ) => Promise < DavCalendar [ ] > ,
304
- }
305
-
306
- // Upcoming events response
307
- // From https://github.com/nextcloud/server/blob/master/apps/dav/lib/CalDAV/UpcomingEvent.php
308
- export type UpcomingEvent = {
309
- uri : string ,
310
- calendarUri : string ,
311
- /** Format: int64 */
312
- start : number | null ,
313
- summary : string | null ,
314
- location : string | null ,
315
- recurrenceId ?: number | null ,
316
- calendarAppUrl ?: string | null ,
317
- } ;
318
- export type UpcomingEventsResponse = ApiResponseUnwrapped < { events : UpcomingEvent [ ] } >
319
-
320
- // Out of office response
321
- // From https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-out-of-office-api.html
322
- export type OutOfOfficeResult = {
323
- id : string ,
324
- userId : string ,
325
- startDate : number ,
326
- endDate : number ,
327
- shortMessage : string ,
328
- message : string ,
329
- replacementUserId ?: string | null ,
330
- replacementUserDisplayName ?: string | null ,
331
- }
332
- export type OutOfOfficeResponse = ApiResponseUnwrapped < OutOfOfficeResult >
243
+ export type {
244
+ TaskProcessingResponse ,
245
+ } from './openapi/core/index.ts'
246
+
247
+ // Groupware | DAV API
248
+ export type {
249
+ DavCalendar ,
250
+ DavCalendarHome ,
251
+ DavPrincipal ,
252
+ OutOfOfficeResult ,
253
+ OutOfOfficeResponse ,
254
+ UpcomingEvent ,
255
+ UpcomingEventsResponse ,
256
+ } from './openapi/core/index.ts'
333
257
334
258
export type scheduleMeetingParams = Required < operations [ 'room-schedule-meeting' ] > [ 'requestBody' ] [ 'content' ] [ 'application/json' ]
335
259
export type scheduleMeetingResponse = ApiResponse < operations [ 'room-schedule-meeting' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
336
260
337
261
// User preferences response
338
- // from https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-user-preferences-api.html
339
- export type UserPreferencesResponse = ApiResponseUnwrapped < unknown >
262
+ export type {
263
+ UserPreferencesParams ,
264
+ UserPreferencesResponse ,
265
+ } from './openapi/core/index.ts'
340
266
341
267
// Settings
342
268
export type setSipSettingsParams = Required < operations [ 'settings-setsip-settings' ] > [ 'requestBody' ] [ 'content' ] [ 'application/json' ]
343
269
export type setSipSettingsResponse = ApiResponse < operations [ 'settings-setsip-settings' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
344
270
export type setUserSettingsParams = Required < operations [ 'settings-set-user-setting' ] > [ 'requestBody' ] [ 'content' ] [ 'application/json' ]
345
271
export type setUserSettingsResponse = ApiResponse < operations [ 'settings-set-user-setting' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
346
272
347
- // Unified Search
348
- export type MessageSearchResultAttributes = {
349
- conversation : string ,
350
- messageId : string ,
351
- actorType : string ,
352
- actorId : string ,
353
- timestamp : string ,
354
- }
355
-
356
- export type CoreUnifiedSearchResultEntry = {
357
- thumbnailUrl : string ,
358
- title : string ,
359
- subline : string ,
360
- resourceUrl : string ,
361
- icon : string ,
362
- rounded : boolean ,
363
- attributes : MessageSearchResultAttributes ,
364
- }
365
-
273
+ // Payload for NcSelect with `user-select`
366
274
export type UserFilterObject = {
367
275
id : string ,
368
276
displayName : string ,
@@ -372,20 +280,16 @@ export type UserFilterObject = {
372
280
showUserStatus : boolean ,
373
281
}
374
282
375
- export type CoreUnifiedSearchResult = {
376
- name : string ,
377
- isPaginated : boolean ,
378
- entries : CoreUnifiedSearchResultEntry [ ] ,
379
- cursor : number | string | null ,
380
- }
381
- export type UnifiedSearchResponse = ApiResponseUnwrapped < CoreUnifiedSearchResult >
382
-
383
- export type SearchMessagePayload = {
384
- term : string ,
385
- person ?: string ,
386
- since ?: string | null ,
387
- until ?: string | null ,
388
- cursor ?: number | string | null ,
389
- limit ?: number ,
390
- from ?: string
391
- }
283
+ // Autocomplete API
284
+ export type {
285
+ AutocompleteResult ,
286
+ AutocompleteParams ,
287
+ AutocompleteResponse ,
288
+ } from './openapi/core/index.ts'
289
+
290
+ // Unified Search API
291
+ export type {
292
+ SearchMessagePayload ,
293
+ UnifiedSearchResultEntry ,
294
+ UnifiedSearchResponse ,
295
+ } from './openapi/core/index.ts'
0 commit comments