Skip to content

Commit

Permalink
chore: do not import types from Talk
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Dec 2, 2024
1 parent ffa5659 commit 60035f9
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/callbox/renderer/callbox.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,39 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import type { operations } from '@talk/src/types/openapi/openapi.ts'
import axios from '@nextcloud/axios'
import { getCurrentUser } from '@nextcloud/auth'
import { generateOcsUrl } from '@nextcloud/router'

type CallGetParticipantsForCall = operations['call-get-peers-for-call']['responses'][200]['content']['application/json']
// @talk/src/types/openapi/openapi.ts/operations['call-get-peers-for-call']['responses'][200]['content']['application/json']
// TODO: find a way to import from @talk without type errors on CI
type CallGetParticipantsForCallResponse = {
ocs: {
meta: {
status: string
statuscode: number
message?: string
totalitems?: string
itemsperpage?: string
}
data: {
actorId: string;
actorType: string;
displayName: string;
/** Format: int64 */
lastPing: number;
sessionId: string;
token: string;
}[]
}
}

/**
* Get participants of a call in a conversation
* @param token - Conversation token
*/
async function getCallParticipants(token: string) {
const response = await axios.get<CallGetParticipantsForCall>(generateOcsUrl('apps/spreed/api/v4/call/{token}', { token }))
const response = await axios.get<CallGetParticipantsForCallResponse>(generateOcsUrl('apps/spreed/api/v4/call/{token}', { token }))
return response.data.ocs.data
}

Expand Down

0 comments on commit 60035f9

Please sign in to comment.