-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from tmddus2/refactor/240228-clova-api
Refactor(#307): CLOVA API ํธ์ถ ์คํจ ์ ์ฌ์๋
- Loading branch information
Showing
4 changed files
with
42 additions
and
15 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
mediaServer/src/constants/clova-api-response-type.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const SUCCEEDED = "SUCCEEDED"; | ||
const RETRIABLE_ERROR = ["ERROR_SERVER_BUSY", "ERROR_AUDIO_CONVERSION", "ERROR_INTERNAL_ERROR", "ERROR_EXTERNAL_ERROR"]; | ||
|
||
export { SUCCEEDED, RETRIABLE_ERROR }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const ClovaApiRequest =(url: any, code: string) =>{ | ||
const headers = new Headers(); | ||
headers.append('Content-Type', 'application/json'); | ||
headers.append('X-CLOVASPEECH-API-KEY', process.env.CLOVA_API_KEY as string); | ||
return { | ||
method: 'POST', | ||
headers: headers, | ||
body: JSON.stringify({ | ||
language: process.env.CLOVA_API_LANGUAGE, | ||
completion: process.env.CLOVA_API_COMPLETION, | ||
url: url, | ||
callback: `${process.env.SERVER_API_URL}/lecture/${code}/text` | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export class ClovaApiReponse { | ||
result:string; | ||
message: string; | ||
timestamp: string; | ||
|
||
constructor(result:string, message:string, timestamp:string) { | ||
this.result = result; | ||
this.message = message; | ||
this.timestamp = timestamp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters