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,24 +240,9 @@ 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
- } >
243
+ export type {
244
+ TaskProcessingResponse ,
245
+ } from './openapi/core/index.ts'
267
246
268
247
// Teams (circles)
269
248
export type TeamProbe = {
@@ -281,104 +260,33 @@ export type TeamProbe = {
281
260
}
282
261
export type getTeamsProbeResponse = ApiResponseUnwrapped < TeamProbe [ ] >
283
262
284
- // Groupware
285
- export type DavPrincipal = {
286
- calendarHomes : string [ ] ,
287
- calendarUserType : string ,
288
- displayname : string ,
289
- email : string ,
290
- language : string ,
291
- principalScheme : string ,
292
- principalUrl : string ,
293
- scheduleDefaultCalendarUrl : string ,
294
- scheduleInbox : string ,
295
- scheduleOutbox : string ,
296
- url : string ,
297
- userId : string ,
298
- [ key : string ] : unknown ,
299
- }
300
- export type DavCalendar = {
301
- displayname : string ,
302
- color ?: string ,
303
- components : string [ ] ,
304
- allowedSharingModes : string [ ] ,
305
- currentUserPrivilegeSet : string [ ] ,
306
- enabled ?: boolean ,
307
- order : number ,
308
- owner : string ,
309
- resourcetype : string [ ] ,
310
- timezone ?: string ,
311
- transparency : string ,
312
- url : string ,
313
- [ key : string ] : unknown ,
314
- isWriteable : ( ) => boolean ,
315
- }
316
- export type DavCalendarHome = {
317
- displayname : string ,
318
- url : string ,
319
- findAllCalendars : ( ) => Promise < DavCalendar [ ] > ,
320
- }
321
-
322
- // Upcoming events response
323
- // From https://github.com/nextcloud/server/blob/master/apps/dav/lib/CalDAV/UpcomingEvent.php
324
- export type UpcomingEvent = {
325
- uri : string ,
326
- calendarUri : string ,
327
- /** Format: int64 */
328
- start : number | null ,
329
- summary : string | null ,
330
- location : string | null ,
331
- recurrenceId ?: number | null ,
332
- calendarAppUrl ?: string | null ,
333
- } ;
334
- export type UpcomingEventsResponse = ApiResponseUnwrapped < { events : UpcomingEvent [ ] } >
335
-
336
- // Out of office response
337
- // From https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-out-of-office-api.html
338
- export type OutOfOfficeResult = {
339
- id : string ,
340
- userId : string ,
341
- startDate : number ,
342
- endDate : number ,
343
- shortMessage : string ,
344
- message : string ,
345
- replacementUserId ?: string | null ,
346
- replacementUserDisplayName ?: string | null ,
347
- }
348
- export type OutOfOfficeResponse = ApiResponseUnwrapped < OutOfOfficeResult >
263
+ // Groupware | DAV API
264
+ export type {
265
+ DavCalendar ,
266
+ DavCalendarHome ,
267
+ DavPrincipal ,
268
+ OutOfOfficeResult ,
269
+ OutOfOfficeResponse ,
270
+ UpcomingEvent ,
271
+ UpcomingEventsResponse ,
272
+ } from './openapi/core/index.ts'
349
273
350
274
export type scheduleMeetingParams = Required < operations [ 'room-schedule-meeting' ] > [ 'requestBody' ] [ 'content' ] [ 'application/json' ]
351
275
export type scheduleMeetingResponse = ApiResponse < operations [ 'room-schedule-meeting' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
352
276
353
277
// User preferences response
354
- // from https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-user-preferences-api.html
355
- export type UserPreferencesResponse = ApiResponseUnwrapped < unknown >
278
+ export type {
279
+ UserPreferencesParams ,
280
+ UserPreferencesResponse ,
281
+ } from './openapi/core/index.ts'
356
282
357
283
// Settings
358
284
export type setSipSettingsParams = Required < operations [ 'settings-setsip-settings' ] > [ 'requestBody' ] [ 'content' ] [ 'application/json' ]
359
285
export type setSipSettingsResponse = ApiResponse < operations [ 'settings-setsip-settings' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
360
286
export type setUserSettingsParams = Required < operations [ 'settings-set-user-setting' ] > [ 'requestBody' ] [ 'content' ] [ 'application/json' ]
361
287
export type setUserSettingsResponse = ApiResponse < operations [ 'settings-set-user-setting' ] [ 'responses' ] [ 200 ] [ 'content' ] [ 'application/json' ] >
362
288
363
- // Unified Search
364
- export type MessageSearchResultAttributes = {
365
- conversation : string ,
366
- messageId : string ,
367
- actorType : string ,
368
- actorId : string ,
369
- timestamp : string ,
370
- }
371
-
372
- export type CoreUnifiedSearchResultEntry = {
373
- thumbnailUrl : string ,
374
- title : string ,
375
- subline : string ,
376
- resourceUrl : string ,
377
- icon : string ,
378
- rounded : boolean ,
379
- attributes : MessageSearchResultAttributes ,
380
- }
381
-
289
+ // Payload for NcSelect with `user-select`
382
290
export type UserFilterObject = {
383
291
id : string ,
384
292
displayName : string ,
@@ -388,20 +296,16 @@ export type UserFilterObject = {
388
296
showUserStatus : boolean ,
389
297
}
390
298
391
- export type CoreUnifiedSearchResult = {
392
- name : string ,
393
- isPaginated : boolean ,
394
- entries : CoreUnifiedSearchResultEntry [ ] ,
395
- cursor : number | string | null ,
396
- }
397
- export type UnifiedSearchResponse = ApiResponseUnwrapped < CoreUnifiedSearchResult >
398
-
399
- export type SearchMessagePayload = {
400
- term : string ,
401
- person ?: string ,
402
- since ?: string | null ,
403
- until ?: string | null ,
404
- cursor ?: number | string | null ,
405
- limit ?: number ,
406
- from ?: string
407
- }
299
+ // Autocomplete API
300
+ export type {
301
+ AutocompleteResult ,
302
+ AutocompleteParams ,
303
+ AutocompleteResponse ,
304
+ } from './openapi/core/index.ts'
305
+
306
+ // Unified Search API
307
+ export type {
308
+ SearchMessagePayload ,
309
+ UnifiedSearchResultEntry ,
310
+ UnifiedSearchResponse ,
311
+ } from './openapi/core/index.ts'
0 commit comments