mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
New openapi generator - experimental
This commit is contained in:
@@ -72,18 +72,18 @@ export default function TranscriptBrowser() {
|
|||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{item.sourceLanguage ? (
|
{item.source_language ? (
|
||||||
<div className="inline-block bg-blue-500 text-white px-2 py-1 rounded-full text-xs font-semibold">
|
<div className="inline-block bg-blue-500 text-white px-2 py-1 rounded-full text-xs font-semibold">
|
||||||
{item.sourceLanguage}
|
{item.source_language}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-xs text-gray-700">
|
<div className="text-xs text-gray-700">
|
||||||
{new Date(item.createdAt).toLocaleDateString("en-US")}
|
{new Date(item.created_at).toLocaleDateString("en-US")}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm">{item.shortSummary}</div>
|
<div className="text-sm">{item.short_summary}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
|
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { featureEnabled } from "../../domainContext";
|
import { featureEnabled } from "../../domainContext";
|
||||||
|
import { toShareMode } from "../../../lib/shareMode";
|
||||||
|
|
||||||
type TranscriptDetails = {
|
type TranscriptDetails = {
|
||||||
params: {
|
params: {
|
||||||
@@ -110,10 +111,10 @@ export default function TranscriptDetails(details: TranscriptDetails) {
|
|||||||
|
|
||||||
<div className="w-full h-full grid grid-rows-layout-one grid-cols-1 gap-2 lg:gap-4">
|
<div className="w-full h-full grid grid-rows-layout-one grid-cols-1 gap-2 lg:gap-4">
|
||||||
<section className=" bg-blue-400/20 rounded-lg md:rounded-xl p-2 md:px-4 h-full">
|
<section className=" bg-blue-400/20 rounded-lg md:rounded-xl p-2 md:px-4 h-full">
|
||||||
{transcript.response.longSummary ? (
|
{transcript.response.long_summary ? (
|
||||||
<FinalSummary
|
<FinalSummary
|
||||||
fullTranscript={fullTranscript}
|
fullTranscript={fullTranscript}
|
||||||
summary={transcript.response.longSummary}
|
summary={transcript.response.long_summary}
|
||||||
transcriptId={transcript.response.id}
|
transcriptId={transcript.response.id}
|
||||||
openZulipModal={() => setShowModal(true)}
|
openZulipModal={() => setShowModal(true)}
|
||||||
/>
|
/>
|
||||||
@@ -142,8 +143,8 @@ export default function TranscriptDetails(details: TranscriptDetails) {
|
|||||||
<div className="flex-grow max-w-full">
|
<div className="flex-grow max-w-full">
|
||||||
<ShareLink
|
<ShareLink
|
||||||
transcriptId={transcript?.response?.id}
|
transcriptId={transcript?.response?.id}
|
||||||
userId={transcript?.response?.userId}
|
userId={transcript?.response?.user_id}
|
||||||
shareMode={transcript?.response?.shareMode}
|
shareMode={toShareMode(transcript?.response?.share_mode)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,48 +1,38 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
|
||||||
DefaultApi,
|
|
||||||
V1TranscriptsCreateRequest,
|
|
||||||
} from "../../api/apis/DefaultApi";
|
|
||||||
import { GetTranscript } from "../../api";
|
|
||||||
import { useError } from "../../(errors)/errorContext";
|
import { useError } from "../../(errors)/errorContext";
|
||||||
import getApi from "../../lib/getApi";
|
import { GetTranscript, CreateTranscript } from "../../api";
|
||||||
|
import useApi from "../../lib/useApi";
|
||||||
|
|
||||||
type CreateTranscript = {
|
|
||||||
response: GetTranscript | null;
|
type UseTranscript = {
|
||||||
|
transcript: GetTranscript | null;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
error: Error | null;
|
error: Error | null;
|
||||||
create: (params: V1TranscriptsCreateRequest["createTranscript"]) => void;
|
create: (transcriptCreationDetails: CreateTranscript) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useCreateTranscript = (): CreateTranscript => {
|
const useCreateTranscript = (): UseTranscript => {
|
||||||
const [response, setResponse] = useState<GetTranscript | null>(null);
|
const [transcript, setTranscript] = useState<GetTranscript | null>(null);
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [error, setErrorState] = useState<Error | null>(null);
|
const [error, setErrorState] = useState<Error | null>(null);
|
||||||
const { setError } = useError();
|
const { setError } = useError();
|
||||||
const api = getApi();
|
const api = useApi();
|
||||||
|
|
||||||
const create = (params: V1TranscriptsCreateRequest["createTranscript"]) => {
|
const create = (transcriptCreationDetails: CreateTranscript) => {
|
||||||
if (loading || !api) return;
|
if (loading || !api) return;
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const requestParameters: V1TranscriptsCreateRequest = {
|
|
||||||
createTranscript: {
|
|
||||||
name: params.name || "Unnamed Transcript", // Default
|
|
||||||
targetLanguage: params.targetLanguage || "en", // Default
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
console.debug(
|
console.debug(
|
||||||
"POST - /v1/transcripts/ - Requesting new transcription creation",
|
"POST - /v1/transcripts/ - Requesting new transcription creation",
|
||||||
requestParameters,
|
transcriptCreationDetails,
|
||||||
);
|
);
|
||||||
|
|
||||||
api
|
api.v1TranscriptsCreate(transcriptCreationDetails)
|
||||||
.v1TranscriptsCreate(requestParameters)
|
.then((transcript) => {
|
||||||
.then((result) => {
|
setTranscript(transcript);
|
||||||
setResponse(result);
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
console.debug("New transcript created:", result);
|
console.debug("New transcript created:", transcript);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setError(
|
setError(
|
||||||
@@ -54,7 +44,7 @@ const useCreateTranscript = (): CreateTranscript => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return { response, loading, error, create };
|
return { transcript, loading, error, create };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useCreateTranscript;
|
export default useCreateTranscript;
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ import { useRef, useState } from "react";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Markdown from "react-markdown";
|
import Markdown from "react-markdown";
|
||||||
import "../../styles/markdown.css";
|
import "../../styles/markdown.css";
|
||||||
import getApi from "../../lib/getApi";
|
|
||||||
import { featureEnabled } from "../domainContext";
|
import { featureEnabled } from "../domainContext";
|
||||||
|
import { UpdateTranscript } from "../../api";
|
||||||
|
import useApi from "../../lib/useApi";
|
||||||
|
|
||||||
type FinalSummaryProps = {
|
type FinalSummaryProps = {
|
||||||
summary: string;
|
summary: string;
|
||||||
@@ -19,17 +20,17 @@ export default function FinalSummary(props: FinalSummaryProps) {
|
|||||||
const [isEditMode, setIsEditMode] = useState(false);
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
const [preEditSummary, setPreEditSummary] = useState(props.summary);
|
const [preEditSummary, setPreEditSummary] = useState(props.summary);
|
||||||
const [editedSummary, setEditedSummary] = useState(props.summary);
|
const [editedSummary, setEditedSummary] = useState(props.summary);
|
||||||
const api = getApi();
|
|
||||||
|
|
||||||
const updateSummary = async (newSummary: string, transcriptId: string) => {
|
const updateSummary = async (newSummary: string, transcriptId: string) => {
|
||||||
if (!api) return;
|
|
||||||
try {
|
try {
|
||||||
const updatedTranscript = await api.v1TranscriptUpdate({
|
const api = useApi();
|
||||||
|
const requestBody: UpdateTranscript = {
|
||||||
|
long_summary: newSummary,
|
||||||
|
};
|
||||||
|
const updatedTranscript = await api?.v1TranscriptUpdate(
|
||||||
transcriptId,
|
transcriptId,
|
||||||
updateTranscript: {
|
requestBody,
|
||||||
longSummary: newSummary,
|
);
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log("Updated long summary:", updatedTranscript);
|
console.log("Updated long summary:", updatedTranscript);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Failed to update long summary:", err);
|
console.error("Failed to update long summary:", err);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const TranscriptCreate = () => {
|
|||||||
const isAuthenticated = useFiefIsAuthenticated();
|
const isAuthenticated = useFiefIsAuthenticated();
|
||||||
const requireLogin = featureEnabled("requireLogin");
|
const requireLogin = featureEnabled("requireLogin");
|
||||||
|
|
||||||
const [name, setName] = useState<string>();
|
const [name, setName] = useState<string>("");
|
||||||
const nameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const nameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setName(event.target.value);
|
setName(event.target.value);
|
||||||
};
|
};
|
||||||
@@ -35,13 +35,13 @@ const TranscriptCreate = () => {
|
|||||||
const send = () => {
|
const send = () => {
|
||||||
if (loadingSend || createTranscript.loading || permissionDenied) return;
|
if (loadingSend || createTranscript.loading || permissionDenied) return;
|
||||||
setLoadingSend(true);
|
setLoadingSend(true);
|
||||||
createTranscript.create({ name, targetLanguage });
|
createTranscript.create({ name, target_language: targetLanguage });
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
createTranscript.response &&
|
createTranscript.transcript &&
|
||||||
router.push(`/transcripts/${createTranscript.response.id}/record`);
|
router.push(`/transcripts/${createTranscript.transcript.id}/record`);
|
||||||
}, [createTranscript.response]);
|
}, [createTranscript.transcript]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (createTranscript.error) setLoadingSend(false);
|
if (createTranscript.error) setLoadingSend(false);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { useState, useRef, useEffect, use } from "react";
|
import React, { useState, useRef, useEffect, use } from "react";
|
||||||
import { featureEnabled } from "../domainContext";
|
import { featureEnabled } from "../domainContext";
|
||||||
import getApi from "../../lib/getApi";
|
|
||||||
import { useFiefUserinfo } from "@fief/fief/nextjs/react";
|
import { useFiefUserinfo } from "@fief/fief/nextjs/react";
|
||||||
import SelectSearch from "react-select-search";
|
import SelectSearch from "react-select-search";
|
||||||
import "react-select-search/style.css";
|
import "react-select-search/style.css";
|
||||||
@@ -8,26 +7,30 @@ import "../../styles/button.css";
|
|||||||
import "../../styles/form.scss";
|
import "../../styles/form.scss";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
|
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import { DefaultService, UpdateTranscript } from "../../api";
|
||||||
|
import { ShareMode, toShareMode } from "../../lib/shareMode";
|
||||||
|
import useApi from "../../lib/useApi";
|
||||||
type ShareLinkProps = {
|
type ShareLinkProps = {
|
||||||
transcriptId: string;
|
transcriptId: string;
|
||||||
userId: string | null;
|
userId: string | null;
|
||||||
shareMode: string;
|
shareMode: ShareMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ShareLink = (props: ShareLinkProps) => {
|
const ShareLink = (props: ShareLinkProps) => {
|
||||||
const [isCopied, setIsCopied] = useState(false);
|
const [isCopied, setIsCopied] = useState(false);
|
||||||
|
const [api, setApi] = useState<DefaultService | null>(null);
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
const [currentUrl, setCurrentUrl] = useState<string>("");
|
const [currentUrl, setCurrentUrl] = useState<string>("");
|
||||||
const requireLogin = featureEnabled("requireLogin");
|
const requireLogin = featureEnabled("requireLogin");
|
||||||
const [isOwner, setIsOwner] = useState(false);
|
const [isOwner, setIsOwner] = useState(false);
|
||||||
const [shareMode, setShareMode] = useState(props.shareMode);
|
const [shareMode, setShareMode] = useState<ShareMode>(props.shareMode);
|
||||||
const [shareLoading, setShareLoading] = useState(false);
|
const [shareLoading, setShareLoading] = useState(false);
|
||||||
const userinfo = useFiefUserinfo();
|
const userinfo = useFiefUserinfo();
|
||||||
const api = getApi();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentUrl(window.location.href);
|
setCurrentUrl(window.location.href);
|
||||||
|
const api = useApi();
|
||||||
|
setApi(api);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -48,18 +51,24 @@ const ShareLink = (props: ShareLinkProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateShareMode = async (selectedShareMode: string) => {
|
const updateShareMode = async (selectedShareMode: string) => {
|
||||||
if (!api) return;
|
|
||||||
setShareLoading(true);
|
setShareLoading(true);
|
||||||
const updatedTranscript = await api.v1TranscriptUpdate({
|
const requestBody: UpdateTranscript = {
|
||||||
transcriptId: props.transcriptId,
|
share_mode: toShareMode(selectedShareMode),
|
||||||
updateTranscript: {
|
};
|
||||||
shareMode: selectedShareMode,
|
const api = useApi();
|
||||||
},
|
|
||||||
});
|
if (!api)
|
||||||
setShareMode(updatedTranscript.shareMode);
|
throw new Error("ShareLink's API should always be ready at this point");
|
||||||
|
|
||||||
|
const updatedTranscript = await api.v1TranscriptUpdate(
|
||||||
|
props.transcriptId,
|
||||||
|
requestBody,
|
||||||
|
);
|
||||||
|
setShareMode(toShareMode(updatedTranscript.share_mode));
|
||||||
setShareLoading(false);
|
setShareLoading(false);
|
||||||
};
|
};
|
||||||
const privacyEnabled = featureEnabled("privacy");
|
const privacyEnabled = featureEnabled("privacy");
|
||||||
|
const apiReady = api != null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -80,7 +89,7 @@ const ShareLink = (props: ShareLinkProps) => {
|
|||||||
<p>This transcript is public. Everyone can access it.</p>
|
<p>This transcript is public. Everyone can access it.</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isOwner && api && (
|
{isOwner && apiReady (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<SelectSearch
|
<SelectSearch
|
||||||
className="select-search--top select-search"
|
className="select-search--top select-search"
|
||||||
@@ -89,7 +98,7 @@ const ShareLink = (props: ShareLinkProps) => {
|
|||||||
{ name: "Secure", value: "semi-private" },
|
{ name: "Secure", value: "semi-private" },
|
||||||
{ name: "Public", value: "public" },
|
{ name: "Public", value: "public" },
|
||||||
]}
|
]}
|
||||||
value={shareMode}
|
value={shareMode?.toString()}
|
||||||
onChange={updateShareMode}
|
onChange={updateShareMode}
|
||||||
closeOnSelect={true}
|
closeOnSelect={true}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import getApi from "../../lib/getApi";
|
import { UpdateTranscript } from "../../api";
|
||||||
|
import useApi from "../../lib/useApi";
|
||||||
|
|
||||||
type TranscriptTitle = {
|
type TranscriptTitle = {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -10,17 +11,17 @@ const TranscriptTitle = (props: TranscriptTitle) => {
|
|||||||
const [displayedTitle, setDisplayedTitle] = useState(props.title);
|
const [displayedTitle, setDisplayedTitle] = useState(props.title);
|
||||||
const [preEditTitle, setPreEditTitle] = useState(props.title);
|
const [preEditTitle, setPreEditTitle] = useState(props.title);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const api = getApi();
|
|
||||||
|
|
||||||
const updateTitle = async (newTitle: string, transcriptId: string) => {
|
const updateTitle = async (newTitle: string, transcriptId: string) => {
|
||||||
if (!api) return;
|
|
||||||
try {
|
try {
|
||||||
const updatedTranscript = await api.v1TranscriptUpdate({
|
const requestBody: UpdateTranscript = {
|
||||||
|
title: newTitle,
|
||||||
|
};
|
||||||
|
const api = useApi();
|
||||||
|
const updatedTranscript = await api?.v1TranscriptUpdate(
|
||||||
transcriptId,
|
transcriptId,
|
||||||
updateTranscript: {
|
requestBody,
|
||||||
title: newTitle,
|
);
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log("Updated transcript:", updatedTranscript);
|
console.log("Updated transcript:", updatedTranscript);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Failed to update transcript:", err);
|
console.error("Failed to update transcript:", err);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { DomainContext } from "../domainContext";
|
import { DomainContext } from "../domainContext";
|
||||||
import getApi from "../../lib/getApi";
|
import getApi from "../../lib/useApi";
|
||||||
import { useFiefAccessTokenInfo } from "@fief/fief/build/esm/nextjs/react";
|
import { useFiefAccessTokenInfo } from "@fief/fief/build/esm/nextjs/react";
|
||||||
|
|
||||||
export type Mp3Response = {
|
export type Mp3Response = {
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
|
||||||
DefaultApi,
|
|
||||||
V1TranscriptGetTopicsRequest,
|
|
||||||
} from "../../api/apis/DefaultApi";
|
|
||||||
import { useError } from "../../(errors)/errorContext";
|
import { useError } from "../../(errors)/errorContext";
|
||||||
import { Topic } from "./webSocketTypes";
|
import { Topic } from "./webSocketTypes";
|
||||||
import getApi from "../../lib/getApi";
|
import useApi from "../../lib/useApi";
|
||||||
import { shouldShowError } from "../../lib/errorUtils";
|
import { shouldShowError } from "../../lib/errorUtils";
|
||||||
|
|
||||||
type TranscriptTopics = {
|
type TranscriptTopics = {
|
||||||
@@ -19,17 +15,13 @@ const useTopics = (id: string): TranscriptTopics => {
|
|||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [error, setErrorState] = useState<Error | null>(null);
|
const [error, setErrorState] = useState<Error | null>(null);
|
||||||
const { setError } = useError();
|
const { setError } = useError();
|
||||||
const api = getApi();
|
const api = useApi();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!id || !api) return;
|
if (!id || !api) return;
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const requestParameters: V1TranscriptGetTopicsRequest = {
|
api.v1TranscriptGetTopics(id)
|
||||||
transcriptId: id,
|
|
||||||
};
|
|
||||||
api
|
|
||||||
.v1TranscriptGetTopics(requestParameters)
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
setTopics(result);
|
setTopics(result);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { V1TranscriptGetRequest } from "../../api/apis/DefaultApi";
|
|
||||||
import { GetTranscript } from "../../api";
|
import { GetTranscript } from "../../api";
|
||||||
import { useError } from "../../(errors)/errorContext";
|
import { useError } from "../../(errors)/errorContext";
|
||||||
import getApi from "../../lib/getApi";
|
|
||||||
import { shouldShowError } from "../../lib/errorUtils";
|
import { shouldShowError } from "../../lib/errorUtils";
|
||||||
|
import useApi from "../../lib/useApi";
|
||||||
|
|
||||||
type ErrorTranscript = {
|
type ErrorTranscript = {
|
||||||
error: Error;
|
error: Error;
|
||||||
@@ -30,17 +29,14 @@ const useTranscript = (
|
|||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [error, setErrorState] = useState<Error | null>(null);
|
const [error, setErrorState] = useState<Error | null>(null);
|
||||||
const { setError } = useError();
|
const { setError } = useError();
|
||||||
const api = getApi();
|
const api = useApi();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!id || !api) return;
|
if (!id || !api) return;
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const requestParameters: V1TranscriptGetRequest = {
|
|
||||||
transcriptId: id,
|
api.v1TranscriptGet(id)
|
||||||
};
|
|
||||||
api
|
|
||||||
.v1TranscriptGet(requestParameters)
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
setResponse(result);
|
setResponse(result);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -55,7 +51,7 @@ const useTranscript = (
|
|||||||
}
|
}
|
||||||
setErrorState(error);
|
setErrorState(error);
|
||||||
});
|
});
|
||||||
}, [id, !api]);
|
}, [id, api]);
|
||||||
|
|
||||||
return { response, loading, error } as
|
return { response, loading, error } as
|
||||||
| ErrorTranscript
|
| ErrorTranscript
|
||||||
|
|||||||
@@ -1,32 +1,29 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { GetTranscriptFromJSON, PageGetTranscript } from "../../api";
|
|
||||||
import { useError } from "../../(errors)/errorContext";
|
import { useError } from "../../(errors)/errorContext";
|
||||||
import getApi from "../../lib/getApi";
|
import useApi from "../../lib/useApi";
|
||||||
|
import { Page_GetTranscript_ } from "../../api";
|
||||||
|
|
||||||
type TranscriptList = {
|
type TranscriptList = {
|
||||||
response: PageGetTranscript | null;
|
response: Page_GetTranscript_ | null;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
error: Error | null;
|
error: Error | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
//always protected
|
//always protected
|
||||||
const useTranscriptList = (page: number): TranscriptList => {
|
const useTranscriptList = (page: number): TranscriptList => {
|
||||||
const [response, setResponse] = useState<PageGetTranscript | null>(null);
|
const [response, setResponse] = useState<Page_GetTranscript_ | null>(null);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [error, setErrorState] = useState<Error | null>(null);
|
const [error, setErrorState] = useState<Error | null>(null);
|
||||||
const { setError } = useError();
|
const { setError } = useError();
|
||||||
const api = getApi();
|
const api = useApi();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!api) return;
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
api
|
if (!api)
|
||||||
.v1TranscriptsList({ page })
|
|
||||||
|
return;
|
||||||
|
api.v1TranscriptsList(page)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// issue with API layer, conversion for items is not happening
|
|
||||||
response.items = response.items.map((item) =>
|
|
||||||
GetTranscriptFromJSON(item),
|
|
||||||
);
|
|
||||||
setResponse(response);
|
setResponse(response);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
@@ -36,7 +33,7 @@ const useTranscriptList = (page: number): TranscriptList => {
|
|||||||
setError(err);
|
setError(err);
|
||||||
setErrorState(err);
|
setErrorState(err);
|
||||||
});
|
});
|
||||||
}, [!api, page]);
|
}, [api, page]);
|
||||||
|
|
||||||
return { response, loading, error };
|
return { response, loading, error };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { V1TranscriptGetAudioWaveformRequest } from "../../api/apis/DefaultApi";
|
|
||||||
import { AudioWaveform } from "../../api";
|
import { AudioWaveform } from "../../api";
|
||||||
import { useError } from "../../(errors)/errorContext";
|
import { useError } from "../../(errors)/errorContext";
|
||||||
import getApi from "../../lib/getApi";
|
import useApi from "../../lib/useApi";
|
||||||
import { shouldShowError } from "../../lib/errorUtils";
|
import { shouldShowError } from "../../lib/errorUtils";
|
||||||
|
|
||||||
type AudioWaveFormResponse = {
|
type AudioWaveFormResponse = {
|
||||||
@@ -16,16 +15,13 @@ const useWaveform = (id: string): AudioWaveFormResponse => {
|
|||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [error, setErrorState] = useState<Error | null>(null);
|
const [error, setErrorState] = useState<Error | null>(null);
|
||||||
const { setError } = useError();
|
const { setError } = useError();
|
||||||
const api = getApi();
|
const api = useApi();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!id || !api) return;
|
if (!id || !api) return;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const requestParameters: V1TranscriptGetAudioWaveformRequest = {
|
|
||||||
transcriptId: id,
|
|
||||||
};
|
|
||||||
api
|
api
|
||||||
.v1TranscriptGetAudioWaveform(requestParameters)
|
.v1TranscriptGetAudioWaveform(id)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
setWaveform(result);
|
setWaveform(result);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Peer from "simple-peer";
|
import Peer from "simple-peer";
|
||||||
import {
|
|
||||||
DefaultApi,
|
|
||||||
V1TranscriptRecordWebrtcRequest,
|
|
||||||
} from "../../api/apis/DefaultApi";
|
|
||||||
import { useError } from "../../(errors)/errorContext";
|
import { useError } from "../../(errors)/errorContext";
|
||||||
import getApi from "../../lib/getApi";
|
import useApi from "../../lib/useApi";
|
||||||
|
import { RtcOffer } from "../../api";
|
||||||
|
|
||||||
const useWebRTC = (
|
const useWebRTC = (
|
||||||
stream: MediaStream | null,
|
stream: MediaStream | null,
|
||||||
@@ -13,10 +10,10 @@ const useWebRTC = (
|
|||||||
): Peer => {
|
): Peer => {
|
||||||
const [peer, setPeer] = useState<Peer | null>(null);
|
const [peer, setPeer] = useState<Peer | null>(null);
|
||||||
const { setError } = useError();
|
const { setError } = useError();
|
||||||
const api = getApi();
|
const api = useApi();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!stream || !transcriptId) {
|
if (!stream || !transcriptId || !api) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,16 +35,13 @@ const useWebRTC = (
|
|||||||
p.on("signal", (data: any) => {
|
p.on("signal", (data: any) => {
|
||||||
if (!api) return;
|
if (!api) return;
|
||||||
if ("sdp" in data) {
|
if ("sdp" in data) {
|
||||||
const requestParameters: V1TranscriptRecordWebrtcRequest = {
|
const rtcOffer : RtcOffer = {
|
||||||
transcriptId: transcriptId,
|
|
||||||
rtcOffer: {
|
|
||||||
sdp: data.sdp,
|
sdp: data.sdp,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
},
|
};
|
||||||
};
|
|
||||||
|
|
||||||
api
|
api
|
||||||
.v1TranscriptRecordWebrtc(requestParameters)
|
.v1TranscriptRecordWebrtc(transcriptId, rtcOffer)
|
||||||
.then((answer) => {
|
.then((answer) => {
|
||||||
try {
|
try {
|
||||||
p.signal(answer);
|
p.signal(answer);
|
||||||
|
|||||||
36
www/app/api/Api.ts
Normal file
36
www/app/api/Api.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { BaseHttpRequest } from "./core/BaseHttpRequest";
|
||||||
|
import type { OpenAPIConfig } from "./core/OpenAPI";
|
||||||
|
import { FetchHttpRequest } from "./core/FetchHttpRequest";
|
||||||
|
|
||||||
|
import { DefaultService } from "./services/DefaultService";
|
||||||
|
|
||||||
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
||||||
|
|
||||||
|
export class Api {
|
||||||
|
public readonly default: DefaultService;
|
||||||
|
|
||||||
|
public readonly request: BaseHttpRequest;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
config?: Partial<OpenAPIConfig>,
|
||||||
|
HttpRequest: HttpRequestConstructor = FetchHttpRequest,
|
||||||
|
) {
|
||||||
|
this.request = new HttpRequest({
|
||||||
|
BASE: config?.BASE ?? "",
|
||||||
|
VERSION: config?.VERSION ?? "0.1.0",
|
||||||
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
||||||
|
CREDENTIALS: config?.CREDENTIALS ?? "include",
|
||||||
|
TOKEN: config?.TOKEN,
|
||||||
|
USERNAME: config?.USERNAME,
|
||||||
|
PASSWORD: config?.PASSWORD,
|
||||||
|
HEADERS: config?.HEADERS,
|
||||||
|
ENCODE_PATH: config?.ENCODE_PATH,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.default = new DefaultService(this.request);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
www/app/api/OpenApi.ts
Normal file
36
www/app/api/OpenApi.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { BaseHttpRequest } from "./core/BaseHttpRequest";
|
||||||
|
import type { OpenAPIConfig } from "./core/OpenAPI";
|
||||||
|
import { FetchHttpRequest } from "./core/FetchHttpRequest";
|
||||||
|
|
||||||
|
import { DefaultService } from "./services/DefaultService";
|
||||||
|
|
||||||
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
||||||
|
|
||||||
|
export class OpenApi {
|
||||||
|
public readonly default: DefaultService;
|
||||||
|
|
||||||
|
public readonly request: BaseHttpRequest;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
config?: Partial<OpenAPIConfig>,
|
||||||
|
HttpRequest: HttpRequestConstructor = FetchHttpRequest,
|
||||||
|
) {
|
||||||
|
this.request = new HttpRequest({
|
||||||
|
BASE: config?.BASE ?? "",
|
||||||
|
VERSION: config?.VERSION ?? "0.1.0",
|
||||||
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
||||||
|
CREDENTIALS: config?.CREDENTIALS ?? "include",
|
||||||
|
TOKEN: config?.TOKEN,
|
||||||
|
USERNAME: config?.USERNAME,
|
||||||
|
PASSWORD: config?.PASSWORD,
|
||||||
|
HEADERS: config?.HEADERS,
|
||||||
|
ENCODE_PATH: config?.ENCODE_PATH,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.default = new DefaultService(this.request);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
www/app/api/core/BaseHttpRequest.ts
Normal file
13
www/app/api/core/BaseHttpRequest.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { ApiRequestOptions } from "./ApiRequestOptions";
|
||||||
|
import type { CancelablePromise } from "./CancelablePromise";
|
||||||
|
import type { OpenAPIConfig } from "./OpenAPI";
|
||||||
|
|
||||||
|
export abstract class BaseHttpRequest {
|
||||||
|
constructor(public readonly config: OpenAPIConfig) {}
|
||||||
|
|
||||||
|
public abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
||||||
|
}
|
||||||
25
www/app/api/core/FetchHttpRequest.ts
Normal file
25
www/app/api/core/FetchHttpRequest.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { ApiRequestOptions } from "./ApiRequestOptions";
|
||||||
|
import { BaseHttpRequest } from "./BaseHttpRequest";
|
||||||
|
import type { CancelablePromise } from "./CancelablePromise";
|
||||||
|
import type { OpenAPIConfig } from "./OpenAPI";
|
||||||
|
import { request as __request } from "./request";
|
||||||
|
|
||||||
|
export class FetchHttpRequest extends BaseHttpRequest {
|
||||||
|
constructor(config: OpenAPIConfig) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request method
|
||||||
|
* @param options The request options from the service
|
||||||
|
* @returns CancelablePromise<T>
|
||||||
|
* @throws ApiError
|
||||||
|
*/
|
||||||
|
public override request<T>(options: ApiRequestOptions): CancelablePromise<T> {
|
||||||
|
return __request(this.config, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,10 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
export { OpenApi } from "./OpenApi";
|
||||||
|
|
||||||
export { ApiError } from "./core/ApiError";
|
export { ApiError } from "./core/ApiError";
|
||||||
|
export { BaseHttpRequest } from "./core/BaseHttpRequest";
|
||||||
export { CancelablePromise, CancelError } from "./core/CancelablePromise";
|
export { CancelablePromise, CancelError } from "./core/CancelablePromise";
|
||||||
export { OpenAPI } from "./core/OpenAPI";
|
export { OpenAPI } from "./core/OpenAPI";
|
||||||
export type { OpenAPIConfig } from "./core/OpenAPI";
|
export type { OpenAPIConfig } from "./core/OpenAPI";
|
||||||
|
|||||||
@@ -22,18 +22,19 @@ import type { UpdateTranscript } from "../models/UpdateTranscript";
|
|||||||
import type { UserInfo } from "../models/UserInfo";
|
import type { UserInfo } from "../models/UserInfo";
|
||||||
|
|
||||||
import type { CancelablePromise } from "../core/CancelablePromise";
|
import type { CancelablePromise } from "../core/CancelablePromise";
|
||||||
import { OpenAPI } from "../core/OpenAPI";
|
import type { BaseHttpRequest } from "../core/BaseHttpRequest";
|
||||||
import { request as __request } from "../core/request";
|
|
||||||
|
|
||||||
export class DefaultService {
|
export class DefaultService {
|
||||||
|
constructor(public readonly httpRequest: BaseHttpRequest) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metrics
|
* Metrics
|
||||||
* Endpoint that serves Prometheus metrics.
|
* Endpoint that serves Prometheus metrics.
|
||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static metrics(): CancelablePromise<any> {
|
public metrics(): CancelablePromise<any> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/metrics",
|
url: "/metrics",
|
||||||
});
|
});
|
||||||
@@ -46,11 +47,11 @@ export class DefaultService {
|
|||||||
* @returns Page_GetTranscript_ Successful Response
|
* @returns Page_GetTranscript_ Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptsList(
|
public v1TranscriptsList(
|
||||||
page: number = 1,
|
page: number = 1,
|
||||||
size: number = 50,
|
size: number = 50,
|
||||||
): CancelablePromise<Page_GetTranscript_> {
|
): CancelablePromise<Page_GetTranscript_> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts",
|
url: "/v1/transcripts",
|
||||||
query: {
|
query: {
|
||||||
@@ -69,10 +70,10 @@ export class DefaultService {
|
|||||||
* @returns GetTranscript Successful Response
|
* @returns GetTranscript Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptsCreate(
|
public v1TranscriptsCreate(
|
||||||
requestBody: CreateTranscript,
|
requestBody: CreateTranscript,
|
||||||
): CancelablePromise<GetTranscript> {
|
): CancelablePromise<GetTranscript> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/v1/transcripts",
|
url: "/v1/transcripts",
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
@@ -89,10 +90,10 @@ export class DefaultService {
|
|||||||
* @returns GetTranscript Successful Response
|
* @returns GetTranscript Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGet(
|
public v1TranscriptGet(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<GetTranscript> {
|
): CancelablePromise<GetTranscript> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}",
|
url: "/v1/transcripts/{transcript_id}",
|
||||||
path: {
|
path: {
|
||||||
@@ -111,11 +112,11 @@ export class DefaultService {
|
|||||||
* @returns GetTranscript Successful Response
|
* @returns GetTranscript Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptUpdate(
|
public v1TranscriptUpdate(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
requestBody: UpdateTranscript,
|
requestBody: UpdateTranscript,
|
||||||
): CancelablePromise<GetTranscript> {
|
): CancelablePromise<GetTranscript> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
url: "/v1/transcripts/{transcript_id}",
|
url: "/v1/transcripts/{transcript_id}",
|
||||||
path: {
|
path: {
|
||||||
@@ -135,10 +136,10 @@ export class DefaultService {
|
|||||||
* @returns DeletionStatus Successful Response
|
* @returns DeletionStatus Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptDelete(
|
public v1TranscriptDelete(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<DeletionStatus> {
|
): CancelablePromise<DeletionStatus> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
url: "/v1/transcripts/{transcript_id}",
|
url: "/v1/transcripts/{transcript_id}",
|
||||||
path: {
|
path: {
|
||||||
@@ -156,10 +157,10 @@ export class DefaultService {
|
|||||||
* @returns GetTranscriptTopic Successful Response
|
* @returns GetTranscriptTopic Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetTopics(
|
public v1TranscriptGetTopics(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<Array<GetTranscriptTopic>> {
|
): CancelablePromise<Array<GetTranscriptTopic>> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/topics",
|
url: "/v1/transcripts/{transcript_id}/topics",
|
||||||
path: {
|
path: {
|
||||||
@@ -177,10 +178,10 @@ export class DefaultService {
|
|||||||
* @returns GetTranscriptTopicWithWords Successful Response
|
* @returns GetTranscriptTopicWithWords Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetTopicsWithWords(
|
public v1TranscriptGetTopicsWithWords(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<Array<GetTranscriptTopicWithWords>> {
|
): CancelablePromise<Array<GetTranscriptTopicWithWords>> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/topics/with-words",
|
url: "/v1/transcripts/{transcript_id}/topics/with-words",
|
||||||
path: {
|
path: {
|
||||||
@@ -199,11 +200,11 @@ export class DefaultService {
|
|||||||
* @returns GetTranscriptTopicWithWordsPerSpeaker Successful Response
|
* @returns GetTranscriptTopicWithWordsPerSpeaker Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetTopicsWithWordsPerSpeaker(
|
public v1TranscriptGetTopicsWithWordsPerSpeaker(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
topicId: string,
|
topicId: string,
|
||||||
): CancelablePromise<GetTranscriptTopicWithWordsPerSpeaker> {
|
): CancelablePromise<GetTranscriptTopicWithWordsPerSpeaker> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/topics/{topic_id}/words-per-speaker",
|
url: "/v1/transcripts/{transcript_id}/topics/{topic_id}/words-per-speaker",
|
||||||
path: {
|
path: {
|
||||||
@@ -223,11 +224,11 @@ export class DefaultService {
|
|||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptHeadAudioMp3(
|
public v1TranscriptHeadAudioMp3(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
token?: string | null,
|
token?: string | null,
|
||||||
): CancelablePromise<any> {
|
): CancelablePromise<any> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "HEAD",
|
method: "HEAD",
|
||||||
url: "/v1/transcripts/{transcript_id}/audio/mp3",
|
url: "/v1/transcripts/{transcript_id}/audio/mp3",
|
||||||
path: {
|
path: {
|
||||||
@@ -249,11 +250,11 @@ export class DefaultService {
|
|||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetAudioMp3(
|
public v1TranscriptGetAudioMp3(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
token?: string | null,
|
token?: string | null,
|
||||||
): CancelablePromise<any> {
|
): CancelablePromise<any> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/audio/mp3",
|
url: "/v1/transcripts/{transcript_id}/audio/mp3",
|
||||||
path: {
|
path: {
|
||||||
@@ -274,10 +275,10 @@ export class DefaultService {
|
|||||||
* @returns AudioWaveform Successful Response
|
* @returns AudioWaveform Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetAudioWaveform(
|
public v1TranscriptGetAudioWaveform(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<AudioWaveform> {
|
): CancelablePromise<AudioWaveform> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/audio/waveform",
|
url: "/v1/transcripts/{transcript_id}/audio/waveform",
|
||||||
path: {
|
path: {
|
||||||
@@ -295,10 +296,10 @@ export class DefaultService {
|
|||||||
* @returns Participant Successful Response
|
* @returns Participant Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetParticipants(
|
public v1TranscriptGetParticipants(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<Array<Participant>> {
|
): CancelablePromise<Array<Participant>> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/participants",
|
url: "/v1/transcripts/{transcript_id}/participants",
|
||||||
path: {
|
path: {
|
||||||
@@ -317,11 +318,11 @@ export class DefaultService {
|
|||||||
* @returns Participant Successful Response
|
* @returns Participant Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptAddParticipant(
|
public v1TranscriptAddParticipant(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
requestBody: CreateParticipant,
|
requestBody: CreateParticipant,
|
||||||
): CancelablePromise<Participant> {
|
): CancelablePromise<Participant> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/v1/transcripts/{transcript_id}/participants",
|
url: "/v1/transcripts/{transcript_id}/participants",
|
||||||
path: {
|
path: {
|
||||||
@@ -342,11 +343,11 @@ export class DefaultService {
|
|||||||
* @returns Participant Successful Response
|
* @returns Participant Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetParticipant(
|
public v1TranscriptGetParticipant(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
participantId: string,
|
participantId: string,
|
||||||
): CancelablePromise<Participant> {
|
): CancelablePromise<Participant> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/participants/{participant_id}",
|
url: "/v1/transcripts/{transcript_id}/participants/{participant_id}",
|
||||||
path: {
|
path: {
|
||||||
@@ -367,12 +368,12 @@ export class DefaultService {
|
|||||||
* @returns Participant Successful Response
|
* @returns Participant Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptUpdateParticipant(
|
public v1TranscriptUpdateParticipant(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
participantId: string,
|
participantId: string,
|
||||||
requestBody: UpdateParticipant,
|
requestBody: UpdateParticipant,
|
||||||
): CancelablePromise<Participant> {
|
): CancelablePromise<Participant> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
url: "/v1/transcripts/{transcript_id}/participants/{participant_id}",
|
url: "/v1/transcripts/{transcript_id}/participants/{participant_id}",
|
||||||
path: {
|
path: {
|
||||||
@@ -394,11 +395,11 @@ export class DefaultService {
|
|||||||
* @returns DeletionStatus Successful Response
|
* @returns DeletionStatus Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptDeleteParticipant(
|
public v1TranscriptDeleteParticipant(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
participantId: string,
|
participantId: string,
|
||||||
): CancelablePromise<DeletionStatus> {
|
): CancelablePromise<DeletionStatus> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
url: "/v1/transcripts/{transcript_id}/participants/{participant_id}",
|
url: "/v1/transcripts/{transcript_id}/participants/{participant_id}",
|
||||||
path: {
|
path: {
|
||||||
@@ -418,11 +419,11 @@ export class DefaultService {
|
|||||||
* @returns SpeakerAssignmentStatus Successful Response
|
* @returns SpeakerAssignmentStatus Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptAssignSpeaker(
|
public v1TranscriptAssignSpeaker(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
requestBody: SpeakerAssignment,
|
requestBody: SpeakerAssignment,
|
||||||
): CancelablePromise<SpeakerAssignmentStatus> {
|
): CancelablePromise<SpeakerAssignmentStatus> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
url: "/v1/transcripts/{transcript_id}/speaker/assign",
|
url: "/v1/transcripts/{transcript_id}/speaker/assign",
|
||||||
path: {
|
path: {
|
||||||
@@ -443,11 +444,11 @@ export class DefaultService {
|
|||||||
* @returns SpeakerAssignmentStatus Successful Response
|
* @returns SpeakerAssignmentStatus Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptMergeSpeaker(
|
public v1TranscriptMergeSpeaker(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
requestBody: SpeakerMerge,
|
requestBody: SpeakerMerge,
|
||||||
): CancelablePromise<SpeakerAssignmentStatus> {
|
): CancelablePromise<SpeakerAssignmentStatus> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
url: "/v1/transcripts/{transcript_id}/speaker/merge",
|
url: "/v1/transcripts/{transcript_id}/speaker/merge",
|
||||||
path: {
|
path: {
|
||||||
@@ -468,11 +469,11 @@ export class DefaultService {
|
|||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptRecordUpload(
|
public v1TranscriptRecordUpload(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
formData: Body_transcript_record_upload_v1_transcripts__transcript_id__record_upload_post,
|
formData: Body_transcript_record_upload_v1_transcripts__transcript_id__record_upload_post,
|
||||||
): CancelablePromise<any> {
|
): CancelablePromise<any> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/v1/transcripts/{transcript_id}/record/upload",
|
url: "/v1/transcripts/{transcript_id}/record/upload",
|
||||||
path: {
|
path: {
|
||||||
@@ -492,10 +493,10 @@ export class DefaultService {
|
|||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptGetWebsocketEvents(
|
public v1TranscriptGetWebsocketEvents(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
): CancelablePromise<any> {
|
): CancelablePromise<any> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/transcripts/{transcript_id}/events",
|
url: "/v1/transcripts/{transcript_id}/events",
|
||||||
path: {
|
path: {
|
||||||
@@ -514,11 +515,11 @@ export class DefaultService {
|
|||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1TranscriptRecordWebrtc(
|
public v1TranscriptRecordWebrtc(
|
||||||
transcriptId: string,
|
transcriptId: string,
|
||||||
requestBody: RtcOffer,
|
requestBody: RtcOffer,
|
||||||
): CancelablePromise<any> {
|
): CancelablePromise<any> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/v1/transcripts/{transcript_id}/record/webrtc",
|
url: "/v1/transcripts/{transcript_id}/record/webrtc",
|
||||||
path: {
|
path: {
|
||||||
@@ -537,8 +538,8 @@ export class DefaultService {
|
|||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
public static v1UserMe(): CancelablePromise<UserInfo | null> {
|
public v1UserMe(): CancelablePromise<UserInfo | null> {
|
||||||
return __request(OpenAPI, {
|
return this.httpRequest.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/v1/me",
|
url: "/v1/me",
|
||||||
});
|
});
|
||||||
|
|||||||
7
www/app/lib/shareMode.ts
Normal file
7
www/app/lib/shareMode.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export type ShareMode = "public" | "semi-private" | "private" | null;
|
||||||
|
|
||||||
|
export function toShareMode(value: string | undefined | null): ShareMode {
|
||||||
|
return value === "public" || value === "semi-private" || value === "private"
|
||||||
|
? value
|
||||||
|
: null;
|
||||||
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { DefaultService, OpenAPI } from "../api";
|
|
||||||
|
|
||||||
import { useFiefAccessTokenInfo } from "@fief/fief/nextjs/react";
|
import { useFiefAccessTokenInfo } from "@fief/fief/nextjs/react";
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { DomainContext, featureEnabled } from "../[domain]/domainContext";
|
import { DomainContext, featureEnabled } from "../[domain]/domainContext";
|
||||||
import { CookieContext } from "../(auth)/fiefWrapper";
|
import { CookieContext } from "../(auth)/fiefWrapper";
|
||||||
|
import { OpenApi, DefaultService } from "../api";
|
||||||
|
|
||||||
export default function getApi(): DefaultService | undefined {
|
export default function useApi(): DefaultService | null {
|
||||||
const accessTokenInfo = useFiefAccessTokenInfo();
|
const accessTokenInfo = useFiefAccessTokenInfo();
|
||||||
const api_url = useContext(DomainContext).api_url;
|
const api_url = useContext(DomainContext).api_url;
|
||||||
const requireLogin = featureEnabled("requireLogin");
|
const requireLogin = featureEnabled("requireLogin");
|
||||||
const [api, setApi] = useState<DefaultService>();
|
const [ready, setReady] = useState<boolean>(false);
|
||||||
|
const [api, setApi] = useState<OpenApi | null>(null);
|
||||||
const { hasAuthCookie } = useContext(CookieContext);
|
const { hasAuthCookie } = useContext(CookieContext);
|
||||||
|
|
||||||
if (!api_url) throw new Error("no API URL");
|
if (!api_url) throw new Error("no API URL");
|
||||||
@@ -19,18 +19,16 @@ export default function getApi(): DefaultService | undefined {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// const apiConfiguration = new Configuration({
|
if (!accessTokenInfo)
|
||||||
// basePath: api_url,
|
return;
|
||||||
// accessToken: accessTokenInfo
|
|
||||||
// ? "Bearer " + accessTokenInfo.access_token
|
const openApi = new OpenApi({
|
||||||
// : undefined,
|
BASE: api_url,
|
||||||
// });
|
TOKEN: accessTokenInfo?.access_token
|
||||||
OpenAPI.BASE = api_url;
|
});
|
||||||
if (accessTokenInfo) {
|
|
||||||
OpenAPI.TOKEN = "Bearer " + accessTokenInfo.access_token;
|
setApi(openApi);
|
||||||
}
|
|
||||||
setApi(DefaultService);
|
|
||||||
}, [!accessTokenInfo, hasAuthCookie]);
|
}, [!accessTokenInfo, hasAuthCookie]);
|
||||||
|
|
||||||
return api;
|
return api?.default ?? null;
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"openapi": "openapi --input http://127.0.0.1:1250/openapi.json --output app/api && yarn format",
|
"openapi": "openapi --input http://127.0.0.1:1250/openapi.json --name OpenApi --output app/api && yarn format",
|
||||||
"openapi-old": "openapi-generator-cli generate -i http://localhost:1250/openapi.json -g typescript-fetch -o app/api && yarn format"
|
"openapi-old": "openapi-generator-cli generate -i http://localhost:1250/openapi.json -g typescript-fetch -o app/api && yarn format"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user