-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathProgram.cs
115 lines (102 loc) · 3.83 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
using Deepgram.Logger;
using Deepgram.Models.Manage.v1;
namespace SampleApp
{
class Program
{
static async Task Main(string[] args)
{
// Initialize Library with default logging
// Normal logging is "Info" level
Library.Initialize();
// use the client factory with a API Key set with the "DEEPGRAM_API_KEY" environment variable
var deepgramClient = ClientFactory.CreateManageClient();
// get projects
var projectResp = await deepgramClient.GetProjects();
if (projectResp == null)
{
Console.WriteLine("ListProjects failed.");
Environment.Exit(1);
}
string projectId = "";
foreach (var project in projectResp.Projects)
{
projectId = project.ProjectId ?? "";
string myName = project.Name ?? "";
Console.WriteLine($"ListProjects() - ID: {projectId}, Name: {myName}");
break;
}
Console.WriteLine("\n\n\n");
// get models
var modelListResp = await deepgramClient.GetModels();
if (modelListResp == null)
{
Console.WriteLine("GetModels failed.");
Environment.Exit(1);
}
string modelId = "";
foreach (var model in modelListResp.Stt)
{
modelId = model.Uuid ?? "";
string modelName = model.Name ?? "";
Console.WriteLine($"Speech-to-Text Model - ID: {modelId}, Name: {modelName}");
}
foreach (var model in modelListResp.Tts)
{
string myId = model.Uuid ?? "";
string myName = model.Name ?? "";
Console.WriteLine($"Text-to-Speech - ID: {myId}, Name: {myName}");
}
Console.WriteLine("\n\n\n");
// get model
var modelResp = await deepgramClient.GetModel(modelId);
if (modelResp == null)
{
Console.WriteLine("No invites found");
}
else
{
Console.WriteLine($"{modelResp}");
}
Console.WriteLine("\n\n\n");
// get models per project
var projModelsResp = await deepgramClient.GetProjectModels(projectId);
if (projModelsResp == null)
{
Console.WriteLine("GetModels failed.");
Environment.Exit(1);
}
modelId = "";
foreach (var model in projModelsResp.Stt)
{
modelId = model.Uuid ?? "";
string modelName = model.Name ?? "";
Console.WriteLine($"Speech-to-Text Model - ID: {modelId}, Name: {modelName}");
}
foreach (var model in projModelsResp.Tts)
{
string myId = model.Uuid ?? "";
string myName = model.Name ?? "";
Console.WriteLine($"Text-to-Speech - ID: {myId}, Name: {myName}");
}
Console.WriteLine("\n\n\n");
// get model
var projModelResp = await deepgramClient.GetProjectModel(projectId, modelId);
if (projModelResp == null)
{
Console.WriteLine("\n\nNo invites found\n\n");
}
else
{
Console.WriteLine($"{projModelResp}");
}
Console.WriteLine("\n\nPress any key to exit.");
Console.ReadKey();
// Teardown Library
Library.Terminate();
}
}
}