-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VT-8376:mpcRecoringParamsAdded (#219)
* VT-8376:mpcRecoringParamsAdded * VT-8376:GetRecordingTranscription * VT-8376 * VT-8376:unitTestCasesFuxed * dateChanged
- Loading branch information
1 parent
3581266
commit df06349
Showing
7 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
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
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
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,9 @@ | ||
{ | ||
"api_id": "e12d05fe-6979-485c-83dc-9276114dba3b", | ||
"cost": 0.05, | ||
"rate": 0.05, | ||
"recording_duration_ms": 22780, | ||
"recording_start_ms": 1729761222174, | ||
"status": "success", | ||
"transcription": "Okay. Recording has started. I'll tell something. Okay? HTTP, Plivo, Bin, Fraud, USWO, Plivo. You also speak. Yeah. You will prompt Now we can pass, I guess, and then resume on. If not, then we can check it. P a d 96 f d 9 f been on there now. I think we can disconnect the call before that. I think this one could be fine, I guess. Let's see, like, how we inside. Like, maybe we can disconnect the call and take 1. Sir, you you also disconnect. I also disconnect. Okay? Sure. Sure." | ||
} |
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
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
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,37 @@ | ||
package plivo | ||
|
||
type TranscriptionService struct { | ||
client *Client | ||
} | ||
|
||
type GetRecordingTranscriptionRequest struct { | ||
TranscriptionID string `json:"transcription_id"` | ||
TranscriptionType string `json:"type"` | ||
} | ||
|
||
type GetRecordingTranscriptionParams struct { | ||
Type string `url:"type"` | ||
} | ||
|
||
type GetRecordingTranscriptionResponse struct { | ||
APIID string `json:"api_id"` | ||
Cost float64 `json:"cost"` | ||
Rate float64 `json:"rate"` | ||
RecordingDurationMs float64 `json:"recording_duration_ms"` | ||
RecordingStartMs float64 `json:"recording_start_ms"` | ||
Status string `json:"status"` | ||
Transcription interface{} `json:"transcription"` | ||
} | ||
|
||
func (service *TranscriptionService) GetRecordingTranscription(request GetRecordingTranscriptionRequest) (response *GetRecordingTranscriptionResponse, err error) { | ||
params := GetRecordingTranscriptionParams{ | ||
Type: request.TranscriptionType, | ||
} | ||
req, err := service.client.NewRequest("GET", params, "Transcription/%s", request.TranscriptionID) | ||
if err != nil { | ||
return | ||
} | ||
response = &GetRecordingTranscriptionResponse{} | ||
err = service.client.ExecuteRequest(req, response, isVoiceRequest()) | ||
return | ||
} |
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,47 @@ | ||
package plivo | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
) | ||
|
||
// without queryParam passed | ||
func TestTranscriptionService_GetRecordingTranscription(t *testing.T) { | ||
expectResponse("getRecordingTranscription.json", 200) | ||
|
||
if _, err := client.Transcription.GetRecordingTranscription(GetRecordingTranscriptionRequest{ | ||
TranscriptionID: "e12d05fe-6979-485c-83dc-9276114dba3b", | ||
}); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.Transcription.GetRecordingTranscription(GetRecordingTranscriptionRequest{}) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
} | ||
|
||
// with queryParam | ||
func TestTranscriptionService_GetRecordingTranscriptionWithParam(t *testing.T) { | ||
expectResponse("getRecordingTranscription.json", 200) | ||
|
||
if _, err := client.Transcription.GetRecordingTranscription(GetRecordingTranscriptionRequest{ | ||
TranscriptionID: "e12d05fe-6979-485c-83dc-9276114dba3b", | ||
TranscriptionType: "raw", | ||
}); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.Transcription.GetRecordingTranscription(GetRecordingTranscriptionRequest{}) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
} |