diff --git a/reference.md b/reference.md index e6c34c4..73d83b4 100644 --- a/reference.md +++ b/reference.md @@ -836,6 +836,209 @@ await client.Squads.UpdateAsync( + + + + +## KnowledgeBases +
client.KnowledgeBases.ListAsync(KnowledgeBasesListRequest { ... }) -> IEnumerable +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.KnowledgeBases.ListAsync(new KnowledgeBasesListRequest()); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `KnowledgeBasesListRequest` + +
+
+
+
+ + +
+
+ + +
client.KnowledgeBases.CreateAsync(object { ... }) -> object +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.KnowledgeBases.CreateAsync( + new CreateCustomKnowledgeBaseDto { Server = new Server { Url = "url" } } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `object` + +
+
+
+
+ + +
+
+
+ +
client.KnowledgeBases.GetAsync(id) -> object +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.KnowledgeBases.GetAsync("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` + +
+
+
+
+ + +
+
+
+ +
client.KnowledgeBases.DeleteAsync(id) -> object +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.KnowledgeBases.DeleteAsync("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` + +
+
+
+
+ + +
+
+
+ +
client.KnowledgeBases.UpdateAsync(id) -> object +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.KnowledgeBases.UpdateAsync("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` + +
+
+
+
+ +
@@ -1103,7 +1306,14 @@ await client.Tools.ListAsync(new ToolsListRequest());
```csharp -await client.Tools.CreateAsync(new CreateOutputToolDto { Async = false }); +await client.Tools.CreateAsync( + new CreateTextEditorToolDto + { + Async = false, + SubType = "text_editor_20241022", + Name = "str_replace_editor", + } +); ```
@@ -1413,7 +1623,7 @@ await client.Files.UpdateAsync("id", new UpdateFileDto()); ## Analytics -
client.Analytics.GetAsync(AnalyticsQueryDto { ... }) -> IEnumerable +
client.Analytics.GetAsync()
@@ -1426,55 +1636,20 @@ await client.Files.UpdateAsync("id", new UpdateFileDto());
```csharp -await client.Analytics.GetAsync( - new AnalyticsQueryDto - { - Queries = new List() - { - new AnalyticsQuery - { - Table = "call", - Name = "name", - Operations = new List() - { - new AnalyticsOperation - { - Operation = AnalyticsOperationOperation.Sum, - Column = AnalyticsOperationColumn.Id, - }, - }, - }, - }, - } -); +await client.Analytics.GetAsync(); ```
-#### ⚙️ Parameters - -
-
- -
-
- -**request:** `AnalyticsQueryDto` - -
-
-
-
-
## Logs -
client.Logs.GetAsync(LogsGetRequest { ... }) -> LogsPaginatedResponse +
client.Logs.GetAsync(LogsGetRequest { ... }) -> Pager
diff --git a/src/Vapi.Net.Test/Core/EnumSerializerTests.cs b/src/Vapi.Net.Test/Core/EnumSerializerTests.cs new file mode 100644 index 0000000..2ccc2b6 --- /dev/null +++ b/src/Vapi.Net.Test/Core/EnumSerializerTests.cs @@ -0,0 +1,61 @@ +using System; +using System.Runtime.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core +{ + [TestFixture] + public class StringEnumSerializerTests + { + private static readonly JsonSerializerOptions JsonOptions = new() { WriteIndented = true }; + + private const DummyEnum KnownEnumValue2 = DummyEnum.KnownValue2; + private const string KnownEnumValue2String = "known_value2"; + + private static readonly string JsonWithKnownEnum2 = $$""" + { + "enum_property": "{{KnownEnumValue2String}}" + } + """; + + [Test] + public void ShouldParseKnownEnumValue2() + { + var obj = JsonSerializer.Deserialize(JsonWithKnownEnum2, JsonOptions); + Assert.That(obj, Is.Not.Null); + Assert.That(obj.EnumProperty, Is.EqualTo(KnownEnumValue2)); + } + + [Test] + public void ShouldSerializeKnownEnumValue2() + { + var json = JsonSerializer.SerializeToElement( + new DummyObject { EnumProperty = KnownEnumValue2 }, + JsonOptions + ); + TestContext.Out.WriteLine("Serialized JSON: \n" + json); + var enumString = json.GetProperty("enum_property").GetString(); + Assert.That(enumString, Is.Not.Null); + Assert.That(enumString, Is.EqualTo(KnownEnumValue2String)); + } + } + + public class DummyObject + { + [JsonPropertyName("enum_property")] + public DummyEnum EnumProperty { get; set; } + } + + [JsonConverter(typeof(EnumSerializer))] + public enum DummyEnum + { + [EnumMember(Value = "known_value1")] + KnownValue1, + + [EnumMember(Value = "known_value2")] + KnownValue2, + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/GuidCursorTest.cs b/src/Vapi.Net.Test/Core/Pagination/GuidCursorTest.cs new file mode 100644 index 0000000..547ecd5 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/GuidCursorTest.cs @@ -0,0 +1,107 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class GuidCursorTest +{ + [Test] + public async Task CursorPagerShouldWorkWithGuidCursors() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + private static readonly Guid? Cursor1 = null; + private static readonly Guid Cursor2 = new("00000000-0000-0000-0000-000000000001"); + private static readonly Guid Cursor3 = new("00000000-0000-0000-0000-000000000001"); + private Guid? _cursorCopy; + + private Pager CreatePager() + { + var responses = new List + { + new() + { + Data = new() { Items = ["item1", "item2"] }, + Cursor = new() { Next = Cursor2 }, + }, + new() + { + Data = new() { Items = ["item1"] }, + Cursor = new() { Next = Cursor3 }, + }, + new() + { + Data = new() { Items = [] }, + Cursor = new() { Next = null }, + }, + }.GetEnumerator(); + _cursorCopy = Cursor1; + Pager pager = new CursorPager( + new() { Cursor = Cursor1 }, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + (request, cursor) => + { + request.Cursor = cursor; + _cursorCopy = cursor; + }, + response => response?.Cursor?.Next, + response => response?.Data?.Items?.ToList() + ); + return pager; + } + + private async Task AssertPager(Pager pager) + { + var pageEnumerator = pager.AsPagesAsync().GetAsyncEnumerator(); + + // first page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + var page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(2)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor1)); + + // second page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(1)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor2)); + + // third page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(0)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor3)); + + // no more + Assert.That(await pageEnumerator.MoveNextAsync(), Is.False); + } + + private class Request + { + public required Guid? Cursor { get; set; } + } + + private class Response + { + public required Data Data { get; set; } + public required Cursor Cursor { get; set; } + } + + private class Data + { + public required IEnumerable Items { get; set; } + } + + private class Cursor + { + public required Guid? Next { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/HasNextPageOffsetTest.cs b/src/Vapi.Net.Test/Core/Pagination/HasNextPageOffsetTest.cs new file mode 100644 index 0000000..1098db4 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/HasNextPageOffsetTest.cs @@ -0,0 +1,94 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class HasNextPageOffsetTest +{ + [Test] + public async Task OffsetPagerShouldWorkWithHasNextPage() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + private static Pager CreatePager() + { + var responses = new List + { + new() + { + Data = new() { Items = ["item1", "item2"] }, + HasNext = true, + }, + new() + { + Data = new() { Items = ["item1", "item2"] }, + HasNext = true, + }, + new() + { + Data = new() { Items = ["item1"] }, + HasNext = false, + }, + }.GetEnumerator(); + Pager pager = new OffsetPager( + new() { Pagination = new() { Page = 1 } }, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + request => request?.Pagination?.Page ?? 0, + (request, offset) => + { + request.Pagination ??= new(); + request.Pagination.Page = offset; + }, + null, + response => response?.Data?.Items?.ToList(), + response => response.HasNext + ); + return pager; + } + + private static async Task AssertPager(Pager pager) + { + var pageCounter = 0; + var itemCounter = 0; + await foreach (var page in pager.AsPagesAsync()) + { + pageCounter++; + itemCounter += page.Items.Count; + } + + Assert.Multiple(() => + { + Assert.That(pageCounter, Is.EqualTo(3)); + Assert.That(itemCounter, Is.EqualTo(5)); + }); + } + + private class Request + { + public Pagination Pagination { get; set; } + } + + private class Pagination + { + public int Page { get; set; } + } + + private class Response + { + public Data Data { get; set; } + public bool HasNext { get; set; } + } + + private class Data + { + public IEnumerable Items { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/IntOffsetTest.cs b/src/Vapi.Net.Test/Core/Pagination/IntOffsetTest.cs new file mode 100644 index 0000000..50556c3 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/IntOffsetTest.cs @@ -0,0 +1,81 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class IntOffsetTest +{ + [Test] + public async Task OffsetPagerShouldWorkWithIntPage() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + public Pager CreatePager() + { + var responses = new List + { + new() { Data = new() { Items = ["item1", "item2"] } }, + new() { Data = new() { Items = ["item1"] } }, + new() { Data = new() { Items = [] } }, + }.GetEnumerator(); + Pager pager = new OffsetPager( + new() { Pagination = new() { Page = 1 } }, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + request => request.Pagination.Page, + (request, offset) => + { + request.Pagination ??= new(); + request.Pagination.Page = offset; + }, + null, + response => response?.Data?.Items?.ToList(), + null + ); + return pager; + } + + public async Task AssertPager(Pager pager) + { + var pageCounter = 0; + var itemCounter = 0; + await foreach (var page in pager.AsPagesAsync()) + { + pageCounter++; + itemCounter += page.Items.Count; + } + + Assert.Multiple(() => + { + Assert.That(pageCounter, Is.EqualTo(3)); + Assert.That(itemCounter, Is.EqualTo(3)); + }); + } + + private class Request + { + public Pagination Pagination { get; set; } + } + + private class Pagination + { + public int Page { get; set; } + } + + private class Response + { + public Data Data { get; set; } + } + + private class Data + { + public IEnumerable Items { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/LongOffsetTest.cs b/src/Vapi.Net.Test/Core/Pagination/LongOffsetTest.cs new file mode 100644 index 0000000..7d57ef9 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/LongOffsetTest.cs @@ -0,0 +1,81 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class LongOffsetTest +{ + [Test] + public async Task OffsetPagerShouldWorkWithLongPage() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + private static Pager CreatePager() + { + var responses = new List + { + new() { Data = new() { Items = ["item1", "item2"] } }, + new() { Data = new() { Items = ["item1"] } }, + new() { Data = new() { Items = [] } }, + }.GetEnumerator(); + Pager pager = new OffsetPager( + new() { Pagination = new() { Page = 1 } }, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + request => request?.Pagination?.Page ?? 0, + (request, offset) => + { + request.Pagination ??= new(); + request.Pagination.Page = offset; + }, + null, + response => response?.Data?.Items?.ToList(), + null + ); + return pager; + } + + private static async Task AssertPager(Pager pager) + { + var pageCounter = 0; + var itemCounter = 0; + await foreach (var page in pager.AsPagesAsync()) + { + pageCounter++; + itemCounter += page.Items.Count; + } + + Assert.Multiple(() => + { + Assert.That(pageCounter, Is.EqualTo(3)); + Assert.That(itemCounter, Is.EqualTo(3)); + }); + } + + private class Request + { + public Pagination Pagination { get; set; } + } + + private class Pagination + { + public long Page { get; set; } + } + + private class Response + { + public Data Data { get; set; } + } + + private class Data + { + public IEnumerable Items { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/NoRequestCursorTest.cs b/src/Vapi.Net.Test/Core/Pagination/NoRequestCursorTest.cs new file mode 100644 index 0000000..4375158 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/NoRequestCursorTest.cs @@ -0,0 +1,107 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class NoRequestCursorTest +{ + [Test] + public async Task CursorPagerShouldWorkWithStringCursor() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + private const string? Cursor1 = null; + private const string Cursor2 = "cursor2"; + private const string Cursor3 = "cursor3"; + private string? _cursorCopy; + + private Pager CreatePager() + { + var responses = new List + { + new() + { + Data = new() { Items = ["item1", "item2"] }, + Cursor = new() { Next = Cursor2 }, + }, + new() + { + Data = new() { Items = ["item1"] }, + Cursor = new() { Next = Cursor3 }, + }, + new() + { + Data = new() { Items = [] }, + Cursor = new() { Next = null }, + }, + }.GetEnumerator(); + _cursorCopy = Cursor1; + Pager pager = new CursorPager( + null, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + (request, cursor) => + { + request.Cursor = cursor; + _cursorCopy = cursor; + }, + response => response?.Cursor?.Next, + response => response?.Data?.Items?.ToList() + ); + return pager; + } + + private async Task AssertPager(Pager pager) + { + var pageEnumerator = pager.AsPagesAsync().GetAsyncEnumerator(); + + // first page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + var page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(2)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor1)); + + // second page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(1)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor2)); + + // third page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(0)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor3)); + + // no more + Assert.That(await pageEnumerator.MoveNextAsync(), Is.False); + } + + private class Request + { + public required string? Cursor { get; set; } + } + + private class Response + { + public required Data Data { get; set; } + public required Cursor Cursor { get; set; } + } + + private class Data + { + public required IEnumerable Items { get; set; } + } + + private class Cursor + { + public required string? Next { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/NoRequestOffsetTest.cs b/src/Vapi.Net.Test/Core/Pagination/NoRequestOffsetTest.cs new file mode 100644 index 0000000..cdbe82d --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/NoRequestOffsetTest.cs @@ -0,0 +1,81 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class NoRequestOffsetTest +{ + [Test] + public async Task OffsetPagerShouldWorkWithoutRequest() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + public Pager CreatePager() + { + var responses = new List + { + new() { Data = new() { Items = ["item1", "item2"] } }, + new() { Data = new() { Items = ["item1"] } }, + new() { Data = new() { Items = [] } }, + }.GetEnumerator(); + Pager pager = new OffsetPager( + null, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + request => request?.Pagination?.Page ?? 0, + (request, offset) => + { + request.Pagination ??= new(); + request.Pagination.Page = offset; + }, + null, + response => response?.Data?.Items?.ToList(), + null + ); + return pager; + } + + public async Task AssertPager(Pager pager) + { + var pageCounter = 0; + var itemCounter = 0; + await foreach (var page in pager.AsPagesAsync()) + { + pageCounter++; + itemCounter += page.Items.Count; + } + + Assert.Multiple(() => + { + Assert.That(pageCounter, Is.EqualTo(3)); + Assert.That(itemCounter, Is.EqualTo(3)); + }); + } + + private class Request + { + public Pagination Pagination { get; set; } + } + + private class Pagination + { + public int Page { get; set; } + } + + private class Response + { + public Data Data { get; set; } + } + + private class Data + { + public IEnumerable Items { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/StepOffsetTest.cs b/src/Vapi.Net.Test/Core/Pagination/StepOffsetTest.cs new file mode 100644 index 0000000..06ea954 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/StepOffsetTest.cs @@ -0,0 +1,96 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class StepPageOffsetPaginationTest +{ + [Test] + public async Task OffsetPagerShouldWorkWithStep() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + private Pagination _paginationCopy; + + private Pager CreatePager() + { + var responses = new List + { + new() { Data = new() { Items = ["item1", "item2"] } }, + new() { Data = new() { Items = ["item1"] } }, + new() { Data = new() { Items = [] } }, + }.GetEnumerator(); + _paginationCopy = new() { ItemOffset = 0, PageSize = 2 }; + Pager pager = new OffsetPager( + new() { Pagination = _paginationCopy }, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + request => request?.Pagination?.ItemOffset ?? 0, + (request, offset) => + { + request.Pagination ??= new(); + request.Pagination.ItemOffset = offset; + _paginationCopy = request.Pagination; + }, + request => request?.Pagination?.PageSize, + response => response?.Data?.Items?.ToList(), + null + ); + return pager; + } + + private async Task AssertPager(Pager pager) + { + var pageEnumerator = pager.AsPagesAsync().GetAsyncEnumerator(); + + // first page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + var page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(2)); + Assert.That(_paginationCopy.ItemOffset, Is.EqualTo(0)); + + // second page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(1)); + Assert.That(_paginationCopy.ItemOffset, Is.EqualTo(2)); + + // third page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(0)); + Assert.That(_paginationCopy.ItemOffset, Is.EqualTo(3)); + + // no more + Assert.That(await pageEnumerator.MoveNextAsync(), Is.False); + } + + private class Request + { + public Pagination Pagination { get; set; } + } + + private class Pagination + { + public int ItemOffset { get; set; } + public int PageSize { get; set; } + } + + private class Response + { + public Data Data { get; set; } + public bool HasNext { get; set; } + } + + private class Data + { + public IEnumerable Items { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Core/Pagination/StringCursorTest.cs b/src/Vapi.Net.Test/Core/Pagination/StringCursorTest.cs new file mode 100644 index 0000000..34f3665 --- /dev/null +++ b/src/Vapi.Net.Test/Core/Pagination/StringCursorTest.cs @@ -0,0 +1,107 @@ +using NUnit.Framework; +using Vapi.Net.Core; + +namespace Vapi.Net.Test.Core.Pagination; + +[TestFixture(Category = "Pagination")] +public class StringCursorTest +{ + [Test] + public async Task CursorPagerShouldWorkWithStringCursor() + { + var pager = CreatePager(); + await AssertPager(pager); + } + + private const string? Cursor1 = null; + private const string Cursor2 = "cursor2"; + private const string Cursor3 = "cursor3"; + private string? _cursorCopy; + + private Pager CreatePager() + { + var responses = new List + { + new() + { + Data = new() { Items = ["item1", "item2"] }, + Cursor = new() { Next = Cursor2 }, + }, + new() + { + Data = new() { Items = ["item1"] }, + Cursor = new() { Next = Cursor3 }, + }, + new() + { + Data = new() { Items = [] }, + Cursor = new() { Next = null }, + }, + }.GetEnumerator(); + _cursorCopy = Cursor1; + Pager pager = new CursorPager( + new() { Cursor = Cursor1 }, + null, + (_, _, _) => + { + responses.MoveNext(); + return Task.FromResult(responses.Current); + }, + (request, cursor) => + { + request.Cursor = cursor; + _cursorCopy = cursor; + }, + response => response?.Cursor?.Next, + response => response?.Data?.Items?.ToList() + ); + return pager; + } + + private async Task AssertPager(Pager pager) + { + var pageEnumerator = pager.AsPagesAsync().GetAsyncEnumerator(); + + // first page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + var page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(2)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor1)); + + // second page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(1)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor2)); + + // third page + Assert.That(await pageEnumerator.MoveNextAsync(), Is.True); + page = pageEnumerator.Current; + Assert.That(page.Items, Has.Count.EqualTo(0)); + Assert.That(_cursorCopy, Is.EqualTo(Cursor3)); + + // no more + Assert.That(await pageEnumerator.MoveNextAsync(), Is.False); + } + + private class Request + { + public required string? Cursor { get; set; } + } + + private class Response + { + public required Data Data { get; set; } + public required Cursor Cursor { get; set; } + } + + private class Data + { + public required IEnumerable Items { get; set; } + } + + private class Cursor + { + public required string? Next { get; set; } + } +} diff --git a/src/Vapi.Net.Test/Vapi.Net.Test.Custom.props b/src/Vapi.Net.Test/Vapi.Net.Test.Custom.props new file mode 100644 index 0000000..55e683b --- /dev/null +++ b/src/Vapi.Net.Test/Vapi.Net.Test.Custom.props @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/src/Vapi.Net.Test/Vapi.Net.Test.csproj b/src/Vapi.Net.Test/Vapi.Net.Test.csproj index a548895..edd3777 100644 --- a/src/Vapi.Net.Test/Vapi.Net.Test.csproj +++ b/src/Vapi.Net.Test/Vapi.Net.Test.csproj @@ -10,17 +10,24 @@ - - - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - + + \ No newline at end of file diff --git a/src/Vapi.Net.sln b/src/Vapi.Net.sln index e838e58..2548af1 100644 --- a/src/Vapi.Net.sln +++ b/src/Vapi.Net.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Net", "Vapi.Net\Vapi.Net.csproj", "{B83D2DBD-42AA-473A-8B19-7D0F2D50D424}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Net", "Vapi.Net\Vapi.Net.csproj", "{57D38CAA-CBE8-4282-A3BA-13C5EAE34973}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Net.Test", "Vapi.Net.Test\Vapi.Net.Test.csproj", "{BAB2C41F-54CA-4A8A-896A-689CCA5E4A06}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Net.Test", "Vapi.Net.Test\Vapi.Net.Test.csproj", "{63A8FF3A-85C8-406C-A783-68BB569A5872}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,13 +16,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B83D2DBD-42AA-473A-8B19-7D0F2D50D424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B83D2DBD-42AA-473A-8B19-7D0F2D50D424}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B83D2DBD-42AA-473A-8B19-7D0F2D50D424}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B83D2DBD-42AA-473A-8B19-7D0F2D50D424}.Release|Any CPU.Build.0 = Release|Any CPU - {BAB2C41F-54CA-4A8A-896A-689CCA5E4A06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BAB2C41F-54CA-4A8A-896A-689CCA5E4A06}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BAB2C41F-54CA-4A8A-896A-689CCA5E4A06}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BAB2C41F-54CA-4A8A-896A-689CCA5E4A06}.Release|Any CPU.Build.0 = Release|Any CPU + {57D38CAA-CBE8-4282-A3BA-13C5EAE34973}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57D38CAA-CBE8-4282-A3BA-13C5EAE34973}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57D38CAA-CBE8-4282-A3BA-13C5EAE34973}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57D38CAA-CBE8-4282-A3BA-13C5EAE34973}.Release|Any CPU.Build.0 = Release|Any CPU + {63A8FF3A-85C8-406C-A783-68BB569A5872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63A8FF3A-85C8-406C-A783-68BB569A5872}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63A8FF3A-85C8-406C-A783-68BB569A5872}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63A8FF3A-85C8-406C-A783-68BB569A5872}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/Vapi.Net/Analytics/AnalyticsClient.cs b/src/Vapi.Net/Analytics/AnalyticsClient.cs index 237b0ac..6509ed3 100644 --- a/src/Vapi.Net/Analytics/AnalyticsClient.cs +++ b/src/Vapi.Net/Analytics/AnalyticsClient.cs @@ -1,6 +1,6 @@ using System.Net.Http; -using System.Text.Json; using System.Threading; +using System.Threading.Tasks; using Vapi.Net.Core; #nullable enable @@ -18,31 +18,10 @@ internal AnalyticsClient(RawClient client) /// /// - /// await client.Analytics.GetAsync( - /// new AnalyticsQueryDto - /// { - /// Queries = new List() - /// { - /// new AnalyticsQuery - /// { - /// Table = "call", - /// Name = "name", - /// Operations = new List() - /// { - /// new AnalyticsOperation - /// { - /// Operation = AnalyticsOperationOperation.Sum, - /// Column = AnalyticsOperationColumn.Id, - /// }, - /// }, - /// }, - /// }, - /// } - /// ); + /// await client.Analytics.GetAsync(); /// /// - public async Task> GetAsync( - AnalyticsQueryDto request, + public async Task GetAsync( RequestOptions? options = null, CancellationToken cancellationToken = default ) @@ -53,24 +32,15 @@ public async Task> GetAsync( BaseUrl = _client.Options.BaseUrl, Method = HttpMethod.Post, Path = "analytics", - Body = request, Options = options, }, cancellationToken ); - var responseBody = await response.Raw.Content.ReadAsStringAsync(); if (response.StatusCode is >= 200 and < 400) { - try - { - return JsonUtils.Deserialize>(responseBody)!; - } - catch (JsonException e) - { - throw new VapiClientException("Failed to deserialize response", e); - } + return; } - + var responseBody = await response.Raw.Content.ReadAsStringAsync(); throw new VapiClientApiException( $"Error with status code {response.StatusCode}", response.StatusCode, diff --git a/src/Vapi.Net/Assistants/AssistantsClient.cs b/src/Vapi.Net/Assistants/AssistantsClient.cs index 2563705..3cc3be4 100644 --- a/src/Vapi.Net/Assistants/AssistantsClient.cs +++ b/src/Vapi.Net/Assistants/AssistantsClient.cs @@ -113,6 +113,7 @@ public async Task CreateAsync( Method = HttpMethod.Post, Path = "assistant", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken @@ -238,6 +239,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"assistant/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/Assistants/Requests/UpdateAssistantDto.cs b/src/Vapi.Net/Assistants/Requests/UpdateAssistantDto.cs index b4eab80..a9501b9 100644 --- a/src/Vapi.Net/Assistants/Requests/UpdateAssistantDto.cs +++ b/src/Vapi.Net/Assistants/Requests/UpdateAssistantDto.cs @@ -25,6 +25,14 @@ public record UpdateAssistantDto [JsonPropertyName("voice")] public object? Voice { get; set; } + /// + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + /// + [JsonPropertyName("firstMessage")] + public string? FirstMessage { get; set; } + /// /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// @@ -45,7 +53,7 @@ public record UpdateAssistantDto public bool? HipaaEnabled { get; set; } /// - /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. /// [JsonPropertyName("clientMessages")] public IEnumerable? ClientMessages { get; set; } @@ -78,16 +86,6 @@ public record UpdateAssistantDto [JsonPropertyName("backgroundSound")] public UpdateAssistantDtoBackgroundSound? BackgroundSound { get; set; } - /// - /// This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. - /// - /// Default `false` while in beta. - /// - /// @default false - /// - [JsonPropertyName("backchannelingEnabled")] - public bool? BackchannelingEnabled { get; set; } - /// /// This enables filtering of noise and background speech while the user is talking. /// @@ -122,14 +120,6 @@ public record UpdateAssistantDto [JsonPropertyName("name")] public string? Name { get; set; } - /// - /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). - /// - /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. - /// - [JsonPropertyName("firstMessage")] - public string? FirstMessage { get; set; } - /// /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. /// This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. @@ -166,24 +156,6 @@ public record UpdateAssistantDto [JsonPropertyName("metadata")] public object? Metadata { get; set; } - /// - /// This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. - /// - /// All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation. - /// - /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl - /// - [JsonPropertyName("serverUrl")] - public string? ServerUrl { get; set; } - - /// - /// This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. - /// - /// Same precedence logic as serverUrl. - /// - [JsonPropertyName("serverUrlSecret")] - public string? ServerUrlSecret { get; set; } - /// /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. /// @@ -248,6 +220,18 @@ public record UpdateAssistantDto [JsonPropertyName("credentialIds")] public IEnumerable? CredentialIds { get; set; } + /// + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoBackgroundSound.cs b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoBackgroundSound.cs index 0bf1ab4..1d1dd56 100644 --- a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoBackgroundSound.cs +++ b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoBackgroundSound.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateAssistantDtoBackgroundSound { [EnumMember(Value = "off")] diff --git a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoClientMessagesItem.cs b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoClientMessagesItem.cs index c7d6f67..1fcb531 100644 --- a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoClientMessagesItem.cs +++ b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoClientMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateAssistantDtoClientMessagesItem { [EnumMember(Value = "conversation-update")] @@ -45,6 +45,9 @@ public enum UpdateAssistantDtoClientMessagesItem [EnumMember(Value = "tool-calls-result")] ToolCallsResult, + [EnumMember(Value = "transfer-update")] + TransferUpdate, + [EnumMember(Value = "user-interrupted")] UserInterrupted, diff --git a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoFirstMessageMode.cs b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoFirstMessageMode.cs index 252d680..8487391 100644 --- a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoFirstMessageMode.cs +++ b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoFirstMessageMode.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateAssistantDtoFirstMessageMode { [EnumMember(Value = "assistant-speaks-first")] diff --git a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoServerMessagesItem.cs b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoServerMessagesItem.cs index 0e82981..42b21e9 100644 --- a/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoServerMessagesItem.cs +++ b/src/Vapi.Net/Assistants/Types/UpdateAssistantDtoServerMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateAssistantDtoServerMessagesItem { [EnumMember(Value = "conversation-update")] @@ -24,6 +24,9 @@ public enum UpdateAssistantDtoServerMessagesItem [EnumMember(Value = "language-changed")] LanguageChanged, + [EnumMember(Value = "language-change-detected")] + LanguageChangeDetected, + [EnumMember(Value = "model-output")] ModelOutput, diff --git a/src/Vapi.Net/Blocks/BlocksClient.cs b/src/Vapi.Net/Blocks/BlocksClient.cs index 4560920..14be70a 100644 --- a/src/Vapi.Net/Blocks/BlocksClient.cs +++ b/src/Vapi.Net/Blocks/BlocksClient.cs @@ -113,6 +113,7 @@ public async Task CreateAsync( Method = HttpMethod.Post, Path = "block", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken @@ -238,6 +239,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"block/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/Calls/CallsClient.cs b/src/Vapi.Net/Calls/CallsClient.cs index 851c941..6f3b980 100644 --- a/src/Vapi.Net/Calls/CallsClient.cs +++ b/src/Vapi.Net/Calls/CallsClient.cs @@ -28,10 +28,18 @@ public async Task> ListAsync( ) { var _query = new Dictionary(); + if (request.Id != null) + { + _query["id"] = request.Id; + } if (request.AssistantId != null) { _query["assistantId"] = request.AssistantId; } + if (request.PhoneNumberId != null) + { + _query["phoneNumberId"] = request.PhoneNumberId; + } if (request.Limit != null) { _query["limit"] = request.Limit.ToString(); @@ -117,6 +125,7 @@ public async Task CreateAsync( Method = HttpMethod.Post, Path = "call", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken @@ -242,6 +251,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"call/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/Calls/Requests/CallsListRequest.cs b/src/Vapi.Net/Calls/Requests/CallsListRequest.cs index 61a18d1..5dc56fb 100644 --- a/src/Vapi.Net/Calls/Requests/CallsListRequest.cs +++ b/src/Vapi.Net/Calls/Requests/CallsListRequest.cs @@ -6,11 +6,23 @@ namespace Vapi.Net; public record CallsListRequest { + /// + /// This is the unique identifier for the call. + /// + public string? Id { get; set; } + /// /// This will return calls with the specified assistantId. /// public string? AssistantId { get; set; } + /// + /// This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead. + /// + /// Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. + /// + public string? PhoneNumberId { get; set; } + /// /// This is the maximum number of items to return. Defaults to 100. /// diff --git a/src/Vapi.Net/Core/StringEnumSerializer.cs b/src/Vapi.Net/Core/EnumSerializer.cs similarity index 94% rename from src/Vapi.Net/Core/StringEnumSerializer.cs rename to src/Vapi.Net/Core/EnumSerializer.cs index abf741b..8999941 100644 --- a/src/Vapi.Net/Core/StringEnumSerializer.cs +++ b/src/Vapi.Net/Core/EnumSerializer.cs @@ -4,13 +4,13 @@ namespace Vapi.Net.Core; -internal class StringEnumSerializer : JsonConverter +internal class EnumSerializer : JsonConverter where TEnum : struct, System.Enum { private readonly Dictionary _enumToString = new(); private readonly Dictionary _stringToEnum = new(); - public StringEnumSerializer() + public EnumSerializer() { var type = typeof(TEnum); var values = Enum.GetValues(type); diff --git a/src/Vapi.Net/Core/IRequestOptions.cs b/src/Vapi.Net/Core/IRequestOptions.cs new file mode 100644 index 0000000..b2533ea --- /dev/null +++ b/src/Vapi.Net/Core/IRequestOptions.cs @@ -0,0 +1,34 @@ +using System; +using System.Net.Http; + +#nullable enable + +namespace Vapi.Net.Core; + +internal interface IRequestOptions +{ + /// + /// The Base URL for the API. + /// + public string? BaseUrl { get; init; } + + /// + /// The http client used to make requests. + /// + public HttpClient? HttpClient { get; init; } + + /// + /// The http headers sent with the request. + /// + internal Headers Headers { get; init; } + + /// + /// The http client used to make requests. + /// + public int? MaxRetries { get; init; } + + /// + /// The timeout for the request. + /// + public TimeSpan? Timeout { get; init; } +} diff --git a/src/Vapi.Net/Core/JsonConfiguration.cs b/src/Vapi.Net/Core/JsonConfiguration.cs index 36ed0b1..1a9742e 100644 --- a/src/Vapi.Net/Core/JsonConfiguration.cs +++ b/src/Vapi.Net/Core/JsonConfiguration.cs @@ -3,19 +3,23 @@ namespace Vapi.Net.Core; -internal static class JsonOptions +internal static partial class JsonOptions { public static readonly JsonSerializerOptions JsonSerializerOptions; static JsonOptions() { - JsonSerializerOptions = new JsonSerializerOptions + var options = new JsonSerializerOptions { Converters = { new DateTimeSerializer(), new OneOfSerializer() }, WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, }; + ConfigureJsonSerializerOptions(options); + JsonSerializerOptions = options; } + + static partial void ConfigureJsonSerializerOptions(JsonSerializerOptions defaultOptions); } internal static class JsonUtils diff --git a/src/Vapi.Net/Core/Page.cs b/src/Vapi.Net/Core/Page.cs new file mode 100644 index 0000000..173b43a --- /dev/null +++ b/src/Vapi.Net/Core/Page.cs @@ -0,0 +1,19 @@ +namespace Vapi.Net.Core; + +/// +/// A single of items from a request that may return +/// zero or more s of items. +/// +/// The type of items. +public class Page +{ + public Page(IReadOnlyList items) + { + Items = items; + } + + /// + /// Gets the items in this . + /// + public IReadOnlyList Items { get; } +} diff --git a/src/Vapi.Net/Core/Pager.cs b/src/Vapi.Net/Core/Pager.cs new file mode 100644 index 0000000..7efbf48 --- /dev/null +++ b/src/Vapi.Net/Core/Pager.cs @@ -0,0 +1,207 @@ +using System.Runtime.CompilerServices; + +namespace Vapi.Net.Core; + +/// +/// A collection of values that may take multiple service requests to +/// iterate over. +/// +/// The type of the values. +public abstract class Pager : IAsyncEnumerable +{ + /// + /// Enumerate the values a at a time. This may + /// make multiple service requests. + /// + /// + /// An async sequence of s. + /// + public abstract IAsyncEnumerable> AsPagesAsync( + CancellationToken cancellationToken = default + ); + + /// + /// Enumerate the values in the collection asynchronously. This may + /// make multiple service requests. + /// + /// + /// The used for requests made while + /// enumerating asynchronously. + /// + /// An async sequence of values. + public virtual async IAsyncEnumerator GetAsyncEnumerator( + CancellationToken cancellationToken = default + ) + { + await foreach (var page in AsPagesAsync(cancellationToken).ConfigureAwait(false)) + { + foreach (var value in page.Items) + { + yield return value; + } + } + } +} + +internal sealed class OffsetPager + : Pager +{ + private TRequest _request; + private readonly TRequestOptions? _options; + private readonly GetNextPage _getNextPage; + private readonly GetOffset _getOffset; + private readonly SetOffset _setOffset; + private readonly GetStep? _getStep; + private readonly GetItems _getItems; + private readonly HasNextPage? _hasNextPage; + + internal delegate Task GetNextPage( + TRequest request, + TRequestOptions? options, + CancellationToken cancellationToken + ); + + internal delegate TOffset GetOffset(TRequest request); + + internal delegate void SetOffset(TRequest request, TOffset offset); + + internal delegate TStep GetStep(TRequest request); + + internal delegate IReadOnlyList? GetItems(TResponse response); + + internal delegate bool? HasNextPage(TResponse response); + + internal OffsetPager( + TRequest request, + TRequestOptions? options, + GetNextPage getNextPage, + GetOffset getOffset, + SetOffset setOffset, + GetStep? getStep, + GetItems getItems, + HasNextPage? hasNextPage + ) + { + _request = request; + _options = options; + _getNextPage = getNextPage; + _getOffset = getOffset; + _setOffset = setOffset; + _getStep = getStep; + _getItems = getItems; + _hasNextPage = hasNextPage; + } + + public override async IAsyncEnumerable> AsPagesAsync( + [EnumeratorCancellation] CancellationToken cancellationToken = default + ) + { + var hasStep = false; + if (_getStep is not null) + { + hasStep = _getStep(_request) is not null; + } + var offset = _getOffset(_request); + var longOffset = Convert.ToInt64(offset); + bool hasNextPage; + do + { + var response = await _getNextPage(_request, _options, cancellationToken) + .ConfigureAwait(false); + var items = _getItems(response); + var itemCount = items?.Count ?? 0; + hasNextPage = _hasNextPage?.Invoke(response) ?? itemCount > 0; + if (items is not null) + { + yield return new Page(items); + } + + if (hasStep) + { + longOffset += items?.Count ?? 1; + } + else + { + longOffset++; + } + + _request ??= Activator.CreateInstance(); + switch (offset) + { + case int: + _setOffset(_request, (TOffset)(object)(int)longOffset); + break; + case long: + _setOffset(_request, (TOffset)(object)longOffset); + break; + default: + throw new InvalidOperationException("Offset must be int or long"); + } + } while (hasNextPage); + } +} + +internal sealed class CursorPager + : Pager +{ + private TRequest _request; + private readonly TRequestOptions? _options; + private readonly GetNextPage _getNextPage; + private readonly SetCursor _setCursor; + private readonly GetNextCursor _getNextCursor; + private readonly GetItems _getItems; + + internal delegate Task GetNextPage( + TRequest request, + TRequestOptions? options, + CancellationToken cancellationToken + ); + + internal delegate void SetCursor(TRequest request, TCursor cursor); + + internal delegate TCursor? GetNextCursor(TResponse response); + + internal delegate IReadOnlyList? GetItems(TResponse response); + + internal CursorPager( + TRequest request, + TRequestOptions? options, + GetNextPage getNextPage, + SetCursor setCursor, + GetNextCursor getNextCursor, + GetItems getItems + ) + { + _request = request; + _options = options; + _getNextPage = getNextPage; + _setCursor = setCursor; + _getNextCursor = getNextCursor; + _getItems = getItems; + } + + public override async IAsyncEnumerable> AsPagesAsync( + [EnumeratorCancellation] CancellationToken cancellationToken = default + ) + { + do + { + var response = await _getNextPage(_request, _options, cancellationToken) + .ConfigureAwait(false); + var items = _getItems(response); + var nextCursor = _getNextCursor(response); + if (items != null) + { + yield return new Page(items); + } + + if (nextCursor == null) + { + break; + } + + _request ??= Activator.CreateInstance(); + _setCursor(_request, nextCursor); + } while (true); + } +} diff --git a/src/Vapi.Net/Core/Public/ClientOptions.cs b/src/Vapi.Net/Core/Public/ClientOptions.cs index 231a04a..5128a50 100644 --- a/src/Vapi.Net/Core/Public/ClientOptions.cs +++ b/src/Vapi.Net/Core/Public/ClientOptions.cs @@ -32,4 +32,19 @@ public partial class ClientOptions /// The http headers sent with the request. /// internal Headers Headers { get; init; } = new(); + + /// + /// Clones this and returns a new instance + /// + internal ClientOptions Clone() + { + return new ClientOptions + { + BaseUrl = BaseUrl, + HttpClient = HttpClient, + MaxRetries = MaxRetries, + Timeout = Timeout, + Headers = new Headers(new Dictionary(Headers)), + }; + } } diff --git a/src/Vapi.Net/Core/Public/RequestOptions.cs b/src/Vapi.Net/Core/Public/RequestOptions.cs index a42eb92..0c5c8b9 100644 --- a/src/Vapi.Net/Core/Public/RequestOptions.cs +++ b/src/Vapi.Net/Core/Public/RequestOptions.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -public partial class RequestOptions +public partial class RequestOptions : IRequestOptions { /// /// The Base URL for the API. @@ -31,5 +31,5 @@ public partial class RequestOptions /// /// The http headers sent with the request. /// - internal Headers Headers { get; init; } = new(); + Headers IRequestOptions.Headers { get; init; } = new(); } diff --git a/src/Vapi.Net/Core/Public/Version.cs b/src/Vapi.Net/Core/Public/Version.cs index 339113b..d1b9021 100644 --- a/src/Vapi.Net/Core/Public/Version.cs +++ b/src/Vapi.Net/Core/Public/Version.cs @@ -2,5 +2,5 @@ namespace Vapi.Net; internal class Version { - public const string Current = "0.1.0"; + public const string Current = "0.2.0"; } diff --git a/src/Vapi.Net/Core/RawClient.cs b/src/Vapi.Net/Core/RawClient.cs index 1a793cf..8bfa0c0 100644 --- a/src/Vapi.Net/Core/RawClient.cs +++ b/src/Vapi.Net/Core/RawClient.cs @@ -1,4 +1,5 @@ using System.Net.Http; +using System.Net.Http.Headers; using System.Text; using System.Threading; @@ -47,7 +48,7 @@ public record BaseApiRequest public Headers Headers { get; init; } = new(); - public RequestOptions? Options { get; init; } + public IRequestOptions? Options { get; init; } } /// @@ -128,11 +129,14 @@ private HttpRequestMessage BuildHttpRequest(BaseApiRequest request) } if (request.ContentType != null) { - request.Headers.Add("Content-Type", request.ContentType); + httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse( + request.ContentType + ); } SetHeaders(httpRequest, Options.Headers); SetHeaders(httpRequest, request.Headers); SetHeaders(httpRequest, request.Options?.Headers ?? new Headers()); + return httpRequest; } diff --git a/src/Vapi.Net/Files/FilesClient.cs b/src/Vapi.Net/Files/FilesClient.cs index 8d6f8dd..cde9c50 100644 --- a/src/Vapi.Net/Files/FilesClient.cs +++ b/src/Vapi.Net/Files/FilesClient.cs @@ -205,6 +205,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"file/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/KnowledgeBases/KnowledgeBasesClient.cs b/src/Vapi.Net/KnowledgeBases/KnowledgeBasesClient.cs new file mode 100644 index 0000000..90f8aa7 --- /dev/null +++ b/src/Vapi.Net/KnowledgeBases/KnowledgeBasesClient.cs @@ -0,0 +1,265 @@ +using System.Net.Http; +using System.Text.Json; +using System.Threading; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public partial class KnowledgeBasesClient +{ + private RawClient _client; + + internal KnowledgeBasesClient(RawClient client) + { + _client = client; + } + + /// + /// + /// await client.KnowledgeBases.ListAsync(new KnowledgeBasesListRequest()); + /// + /// + public async Task> ListAsync( + KnowledgeBasesListRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _query = new Dictionary(); + if (request.Limit != null) + { + _query["limit"] = request.Limit.ToString(); + } + if (request.CreatedAtGt != null) + { + _query["createdAtGt"] = request.CreatedAtGt.Value.ToString(Constants.DateTimeFormat); + } + if (request.CreatedAtLt != null) + { + _query["createdAtLt"] = request.CreatedAtLt.Value.ToString(Constants.DateTimeFormat); + } + if (request.CreatedAtGe != null) + { + _query["createdAtGe"] = request.CreatedAtGe.Value.ToString(Constants.DateTimeFormat); + } + if (request.CreatedAtLe != null) + { + _query["createdAtLe"] = request.CreatedAtLe.Value.ToString(Constants.DateTimeFormat); + } + if (request.UpdatedAtGt != null) + { + _query["updatedAtGt"] = request.UpdatedAtGt.Value.ToString(Constants.DateTimeFormat); + } + if (request.UpdatedAtLt != null) + { + _query["updatedAtLt"] = request.UpdatedAtLt.Value.ToString(Constants.DateTimeFormat); + } + if (request.UpdatedAtGe != null) + { + _query["updatedAtGe"] = request.UpdatedAtGe.Value.ToString(Constants.DateTimeFormat); + } + if (request.UpdatedAtLe != null) + { + _query["updatedAtLe"] = request.UpdatedAtLe.Value.ToString(Constants.DateTimeFormat); + } + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + BaseUrl = _client.Options.BaseUrl, + Method = HttpMethod.Get, + Path = "knowledge-base", + Query = _query, + Options = options, + }, + cancellationToken + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + try + { + return JsonUtils.Deserialize>(responseBody)!; + } + catch (JsonException e) + { + throw new VapiClientException("Failed to deserialize response", e); + } + } + + throw new VapiClientApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + + /// + /// + /// await client.KnowledgeBases.CreateAsync( + /// new CreateCustomKnowledgeBaseDto { Server = new Server { Url = "url" } } + /// ); + /// + /// + public async Task CreateAsync( + object request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + BaseUrl = _client.Options.BaseUrl, + Method = HttpMethod.Post, + Path = "knowledge-base", + Body = request, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + try + { + return JsonUtils.Deserialize(responseBody)!; + } + catch (JsonException e) + { + throw new VapiClientException("Failed to deserialize response", e); + } + } + + throw new VapiClientApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + + /// + /// + /// await client.KnowledgeBases.GetAsync("id"); + /// + /// + public async Task GetAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + BaseUrl = _client.Options.BaseUrl, + Method = HttpMethod.Get, + Path = $"knowledge-base/{id}", + Options = options, + }, + cancellationToken + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + try + { + return JsonUtils.Deserialize(responseBody)!; + } + catch (JsonException e) + { + throw new VapiClientException("Failed to deserialize response", e); + } + } + + throw new VapiClientApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + + /// + /// + /// await client.KnowledgeBases.DeleteAsync("id"); + /// + /// + public async Task DeleteAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + BaseUrl = _client.Options.BaseUrl, + Method = HttpMethod.Delete, + Path = $"knowledge-base/{id}", + Options = options, + }, + cancellationToken + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + try + { + return JsonUtils.Deserialize(responseBody)!; + } + catch (JsonException e) + { + throw new VapiClientException("Failed to deserialize response", e); + } + } + + throw new VapiClientApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + + /// + /// + /// await client.KnowledgeBases.UpdateAsync("id"); + /// + /// + public async Task UpdateAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var response = await _client.MakeRequestAsync( + new RawClient.JsonApiRequest + { + BaseUrl = _client.Options.BaseUrl, + Method = HttpMethodExtensions.Patch, + Path = $"knowledge-base/{id}", + Options = options, + }, + cancellationToken + ); + var responseBody = await response.Raw.Content.ReadAsStringAsync(); + if (response.StatusCode is >= 200 and < 400) + { + try + { + return JsonUtils.Deserialize(responseBody)!; + } + catch (JsonException e) + { + throw new VapiClientException("Failed to deserialize response", e); + } + } + + throw new VapiClientApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } +} diff --git a/src/Vapi.Net/KnowledgeBases/Requests/KnowledgeBasesListRequest.cs b/src/Vapi.Net/KnowledgeBases/Requests/KnowledgeBasesListRequest.cs new file mode 100644 index 0000000..f41e669 --- /dev/null +++ b/src/Vapi.Net/KnowledgeBases/Requests/KnowledgeBasesListRequest.cs @@ -0,0 +1,58 @@ +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record KnowledgeBasesListRequest +{ + /// + /// This is the maximum number of items to return. Defaults to 100. + /// + public double? Limit { get; set; } + + /// + /// This will return items where the createdAt is greater than the specified value. + /// + public DateTime? CreatedAtGt { get; set; } + + /// + /// This will return items where the createdAt is less than the specified value. + /// + public DateTime? CreatedAtLt { get; set; } + + /// + /// This will return items where the createdAt is greater than or equal to the specified value. + /// + public DateTime? CreatedAtGe { get; set; } + + /// + /// This will return items where the createdAt is less than or equal to the specified value. + /// + public DateTime? CreatedAtLe { get; set; } + + /// + /// This will return items where the updatedAt is greater than the specified value. + /// + public DateTime? UpdatedAtGt { get; set; } + + /// + /// This will return items where the updatedAt is less than the specified value. + /// + public DateTime? UpdatedAtLt { get; set; } + + /// + /// This will return items where the updatedAt is greater than or equal to the specified value. + /// + public DateTime? UpdatedAtGe { get; set; } + + /// + /// This will return items where the updatedAt is less than or equal to the specified value. + /// + public DateTime? UpdatedAtLe { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Logs/LogsClient.cs b/src/Vapi.Net/Logs/LogsClient.cs index ba66c52..dbb89a2 100644 --- a/src/Vapi.Net/Logs/LogsClient.cs +++ b/src/Vapi.Net/Logs/LogsClient.cs @@ -21,7 +21,36 @@ internal LogsClient(RawClient client) /// await client.Logs.GetAsync(new LogsGetRequest()); /// /// - public async Task GetAsync( + public Pager GetAsync(LogsGetRequest request, RequestOptions? options = null) + { + if (request is not null) + { + request = request with { }; + } + var pager = new OffsetPager< + LogsGetRequest, + RequestOptions?, + LogsPaginatedResponse, + double?, + object, + Log + >( + request, + options, + GetAsync, + request => request?.Page ?? 0, + (request, offset) => + { + request.Page = offset; + }, + null, + response => response?.Results?.ToList(), + null + ); + return pager; + } + + internal async Task GetAsync( LogsGetRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default @@ -36,6 +65,10 @@ public async Task GetAsync( { _query["type"] = request.Type.Value.Stringify(); } + if (request.WebhookType != null) + { + _query["webhookType"] = request.WebhookType; + } if (request.AssistantId != null) { _query["assistantId"] = request.AssistantId; diff --git a/src/Vapi.Net/Logs/Requests/LogsGetRequest.cs b/src/Vapi.Net/Logs/Requests/LogsGetRequest.cs index 5e1cba2..8c5c0d0 100644 --- a/src/Vapi.Net/Logs/Requests/LogsGetRequest.cs +++ b/src/Vapi.Net/Logs/Requests/LogsGetRequest.cs @@ -16,6 +16,11 @@ public record LogsGetRequest /// public LogsGetRequestType? Type { get; set; } + /// + /// This is the type of the webhook, given the log is from a webhook. + /// + public string? WebhookType { get; set; } + /// /// This is the ID of the assistant. /// @@ -44,7 +49,7 @@ public record LogsGetRequest /// /// This is the page number to return. Defaults to 1. /// - public int? Page { get; set; } + public double? Page { get; set; } /// /// This is the sort order for pagination. Defaults to 'ASC'. diff --git a/src/Vapi.Net/Logs/Types/LogsGetRequestSortOrder.cs b/src/Vapi.Net/Logs/Types/LogsGetRequestSortOrder.cs index e002ddc..dfe101d 100644 --- a/src/Vapi.Net/Logs/Types/LogsGetRequestSortOrder.cs +++ b/src/Vapi.Net/Logs/Types/LogsGetRequestSortOrder.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum LogsGetRequestSortOrder { [EnumMember(Value = "ASC")] diff --git a/src/Vapi.Net/Logs/Types/LogsGetRequestType.cs b/src/Vapi.Net/Logs/Types/LogsGetRequestType.cs index 8455d54..9fe7dbe 100644 --- a/src/Vapi.Net/Logs/Types/LogsGetRequestType.cs +++ b/src/Vapi.Net/Logs/Types/LogsGetRequestType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum LogsGetRequestType { [EnumMember(Value = "API")] diff --git a/src/Vapi.Net/PhoneNumbers/PhoneNumbersClient.cs b/src/Vapi.Net/PhoneNumbers/PhoneNumbersClient.cs index bb46a84..307f68d 100644 --- a/src/Vapi.Net/PhoneNumbers/PhoneNumbersClient.cs +++ b/src/Vapi.Net/PhoneNumbers/PhoneNumbersClient.cs @@ -113,6 +113,7 @@ public async Task CreateAsync( Method = HttpMethod.Post, Path = "phone-number", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken @@ -238,6 +239,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"phone-number/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/PhoneNumbers/Requests/UpdatePhoneNumberDto.cs b/src/Vapi.Net/PhoneNumbers/Requests/UpdatePhoneNumberDto.cs index 24ec1de..ebe450f 100644 --- a/src/Vapi.Net/PhoneNumbers/Requests/UpdatePhoneNumberDto.cs +++ b/src/Vapi.Net/PhoneNumbers/Requests/UpdatePhoneNumberDto.cs @@ -45,7 +45,7 @@ public record UpdatePhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Squads/SquadsClient.cs b/src/Vapi.Net/Squads/SquadsClient.cs index def40d0..4abc663 100644 --- a/src/Vapi.Net/Squads/SquadsClient.cs +++ b/src/Vapi.Net/Squads/SquadsClient.cs @@ -98,7 +98,7 @@ public async Task> ListAsync( /// /// /// await client.Squads.CreateAsync( - /// new CreateSquadDto { Members = new List() { new SquadMemberDto() } } + /// new CreateSquadDto { Members = new List<SquadMemberDto>() { new SquadMemberDto() } } /// ); /// /// @@ -115,6 +115,7 @@ public async Task CreateAsync( Method = HttpMethod.Post, Path = "squad", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken @@ -225,7 +226,7 @@ public async Task DeleteAsync( /// /// await client.Squads.UpdateAsync( /// "id", - /// new UpdateSquadDto { Members = new List() { new SquadMemberDto() } } + /// new UpdateSquadDto { Members = new List<SquadMemberDto>() { new SquadMemberDto() } } /// ); /// /// @@ -243,6 +244,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"squad/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/Tools/ToolsClient.cs b/src/Vapi.Net/Tools/ToolsClient.cs index 152274d..04ba3e6 100644 --- a/src/Vapi.Net/Tools/ToolsClient.cs +++ b/src/Vapi.Net/Tools/ToolsClient.cs @@ -97,7 +97,14 @@ public async Task> ListAsync( /// /// - /// await client.Tools.CreateAsync(new CreateOutputToolDto { Async = false }); + /// await client.Tools.CreateAsync( + /// new CreateTextEditorToolDto + /// { + /// Async = false, + /// SubType = "text_editor_20241022", + /// Name = "str_replace_editor", + /// } + /// ); /// /// public async Task CreateAsync( @@ -113,6 +120,7 @@ public async Task CreateAsync( Method = HttpMethod.Post, Path = "tool", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken @@ -238,6 +246,7 @@ public async Task UpdateAsync( Method = HttpMethodExtensions.Patch, Path = $"tool/{id}", Body = request, + ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Vapi.Net/Types/AnalysisCostAnalysisType.cs b/src/Vapi.Net/Types/AnalysisCostAnalysisType.cs index 216ae05..ba749b6 100644 --- a/src/Vapi.Net/Types/AnalysisCostAnalysisType.cs +++ b/src/Vapi.Net/Types/AnalysisCostAnalysisType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AnalysisCostAnalysisType { [EnumMember(Value = "summary")] diff --git a/src/Vapi.Net/Types/AnalyticsOperationColumn.cs b/src/Vapi.Net/Types/AnalyticsOperationColumn.cs index 334ce7a..a6db02c 100644 --- a/src/Vapi.Net/Types/AnalyticsOperationColumn.cs +++ b/src/Vapi.Net/Types/AnalyticsOperationColumn.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AnalyticsOperationColumn { [EnumMember(Value = "id")] diff --git a/src/Vapi.Net/Types/AnalyticsOperationOperation.cs b/src/Vapi.Net/Types/AnalyticsOperationOperation.cs index cb6ab8b..cd8b3bc 100644 --- a/src/Vapi.Net/Types/AnalyticsOperationOperation.cs +++ b/src/Vapi.Net/Types/AnalyticsOperationOperation.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AnalyticsOperationOperation { [EnumMember(Value = "sum")] diff --git a/src/Vapi.Net/Analytics/Requests/AnalyticsQueryDto.cs b/src/Vapi.Net/Types/AnalyticsQueryDto.cs similarity index 100% rename from src/Vapi.Net/Analytics/Requests/AnalyticsQueryDto.cs rename to src/Vapi.Net/Types/AnalyticsQueryDto.cs diff --git a/src/Vapi.Net/Types/AnalyticsQueryGroupByItem.cs b/src/Vapi.Net/Types/AnalyticsQueryGroupByItem.cs index acab3a1..2537f45 100644 --- a/src/Vapi.Net/Types/AnalyticsQueryGroupByItem.cs +++ b/src/Vapi.Net/Types/AnalyticsQueryGroupByItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AnalyticsQueryGroupByItem { [EnumMember(Value = "type")] diff --git a/src/Vapi.Net/Types/AnalyticsQueryResult.cs b/src/Vapi.Net/Types/AnalyticsQueryResult.cs index 80a2b46..ef9fa09 100644 --- a/src/Vapi.Net/Types/AnalyticsQueryResult.cs +++ b/src/Vapi.Net/Types/AnalyticsQueryResult.cs @@ -24,9 +24,9 @@ public record AnalyticsQueryResult /// /// Example: /// "result": [ - /// { "date": "2023-01-01", "assistantId": "123", "endedReason": "customer-ended-call", "sumDuration": 120, "avgCost": 10.5 }, - /// { "date": "2023-01-02", "assistantId": "123", "endedReason": "customer-did-not-give-microphone-permission", "sumDuration": 0, "avgCost": 0 }, - /// // Additional results + /// { "date": "2023-01-01", "assistantId": "123", "endedReason": "customer-ended-call", "sumDuration": 120, "avgCost": 10.5 }, + /// { "date": "2023-01-02", "assistantId": "123", "endedReason": "customer-did-not-give-microphone-permission", "sumDuration": 0, "avgCost": 0 }, + /// // Additional results /// ] /// [JsonPropertyName("result")] diff --git a/src/Vapi.Net/Types/AnthropicCredential.cs b/src/Vapi.Net/Types/AnthropicCredential.cs index d355534..1896e01 100644 --- a/src/Vapi.Net/Types/AnthropicCredential.cs +++ b/src/Vapi.Net/Types/AnthropicCredential.cs @@ -40,6 +40,12 @@ public record AnthropicCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/AnthropicModel.cs b/src/Vapi.Net/Types/AnthropicModel.cs index a075b36..9da8e62 100644 --- a/src/Vapi.Net/Types/AnthropicModel.cs +++ b/src/Vapi.Net/Types/AnthropicModel.cs @@ -29,6 +29,18 @@ public record AnthropicModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the Anthropic/Claude models that will be used. /// @@ -41,12 +53,6 @@ public record AnthropicModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/AnthropicModelModel.cs b/src/Vapi.Net/Types/AnthropicModelModel.cs index 79023d8..2780d95 100644 --- a/src/Vapi.Net/Types/AnthropicModelModel.cs +++ b/src/Vapi.Net/Types/AnthropicModelModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AnthropicModelModel { [EnumMember(Value = "claude-3-opus-20240229")] @@ -20,4 +20,10 @@ public enum AnthropicModelModel [EnumMember(Value = "claude-3-5-sonnet-20240620")] Claude35Sonnet20240620, + + [EnumMember(Value = "claude-3-5-sonnet-20241022")] + Claude35Sonnet20241022, + + [EnumMember(Value = "claude-3-5-haiku-20241022")] + Claude35Haiku20241022, } diff --git a/src/Vapi.Net/Types/AnyscaleCredential.cs b/src/Vapi.Net/Types/AnyscaleCredential.cs index 576e6ab..367b870 100644 --- a/src/Vapi.Net/Types/AnyscaleCredential.cs +++ b/src/Vapi.Net/Types/AnyscaleCredential.cs @@ -40,6 +40,12 @@ public record AnyscaleCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/AnyscaleModel.cs b/src/Vapi.Net/Types/AnyscaleModel.cs index c1b208e..52ee5d8 100644 --- a/src/Vapi.Net/Types/AnyscaleModel.cs +++ b/src/Vapi.Net/Types/AnyscaleModel.cs @@ -29,6 +29,18 @@ public record AnyscaleModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b /// @@ -41,12 +53,6 @@ public record AnyscaleModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/ArtifactPlan.cs b/src/Vapi.Net/Types/ArtifactPlan.cs index 6a39589..0370ea6 100644 --- a/src/Vapi.Net/Types/ArtifactPlan.cs +++ b/src/Vapi.Net/Types/ArtifactPlan.cs @@ -11,7 +11,6 @@ public record ArtifactPlan /// This determines whether assistant's calls are recorded. Defaults to true. /// /// Usage: - /// /// - If you don't want to record the calls, set this to false. /// - If you want to record the calls when `assistant.hipaaEnabled`, explicity set this to true and make sure to provide S3 or GCP credentials on the Provider Credentials page in the Dashboard. /// @@ -44,7 +43,6 @@ public record ArtifactPlan /// If credential.s3PathPrefix or credential.bucketPlan.path is set, this will append to it. /// /// Usage: - /// /// - If you want to upload the recording to a specific path, set this to the path. Example: `/my-assistant-recordings`. /// - If you want to upload the recording to the root of the bucket, set this to `/`. /// diff --git a/src/Vapi.Net/Types/AssemblyAiCredential.cs b/src/Vapi.Net/Types/AssemblyAiCredential.cs new file mode 100644 index 0000000..9e623eb --- /dev/null +++ b/src/Vapi.Net/Types/AssemblyAiCredential.cs @@ -0,0 +1,53 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record AssemblyAiCredential +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/AssemblyAiTranscriber.cs b/src/Vapi.Net/Types/AssemblyAiTranscriber.cs new file mode 100644 index 0000000..0499f42 --- /dev/null +++ b/src/Vapi.Net/Types/AssemblyAiTranscriber.cs @@ -0,0 +1,45 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record AssemblyAiTranscriber +{ + /// + /// This is the language that will be set for the transcription. + /// + [JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// The WebSocket URL that the transcriber connects to. + /// + [JsonPropertyName("realtimeUrl")] + public string? RealtimeUrl { get; set; } + + /// + /// Add up to 2500 characters of custom vocabulary. + /// + [JsonPropertyName("wordBoost")] + public IEnumerable? WordBoost { get; set; } + + /// + /// The duration of the end utterance silence threshold in milliseconds. + /// + [JsonPropertyName("endUtteranceSilenceThreshold")] + public double? EndUtteranceSilenceThreshold { get; set; } + + /// + /// Disable partial transcripts. + /// Set to `true` to not receive partial transcripts. Defaults to `false`. + /// + [JsonPropertyName("disablePartialTranscripts")] + public bool? DisablePartialTranscripts { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/AssignmentMutation.cs b/src/Vapi.Net/Types/AssignmentMutation.cs index d346602..289ca28 100644 --- a/src/Vapi.Net/Types/AssignmentMutation.cs +++ b/src/Vapi.Net/Types/AssignmentMutation.cs @@ -23,26 +23,21 @@ public record AssignmentMutation /// This is the variable to assign a new value to. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "output.your-property-name" for current step's output /// - "your-step-name.output.your-property-name" for another step's output (in the same workflow; read caveat #1) /// - "your-block-name.output.your-property-name" for another block's output (in the same workflow; read caveat #2) /// - "global.your-property-name" for the global context /// /// This needs to be the key path of the variable. If you use {{}}, it'll dereference that to the value of the variable before assignment. This can be useful if the path is dynamic. Example: - /// /// - "global.{{my-tool-call-step.output.my-key-name}}" /// /// You can also string interpolate multiple variables to get the key name: - /// /// - "global.{{my-tool-call-step.output.my-key-name-suffix}}-{{my-tool-call-step.output.my-key-name}}" /// /// The path to the new variable is created if it doesn't exist. Example: - /// /// - "global.this-does-not-exist.neither-does-this" will create `this-does-not-exist` object with `neither-does-this` as a key /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow. /// @@ -53,25 +48,21 @@ public record AssignmentMutation /// The value to assign to the variable. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "{{output.your-property-name}}" for current step's output /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) /// - "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2) /// - "{{global.your-property-name}}" for the global context /// /// Or, you can use a constant: - /// /// - "1" /// - "text" /// - "true" /// - "false" /// /// Or, you can mix and match with string interpolation: - /// /// - "{{your-property-name}}-{{input.your-property-name-2}}-1" /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow. /// diff --git a/src/Vapi.Net/Types/Assistant.cs b/src/Vapi.Net/Types/Assistant.cs index 3df5917..a7e7642 100644 --- a/src/Vapi.Net/Types/Assistant.cs +++ b/src/Vapi.Net/Types/Assistant.cs @@ -25,11 +25,18 @@ public record Assistant [JsonPropertyName("voice")] public object? Voice { get; set; } + /// + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + /// + [JsonPropertyName("firstMessage")] + public string? FirstMessage { get; set; } + /// /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// /// Use: - /// /// - 'assistant-speaks-first' to have the assistant speak first. /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). @@ -46,7 +53,7 @@ public record Assistant public bool? HipaaEnabled { get; set; } /// - /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. /// [JsonPropertyName("clientMessages")] public IEnumerable? ClientMessages { get; set; } @@ -79,16 +86,6 @@ public record Assistant [JsonPropertyName("backgroundSound")] public AssistantBackgroundSound? BackgroundSound { get; set; } - /// - /// This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. - /// - /// Default `false` while in beta. - /// - /// @default false - /// - [JsonPropertyName("backchannelingEnabled")] - public bool? BackchannelingEnabled { get; set; } - /// /// This enables filtering of noise and background speech while the user is talking. /// @@ -123,14 +120,6 @@ public record Assistant [JsonPropertyName("name")] public string? Name { get; set; } - /// - /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). - /// - /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. - /// - [JsonPropertyName("firstMessage")] - public string? FirstMessage { get; set; } - /// /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. /// This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. @@ -167,24 +156,6 @@ public record Assistant [JsonPropertyName("metadata")] public object? Metadata { get; set; } - /// - /// This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. - /// - /// All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation. - /// - /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl - /// - [JsonPropertyName("serverUrl")] - public string? ServerUrl { get; set; } - - /// - /// This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. - /// - /// Same precedence logic as serverUrl. - /// - [JsonPropertyName("serverUrlSecret")] - public string? ServerUrlSecret { get; set; } - /// /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. /// @@ -211,7 +182,6 @@ public record Assistant /// This is the plan for when the assistant should start talking. /// /// You should configure this if you're running into these issues: - /// /// - The assistant is too slow to start talking after the customer is done speaking. /// - The assistant is too fast to start talking after the customer is done speaking. /// - The assistant is so fast that it's actually interrupting the customer. @@ -223,7 +193,6 @@ public record Assistant /// This is the plan for when assistant should stop talking on customer interruption. /// /// You should configure this if you're running into these issues: - /// /// - The assistant is too slow to recognize customer's interruption. /// - The assistant is too fast to recognize customer's interruption. /// - The assistant is getting interrupted by phrases that are just acknowledgments. @@ -237,7 +206,6 @@ public record Assistant /// This is the plan for real-time monitoring of the assistant's calls. /// /// Usage: - /// /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. /// @@ -252,6 +220,18 @@ public record Assistant [JsonPropertyName("credentialIds")] public IEnumerable? CredentialIds { get; set; } + /// + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + /// /// This is the unique identifier for the assistant. /// diff --git a/src/Vapi.Net/Types/AssistantBackgroundSound.cs b/src/Vapi.Net/Types/AssistantBackgroundSound.cs index 1f40be8..01e42a6 100644 --- a/src/Vapi.Net/Types/AssistantBackgroundSound.cs +++ b/src/Vapi.Net/Types/AssistantBackgroundSound.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantBackgroundSound { [EnumMember(Value = "off")] diff --git a/src/Vapi.Net/Types/AssistantClientMessagesItem.cs b/src/Vapi.Net/Types/AssistantClientMessagesItem.cs index 1250436..72d525c 100644 --- a/src/Vapi.Net/Types/AssistantClientMessagesItem.cs +++ b/src/Vapi.Net/Types/AssistantClientMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantClientMessagesItem { [EnumMember(Value = "conversation-update")] @@ -45,6 +45,9 @@ public enum AssistantClientMessagesItem [EnumMember(Value = "tool-calls-result")] ToolCallsResult, + [EnumMember(Value = "transfer-update")] + TransferUpdate, + [EnumMember(Value = "user-interrupted")] UserInterrupted, diff --git a/src/Vapi.Net/Types/AssistantCustomEndpointingRule.cs b/src/Vapi.Net/Types/AssistantCustomEndpointingRule.cs new file mode 100644 index 0000000..d3b7dde --- /dev/null +++ b/src/Vapi.Net/Types/AssistantCustomEndpointingRule.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record AssistantCustomEndpointingRule +{ + /// + /// This is the regex pattern to match. + /// + /// Note: + /// - This works by using the `RegExp.test` method in Node.JS. Eg. `/hello/.test("hello there")` will return `true`. + /// + /// Hot tip: + /// - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + /// - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will return `true`. To do full string matching, send "^cat$". + /// + [JsonPropertyName("regex")] + public required string Regex { get; set; } + + /// + /// These are the options for the regex match. Defaults to all disabled. + /// + /// @default [] + /// + [JsonPropertyName("regexOptions")] + public IEnumerable? RegexOptions { get; set; } + + /// + /// This is the endpointing timeout in seconds, if the rule is matched. + /// + [JsonPropertyName("timeoutSeconds")] + public required double TimeoutSeconds { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/AssistantFirstMessageMode.cs b/src/Vapi.Net/Types/AssistantFirstMessageMode.cs index 73f1c64..d0b4dc0 100644 --- a/src/Vapi.Net/Types/AssistantFirstMessageMode.cs +++ b/src/Vapi.Net/Types/AssistantFirstMessageMode.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantFirstMessageMode { [EnumMember(Value = "assistant-speaks-first")] diff --git a/src/Vapi.Net/Types/AssistantOverrides.cs b/src/Vapi.Net/Types/AssistantOverrides.cs index 683d5f5..bb5189a 100644 --- a/src/Vapi.Net/Types/AssistantOverrides.cs +++ b/src/Vapi.Net/Types/AssistantOverrides.cs @@ -25,11 +25,18 @@ public record AssistantOverrides [JsonPropertyName("voice")] public object? Voice { get; set; } + /// + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + /// + [JsonPropertyName("firstMessage")] + public string? FirstMessage { get; set; } + /// /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// /// Use: - /// /// - 'assistant-speaks-first' to have the assistant speak first. /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). @@ -46,7 +53,7 @@ public record AssistantOverrides public bool? HipaaEnabled { get; set; } /// - /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. /// [JsonPropertyName("clientMessages")] public IEnumerable? ClientMessages { get; set; } @@ -79,16 +86,6 @@ public record AssistantOverrides [JsonPropertyName("backgroundSound")] public AssistantOverridesBackgroundSound? BackgroundSound { get; set; } - /// - /// This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. - /// - /// Default `false` while in beta. - /// - /// @default false - /// - [JsonPropertyName("backchannelingEnabled")] - public bool? BackchannelingEnabled { get; set; } - /// /// This enables filtering of noise and background speech while the user is talking. /// @@ -117,6 +114,12 @@ public record AssistantOverrides /// /// These are values that will be used to replace the template variables in the assistant messages and other text-based fields. + /// This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html + /// + /// So for example, `{{ name }}` will be replaced with the value of `name` in `variableValues`. + /// `{{"now" | date: "%b %d, %Y, %I:%M %p", "America/New_York"}}` will be replaced with the current date and time in New York. + /// Some VAPI reserved defaults: + /// - *customer* - the customer object /// [JsonPropertyName("variableValues")] public object? VariableValues { get; set; } @@ -129,14 +132,6 @@ public record AssistantOverrides [JsonPropertyName("name")] public string? Name { get; set; } - /// - /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). - /// - /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. - /// - [JsonPropertyName("firstMessage")] - public string? FirstMessage { get; set; } - /// /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. /// This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. @@ -173,24 +168,6 @@ public record AssistantOverrides [JsonPropertyName("metadata")] public object? Metadata { get; set; } - /// - /// This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. - /// - /// All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation. - /// - /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl - /// - [JsonPropertyName("serverUrl")] - public string? ServerUrl { get; set; } - - /// - /// This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. - /// - /// Same precedence logic as serverUrl. - /// - [JsonPropertyName("serverUrlSecret")] - public string? ServerUrlSecret { get; set; } - /// /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. /// @@ -217,7 +194,6 @@ public record AssistantOverrides /// This is the plan for when the assistant should start talking. /// /// You should configure this if you're running into these issues: - /// /// - The assistant is too slow to start talking after the customer is done speaking. /// - The assistant is too fast to start talking after the customer is done speaking. /// - The assistant is so fast that it's actually interrupting the customer. @@ -229,7 +205,6 @@ public record AssistantOverrides /// This is the plan for when assistant should stop talking on customer interruption. /// /// You should configure this if you're running into these issues: - /// /// - The assistant is too slow to recognize customer's interruption. /// - The assistant is too fast to recognize customer's interruption. /// - The assistant is getting interrupted by phrases that are just acknowledgments. @@ -243,7 +218,6 @@ public record AssistantOverrides /// This is the plan for real-time monitoring of the assistant's calls. /// /// Usage: - /// /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. /// @@ -258,6 +232,18 @@ public record AssistantOverrides [JsonPropertyName("credentialIds")] public IEnumerable? CredentialIds { get; set; } + /// + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/AssistantOverridesBackgroundSound.cs b/src/Vapi.Net/Types/AssistantOverridesBackgroundSound.cs index 549aae6..ac91665 100644 --- a/src/Vapi.Net/Types/AssistantOverridesBackgroundSound.cs +++ b/src/Vapi.Net/Types/AssistantOverridesBackgroundSound.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantOverridesBackgroundSound { [EnumMember(Value = "off")] diff --git a/src/Vapi.Net/Types/AssistantOverridesClientMessagesItem.cs b/src/Vapi.Net/Types/AssistantOverridesClientMessagesItem.cs index 5526a4d..527c078 100644 --- a/src/Vapi.Net/Types/AssistantOverridesClientMessagesItem.cs +++ b/src/Vapi.Net/Types/AssistantOverridesClientMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantOverridesClientMessagesItem { [EnumMember(Value = "conversation-update")] @@ -45,6 +45,9 @@ public enum AssistantOverridesClientMessagesItem [EnumMember(Value = "tool-calls-result")] ToolCallsResult, + [EnumMember(Value = "transfer-update")] + TransferUpdate, + [EnumMember(Value = "user-interrupted")] UserInterrupted, diff --git a/src/Vapi.Net/Types/AssistantOverridesFirstMessageMode.cs b/src/Vapi.Net/Types/AssistantOverridesFirstMessageMode.cs index 242b110..fff7789 100644 --- a/src/Vapi.Net/Types/AssistantOverridesFirstMessageMode.cs +++ b/src/Vapi.Net/Types/AssistantOverridesFirstMessageMode.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantOverridesFirstMessageMode { [EnumMember(Value = "assistant-speaks-first")] diff --git a/src/Vapi.Net/Types/AssistantOverridesServerMessagesItem.cs b/src/Vapi.Net/Types/AssistantOverridesServerMessagesItem.cs index c1a634c..c1e0d55 100644 --- a/src/Vapi.Net/Types/AssistantOverridesServerMessagesItem.cs +++ b/src/Vapi.Net/Types/AssistantOverridesServerMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantOverridesServerMessagesItem { [EnumMember(Value = "conversation-update")] @@ -24,6 +24,9 @@ public enum AssistantOverridesServerMessagesItem [EnumMember(Value = "language-changed")] LanguageChanged, + [EnumMember(Value = "language-change-detected")] + LanguageChangeDetected, + [EnumMember(Value = "model-output")] ModelOutput, diff --git a/src/Vapi.Net/Types/AssistantServerMessagesItem.cs b/src/Vapi.Net/Types/AssistantServerMessagesItem.cs index f01eb04..addc34c 100644 --- a/src/Vapi.Net/Types/AssistantServerMessagesItem.cs +++ b/src/Vapi.Net/Types/AssistantServerMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AssistantServerMessagesItem { [EnumMember(Value = "conversation-update")] @@ -24,6 +24,9 @@ public enum AssistantServerMessagesItem [EnumMember(Value = "language-changed")] LanguageChanged, + [EnumMember(Value = "language-change-detected")] + LanguageChangeDetected, + [EnumMember(Value = "model-output")] ModelOutput, diff --git a/src/Vapi.Net/Types/AutoReloadPlan.cs b/src/Vapi.Net/Types/AutoReloadPlan.cs new file mode 100644 index 0000000..d33235f --- /dev/null +++ b/src/Vapi.Net/Types/AutoReloadPlan.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record AutoReloadPlan +{ + /// + /// This the amount of credits to reload. + /// + [JsonPropertyName("credits")] + public required double Credits { get; set; } + + /// + /// This is the limit at which the reload is triggered. + /// + [JsonPropertyName("threshold")] + public required double Threshold { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/AutoReloadPlanDto.cs b/src/Vapi.Net/Types/AutoReloadPlanDto.cs new file mode 100644 index 0000000..59a782b --- /dev/null +++ b/src/Vapi.Net/Types/AutoReloadPlanDto.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record AutoReloadPlanDto +{ + /// + /// This is the auto reload plan to be configured for the subscription. + /// It can be null if no auto reload plan is set. + /// + [JsonPropertyName("autoReloadPlan")] + public AutoReloadPlan? AutoReloadPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/AzureCredential.cs b/src/Vapi.Net/Types/AzureCredential.cs new file mode 100644 index 0000000..cce9f48 --- /dev/null +++ b/src/Vapi.Net/Types/AzureCredential.cs @@ -0,0 +1,65 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record AzureCredential +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is the service being used in Azure. + /// + [JsonPropertyName("service")] + public required string Service { get; set; } + + /// + /// This is the region of the Azure resource. + /// + [JsonPropertyName("region")] + public AzureCredentialRegion? Region { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public string? ApiKey { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/AzureCredentialRegion.cs b/src/Vapi.Net/Types/AzureCredentialRegion.cs new file mode 100644 index 0000000..13945a3 --- /dev/null +++ b/src/Vapi.Net/Types/AzureCredentialRegion.cs @@ -0,0 +1,59 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum AzureCredentialRegion +{ + [EnumMember(Value = "australia")] + Australia, + + [EnumMember(Value = "canada")] + Canada, + + [EnumMember(Value = "eastus2")] + Eastus2, + + [EnumMember(Value = "eastus")] + Eastus, + + [EnumMember(Value = "france")] + France, + + [EnumMember(Value = "india")] + India, + + [EnumMember(Value = "japan")] + Japan, + + [EnumMember(Value = "uaenorth")] + Uaenorth, + + [EnumMember(Value = "northcentralus")] + Northcentralus, + + [EnumMember(Value = "norway")] + Norway, + + [EnumMember(Value = "southcentralus")] + Southcentralus, + + [EnumMember(Value = "sweden")] + Sweden, + + [EnumMember(Value = "switzerland")] + Switzerland, + + [EnumMember(Value = "uk")] + Uk, + + [EnumMember(Value = "westus")] + Westus, + + [EnumMember(Value = "westus3")] + Westus3, +} diff --git a/src/Vapi.Net/Types/AzureOpenAiCredential.cs b/src/Vapi.Net/Types/AzureOpenAiCredential.cs index d1c241d..aee9526 100644 --- a/src/Vapi.Net/Types/AzureOpenAiCredential.cs +++ b/src/Vapi.Net/Types/AzureOpenAiCredential.cs @@ -47,6 +47,12 @@ public record AzureOpenAiCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + [JsonPropertyName("openAIEndpoint")] public required string OpenAiEndpoint { get; set; } diff --git a/src/Vapi.Net/Types/AzureOpenAiCredentialModelsItem.cs b/src/Vapi.Net/Types/AzureOpenAiCredentialModelsItem.cs index b7ff2cb..7227f3f 100644 --- a/src/Vapi.Net/Types/AzureOpenAiCredentialModelsItem.cs +++ b/src/Vapi.Net/Types/AzureOpenAiCredentialModelsItem.cs @@ -6,9 +6,12 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AzureOpenAiCredentialModelsItem { + [EnumMember(Value = "gpt-4o-2024-08-06")] + Gpt4O20240806, + [EnumMember(Value = "gpt-4o-mini-2024-07-18")] Gpt4OMini20240718, diff --git a/src/Vapi.Net/Types/AzureOpenAiCredentialRegion.cs b/src/Vapi.Net/Types/AzureOpenAiCredentialRegion.cs index e56e7d3..0a6672b 100644 --- a/src/Vapi.Net/Types/AzureOpenAiCredentialRegion.cs +++ b/src/Vapi.Net/Types/AzureOpenAiCredentialRegion.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AzureOpenAiCredentialRegion { [EnumMember(Value = "australia")] @@ -30,6 +30,9 @@ public enum AzureOpenAiCredentialRegion [EnumMember(Value = "japan")] Japan, + [EnumMember(Value = "uaenorth")] + Uaenorth, + [EnumMember(Value = "northcentralus")] Northcentralus, diff --git a/src/Vapi.Net/Types/AzureVoice.cs b/src/Vapi.Net/Types/AzureVoice.cs index a2d9422..e41169a 100644 --- a/src/Vapi.Net/Types/AzureVoice.cs +++ b/src/Vapi.Net/Types/AzureVoice.cs @@ -8,20 +8,18 @@ namespace Vapi.Net; public record AzureVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. /// [JsonPropertyName("voiceId")] public required OneOf VoiceId { get; set; } + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + /// /// This is the speed multiplier that will be used. /// @@ -29,10 +27,10 @@ public record AzureVoice public double? Speed { get; set; } /// - /// This is the plan for chunking the model output before it is sent to the voice provider. + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. /// - [JsonPropertyName("chunkPlan")] - public ChunkPlan? ChunkPlan { get; set; } + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } public override string ToString() { diff --git a/src/Vapi.Net/Types/AzureVoiceIdEnum.cs b/src/Vapi.Net/Types/AzureVoiceIdEnum.cs index e546d35..a5bbfda 100644 --- a/src/Vapi.Net/Types/AzureVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/AzureVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum AzureVoiceIdEnum { [EnumMember(Value = "andrew")] diff --git a/src/Vapi.Net/Types/BashTool.cs b/src/Vapi.Net/Types/BashTool.cs new file mode 100644 index 0000000..a0df113 --- /dev/null +++ b/src/Vapi.Net/Types/BashTool.cs @@ -0,0 +1,90 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record BashTool +{ + /// + /// This determines if the tool is async. + /// + /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + /// + /// If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + /// + /// Defaults to synchronous (`false`). + /// + [JsonPropertyName("async")] + public bool? Async { get; set; } + + /// + /// These are the messages that will be spoken to the user as the tool is running. + /// + /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// The sub type of tool. + /// + [JsonPropertyName("subType")] + public required string SubType { get; set; } + + /// + /// This is the unique identifier for the tool. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the organization that this tool belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the tool was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the tool was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the function definition of the tool. + /// + /// For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + /// + /// An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + /// + [JsonPropertyName("function")] + public OpenAiFunction? Function { get; set; } + + /// + /// This is the server that will be hit when this tool is requested by the model. + /// + /// All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + /// + /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + + /// + /// The name of the tool, fixed to 'bash' + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/BlockCompleteMessage.cs b/src/Vapi.Net/Types/BlockCompleteMessage.cs index 90b94b9..38facd8 100644 --- a/src/Vapi.Net/Types/BlockCompleteMessage.cs +++ b/src/Vapi.Net/Types/BlockCompleteMessage.cs @@ -7,6 +7,18 @@ namespace Vapi.Net; public record BlockCompleteMessage { + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + /// /// This is an optional array of conditions that must be met for this message to be triggered. /// @@ -17,7 +29,7 @@ public record BlockCompleteMessage /// This is the content that the assistant will say when this message is triggered. /// [JsonPropertyName("content")] - public required string Content { get; set; } + public string? Content { get; set; } public override string ToString() { diff --git a/src/Vapi.Net/Types/BlockStartMessage.cs b/src/Vapi.Net/Types/BlockStartMessage.cs index e0eea2e..f76ad94 100644 --- a/src/Vapi.Net/Types/BlockStartMessage.cs +++ b/src/Vapi.Net/Types/BlockStartMessage.cs @@ -7,6 +7,18 @@ namespace Vapi.Net; public record BlockStartMessage { + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + /// /// This is an optional array of conditions that must be met for this message to be triggered. /// @@ -17,7 +29,7 @@ public record BlockStartMessage /// This is the content that the assistant will say when this message is triggered. /// [JsonPropertyName("content")] - public required string Content { get; set; } + public string? Content { get; set; } public override string ToString() { diff --git a/src/Vapi.Net/Types/BothCustomEndpointingRule.cs b/src/Vapi.Net/Types/BothCustomEndpointingRule.cs new file mode 100644 index 0000000..6843c7d --- /dev/null +++ b/src/Vapi.Net/Types/BothCustomEndpointingRule.cs @@ -0,0 +1,52 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record BothCustomEndpointingRule +{ + /// + /// This is the regex pattern to match the assistant's message. + /// + /// Note: + /// - This works by using the `RegExp.test` method in Node.JS. Eg. `/hello/.test("hello there")` will return `true`. + /// + /// Hot tip: + /// - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + /// - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will return `true`. To do full string matching, send "^cat$". + /// + [JsonPropertyName("assistantRegex")] + public required string AssistantRegex { get; set; } + + /// + /// These are the options for the assistant's message regex match. Defaults to all disabled. + /// + /// @default [] + /// + [JsonPropertyName("assistantRegexOptions")] + public IEnumerable? AssistantRegexOptions { get; set; } + + [JsonPropertyName("customerRegex")] + public required string CustomerRegex { get; set; } + + /// + /// These are the options for the customer's message regex match. Defaults to all disabled. + /// + /// @default [] + /// + [JsonPropertyName("customerRegexOptions")] + public IEnumerable? CustomerRegexOptions { get; set; } + + /// + /// This is the endpointing timeout in seconds, if the rule is matched. + /// + [JsonPropertyName("timeoutSeconds")] + public required double TimeoutSeconds { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/BucketPlan.cs b/src/Vapi.Net/Types/BucketPlan.cs index 4af8589..dda5821 100644 --- a/src/Vapi.Net/Types/BucketPlan.cs +++ b/src/Vapi.Net/Types/BucketPlan.cs @@ -17,7 +17,6 @@ public record BucketPlan /// This is the region of the bucket. /// /// Usage: - /// /// - If `credential.type` is `aws`, then this is required. /// - If `credential.type` is `gcp`, then this is optional since GCP allows buckets to be accessed without a region but region is required for data residency requirements. Read here: https://cloud.google.com/storage/docs/request-endpoints /// @@ -28,7 +27,6 @@ public record BucketPlan /// This is the path where call artifacts will be stored. /// /// Usage: - /// /// - To store call artifacts in a specific folder, set this to the full path. Eg. "/folder-name1/folder-name2". /// - To store call artifacts in the root of the bucket, leave this blank. /// @@ -41,7 +39,6 @@ public record BucketPlan /// This is the HMAC access key offered by GCP for interoperability with S3 clients. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console /// /// Usage: - /// /// - If `credential.type` is `gcp`, then this is required. /// - If `credential.type` is `aws`, then this is not required since credential.awsAccessKeyId is used instead. /// @@ -52,7 +49,6 @@ public record BucketPlan /// This is the secret for the HMAC access key. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console /// /// Usage: - /// /// - If `credential.type` is `gcp`, then this is required. /// - If `credential.type` is `aws`, then this is not required since credential.awsSecretAccessKey is used instead. /// diff --git a/src/Vapi.Net/Types/BuyPhoneNumberDto.cs b/src/Vapi.Net/Types/BuyPhoneNumberDto.cs index 512e8e0..c2ed782 100644 --- a/src/Vapi.Net/Types/BuyPhoneNumberDto.cs +++ b/src/Vapi.Net/Types/BuyPhoneNumberDto.cs @@ -9,7 +9,6 @@ public record BuyPhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -52,7 +51,7 @@ public record BuyPhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/ByoPhoneNumber.cs b/src/Vapi.Net/Types/ByoPhoneNumber.cs index bee7bfe..a285c09 100644 --- a/src/Vapi.Net/Types/ByoPhoneNumber.cs +++ b/src/Vapi.Net/Types/ByoPhoneNumber.cs @@ -9,7 +9,6 @@ public record ByoPhoneNumber { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -23,7 +22,6 @@ public record ByoPhoneNumber /// This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it. /// /// Use cases: - /// /// - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks. /// - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls. /// @@ -85,7 +83,7 @@ public record ByoPhoneNumber /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/ByoSipTrunkCredential.cs b/src/Vapi.Net/Types/ByoSipTrunkCredential.cs index cc4a202..21303c9 100644 --- a/src/Vapi.Net/Types/ByoSipTrunkCredential.cs +++ b/src/Vapi.Net/Types/ByoSipTrunkCredential.cs @@ -38,16 +38,16 @@ public record ByoSipTrunkCredential public required DateTime UpdatedAt { get; set; } /// - /// This is the list of SIP trunk's gateways. + /// This is the name of credential. This is just for your reference. /// - [JsonPropertyName("gateways")] - public IEnumerable Gateways { get; set; } = new List(); + [JsonPropertyName("name")] + public string? Name { get; set; } /// - /// This is the name of the SIP trunk. This is just for your reference. + /// This is the list of SIP trunk's gateways. /// - [JsonPropertyName("name")] - public string? Name { get; set; } + [JsonPropertyName("gateways")] + public IEnumerable Gateways { get; set; } = new List(); /// /// This can be used to configure the outbound authentication if required by the SIP trunk. @@ -59,7 +59,6 @@ public record ByoSipTrunkCredential /// This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. /// /// Usage: - /// /// - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. /// /// @default false @@ -67,6 +66,18 @@ public record ByoSipTrunkCredential [JsonPropertyName("outboundLeadingPlusEnabled")] public bool? OutboundLeadingPlusEnabled { get; set; } + /// + /// This can be used to configure the tech prefix on outbound calls. This is an advanced property. + /// + [JsonPropertyName("techPrefix")] + public string? TechPrefix { get; set; } + + /// + /// This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property. + /// + [JsonPropertyName("sipDiversionHeader")] + public string? SipDiversionHeader { get; set; } + /// /// This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC provided by Vapi. /// diff --git a/src/Vapi.Net/Types/Call.cs b/src/Vapi.Net/Types/Call.cs index eb5b8bb..4276c14 100644 --- a/src/Vapi.Net/Types/Call.cs +++ b/src/Vapi.Net/Types/Call.cs @@ -131,6 +131,12 @@ public IEnumerable< [JsonPropertyName("artifact")] public Artifact? Artifact { get; set; } + /// + /// This is the transport used for the call. + /// + [JsonPropertyName("transport")] + public Transport? Transport { get; set; } + /// /// The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage. /// diff --git a/src/Vapi.Net/Types/CallEndedReason.cs b/src/Vapi.Net/Types/CallEndedReason.cs index 397a91d..9c68407 100644 --- a/src/Vapi.Net/Types/CallEndedReason.cs +++ b/src/Vapi.Net/Types/CallEndedReason.cs @@ -6,69 +6,18 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CallEndedReason { - [EnumMember(Value = "assistant-error")] - AssistantError, - - [EnumMember(Value = "assistant-not-found")] - AssistantNotFound, - - [EnumMember(Value = "db-error")] - DbError, - - [EnumMember(Value = "no-server-available")] - NoServerAvailable, - - [EnumMember(Value = "license-check-failed")] - LicenseCheckFailed, - - [EnumMember(Value = "pipeline-error-openai-llm-failed")] - PipelineErrorOpenaiLlmFailed, - - [EnumMember(Value = "pipeline-error-azure-openai-llm-failed")] - PipelineErrorAzureOpenaiLlmFailed, - - [EnumMember(Value = "pipeline-error-groq-llm-failed")] - PipelineErrorGroqLlmFailed, - - [EnumMember(Value = "pipeline-error-anthropic-llm-failed")] - PipelineErrorAnthropicLlmFailed, - - [EnumMember(Value = "pipeline-error-vapi-llm-failed")] - PipelineErrorVapiLlmFailed, - - [EnumMember(Value = "pipeline-error-vapi-400-bad-request-validation-failed")] - PipelineErrorVapi400BadRequestValidationFailed, - - [EnumMember(Value = "pipeline-error-vapi-401-unauthorized")] - PipelineErrorVapi401Unauthorized, - - [EnumMember(Value = "pipeline-error-vapi-403-model-access-denied")] - PipelineErrorVapi403ModelAccessDenied, - - [EnumMember(Value = "pipeline-error-vapi-429-exceeded-quota")] - PipelineErrorVapi429ExceededQuota, - - [EnumMember(Value = "pipeline-error-vapi-500-server-error")] - PipelineErrorVapi500ServerError, - [EnumMember(Value = "pipeline-error-openai-voice-failed")] PipelineErrorOpenaiVoiceFailed, [EnumMember(Value = "pipeline-error-cartesia-voice-failed")] PipelineErrorCartesiaVoiceFailed, - [EnumMember(Value = "pipeline-error-deepgram-transcriber-failed")] - PipelineErrorDeepgramTranscriberFailed, - [EnumMember(Value = "pipeline-error-deepgram-voice-failed")] PipelineErrorDeepgramVoiceFailed, - [EnumMember(Value = "pipeline-error-gladia-transcriber-failed")] - PipelineErrorGladiaTranscriberFailed, - [EnumMember(Value = "pipeline-error-eleven-labs-voice-failed")] PipelineErrorElevenLabsVoiceFailed, @@ -87,6 +36,33 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-neets-voice-failed")] PipelineErrorNeetsVoiceFailed, + [EnumMember(Value = "db-error")] + DbError, + + [EnumMember(Value = "assistant-not-found")] + AssistantNotFound, + + [EnumMember(Value = "license-check-failed")] + LicenseCheckFailed, + + [EnumMember(Value = "pipeline-error-vapi-llm-failed")] + PipelineErrorVapiLlmFailed, + + [EnumMember(Value = "pipeline-error-vapi-400-bad-request-validation-failed")] + PipelineErrorVapi400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-vapi-401-unauthorized")] + PipelineErrorVapi401Unauthorized, + + [EnumMember(Value = "pipeline-error-vapi-403-model-access-denied")] + PipelineErrorVapi403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-vapi-429-exceeded-quota")] + PipelineErrorVapi429ExceededQuota, + + [EnumMember(Value = "pipeline-error-vapi-500-server-error")] + PipelineErrorVapi500ServerError, + [EnumMember(Value = "pipeline-no-available-model")] PipelineNoAvailableModel, @@ -123,6 +99,36 @@ public enum CallEndedReason [EnumMember(Value = "vapifault-transport-connected-but-call-not-active")] VapifaultTransportConnectedButCallNotActive, + [EnumMember(Value = "vapifault-call-started-but-connection-to-transport-missing")] + VapifaultCallStartedButConnectionToTransportMissing, + + [EnumMember(Value = "pipeline-error-deepgram-transcriber-failed")] + PipelineErrorDeepgramTranscriberFailed, + + [EnumMember(Value = "pipeline-error-gladia-transcriber-failed")] + PipelineErrorGladiaTranscriberFailed, + + [EnumMember(Value = "pipeline-error-assembly-ai-transcriber-failed")] + PipelineErrorAssemblyAiTranscriberFailed, + + [EnumMember(Value = "pipeline-error-openai-llm-failed")] + PipelineErrorOpenaiLlmFailed, + + [EnumMember(Value = "pipeline-error-azure-openai-llm-failed")] + PipelineErrorAzureOpenaiLlmFailed, + + [EnumMember(Value = "pipeline-error-groq-llm-failed")] + PipelineErrorGroqLlmFailed, + + [EnumMember(Value = "pipeline-error-google-llm-failed")] + PipelineErrorGoogleLlmFailed, + + [EnumMember(Value = "pipeline-error-xai-llm-failed")] + PipelineErrorXaiLlmFailed, + + [EnumMember(Value = "pipeline-error-inflection-ai-llm-failed")] + PipelineErrorInflectionAiLlmFailed, + [EnumMember(Value = "assistant-not-invalid")] AssistantNotInvalid, @@ -201,6 +207,51 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-openai-500-server-error")] PipelineErrorOpenai500ServerError, + [EnumMember(Value = "pipeline-error-google-400-bad-request-validation-failed")] + PipelineErrorGoogle400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-google-401-unauthorized")] + PipelineErrorGoogle401Unauthorized, + + [EnumMember(Value = "pipeline-error-google-403-model-access-denied")] + PipelineErrorGoogle403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-google-429-exceeded-quota")] + PipelineErrorGoogle429ExceededQuota, + + [EnumMember(Value = "pipeline-error-google-500-server-error")] + PipelineErrorGoogle500ServerError, + + [EnumMember(Value = "pipeline-error-xai-400-bad-request-validation-failed")] + PipelineErrorXai400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-xai-401-unauthorized")] + PipelineErrorXai401Unauthorized, + + [EnumMember(Value = "pipeline-error-xai-403-model-access-denied")] + PipelineErrorXai403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-xai-429-exceeded-quota")] + PipelineErrorXai429ExceededQuota, + + [EnumMember(Value = "pipeline-error-xai-500-server-error")] + PipelineErrorXai500ServerError, + + [EnumMember(Value = "pipeline-error-inflection-ai-400-bad-request-validation-failed")] + PipelineErrorInflectionAi400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-inflection-ai-401-unauthorized")] + PipelineErrorInflectionAi401Unauthorized, + + [EnumMember(Value = "pipeline-error-inflection-ai-403-model-access-denied")] + PipelineErrorInflectionAi403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-inflection-ai-429-exceeded-quota")] + PipelineErrorInflectionAi429ExceededQuota, + + [EnumMember(Value = "pipeline-error-inflection-ai-500-server-error")] + PipelineErrorInflectionAi500ServerError, + [EnumMember(Value = "pipeline-error-azure-openai-400-bad-request-validation-failed")] PipelineErrorAzureOpenai400BadRequestValidationFailed, @@ -246,6 +297,9 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-anthropic-500-server-error")] PipelineErrorAnthropic500ServerError, + [EnumMember(Value = "pipeline-error-anthropic-llm-failed")] + PipelineErrorAnthropicLlmFailed, + [EnumMember(Value = "pipeline-error-together-ai-400-bad-request-validation-failed")] PipelineErrorTogetherAi400BadRequestValidationFailed, @@ -372,6 +426,9 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-custom-llm-llm-failed")] PipelineErrorCustomLlmLlmFailed, + [EnumMember(Value = "pipeline-error-custom-voice-failed")] + PipelineErrorCustomVoiceFailed, + [EnumMember(Value = "pipeline-error-cartesia-socket-hang-up")] PipelineErrorCartesiaSocketHangUp, @@ -387,9 +444,6 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-cartesia-522-server-error")] PipelineErrorCartesia522ServerError, - [EnumMember(Value = "pipeline-error-custom-voice-failed")] - PipelineErrorCustomVoiceFailed, - [EnumMember(Value = "pipeline-error-eleven-labs-voice-not-found")] PipelineErrorElevenLabsVoiceNotFound, @@ -454,6 +508,11 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-eleven-labs-max-character-limit-exceeded")] PipelineErrorElevenLabsMaxCharacterLimitExceeded, + [EnumMember( + Value = "pipeline-error-eleven-labs-blocked-voice-potentially-against-terms-of-service-and-awaiting-verification" + )] + PipelineErrorElevenLabsBlockedVoicePotentiallyAgainstTermsOfServiceAndAwaitingVerification, + [EnumMember(Value = "pipeline-error-playht-request-timed-out")] PipelineErrorPlayhtRequestTimedOut, @@ -466,6 +525,9 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-playht-out-of-credits")] PipelineErrorPlayhtOutOfCredits, + [EnumMember(Value = "pipeline-error-playht-invalid-emotion")] + PipelineErrorPlayhtInvalidEmotion, + [EnumMember(Value = "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri")] PipelineErrorPlayhtVoiceMustBeAValidVoiceManifestUri, @@ -487,33 +549,50 @@ public enum CallEndedReason [EnumMember(Value = "pipeline-error-playht-504-gateway-error")] PipelineErrorPlayht504GatewayError, - [EnumMember(Value = "pipeline-error-deepgram-403-model-access-denied")] - PipelineErrorDeepgram403ModelAccessDenied, + [EnumMember(Value = "pipeline-error-deepgram-returning-403-model-access-denied")] + PipelineErrorDeepgramReturning403ModelAccessDenied, - [EnumMember(Value = "pipeline-error-deepgram-404-not-found")] - PipelineErrorDeepgram404NotFound, + [EnumMember(Value = "pipeline-error-deepgram-returning-401-invalid-credentials")] + PipelineErrorDeepgramReturning401InvalidCredentials, - [EnumMember(Value = "pipeline-error-deepgram-400-no-such-model-language-tier-combination")] - PipelineErrorDeepgram400NoSuchModelLanguageTierCombination, + [EnumMember(Value = "pipeline-error-deepgram-returning-404-not-found")] + PipelineErrorDeepgramReturning404NotFound, - [EnumMember(Value = "pipeline-error-deepgram-500-returning-invalid-json")] - PipelineErrorDeepgram500ReturningInvalidJson, + [EnumMember( + Value = "pipeline-error-deepgram-returning-400-no-such-model-language-tier-combination" + )] + PipelineErrorDeepgramReturning400NoSuchModelLanguageTierCombination, - [EnumMember(Value = "sip-gateway-failed-to-connect-call")] - SipGatewayFailedToConnectCall, + [EnumMember(Value = "pipeline-error-deepgram-returning-500-invalid-json")] + PipelineErrorDeepgramReturning500InvalidJson, + + [EnumMember(Value = "pipeline-error-deepgram-returning-502-network-error")] + PipelineErrorDeepgramReturning502NetworkError, + + [EnumMember(Value = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach")] + PipelineErrorDeepgramReturning502BadGatewayEhostunreach, + + [EnumMember(Value = "pipeline-error-tavus-video-failed")] + PipelineErrorTavusVideoFailed, + + [EnumMember(Value = "pipeline-error-custom-transcriber-failed")] + PipelineErrorCustomTranscriberFailed, [EnumMember(Value = "silence-timed-out")] SilenceTimedOut, + [EnumMember(Value = "sip-gateway-failed-to-connect-call")] + SipGatewayFailedToConnectCall, + [EnumMember(Value = "twilio-failed-to-connect-call")] TwilioFailedToConnectCall, [EnumMember(Value = "twilio-reported-customer-misdialed")] TwilioReportedCustomerMisdialed, - [EnumMember(Value = "voicemail")] - Voicemail, - [EnumMember(Value = "vonage-rejected")] VonageRejected, + + [EnumMember(Value = "voicemail")] + Voicemail, } diff --git a/src/Vapi.Net/Types/CallLogPrivileged.cs b/src/Vapi.Net/Types/CallLogPrivileged.cs new file mode 100644 index 0000000..85c1cb8 --- /dev/null +++ b/src/Vapi.Net/Types/CallLogPrivileged.cs @@ -0,0 +1,44 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CallLogPrivileged +{ + /// + /// This is the unique identifier for the call. + /// + [JsonPropertyName("callId")] + public required string CallId { get; set; } + + /// + /// This is the unique identifier for the org that this call log belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the log message associated with the call. + /// + [JsonPropertyName("log")] + public required string Log { get; set; } + + /// + /// This is the level of the log message. + /// + [JsonPropertyName("level")] + public required CallLogPrivilegedLevel Level { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the log was created. + /// + [JsonPropertyName("time")] + public required DateTime Time { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CallLogPrivilegedLevel.cs b/src/Vapi.Net/Types/CallLogPrivilegedLevel.cs new file mode 100644 index 0000000..094f1c6 --- /dev/null +++ b/src/Vapi.Net/Types/CallLogPrivilegedLevel.cs @@ -0,0 +1,26 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum CallLogPrivilegedLevel +{ + [EnumMember(Value = "INFO")] + Info, + + [EnumMember(Value = "LOG")] + Log, + + [EnumMember(Value = "WARN")] + Warn, + + [EnumMember(Value = "ERROR")] + Error, + + [EnumMember(Value = "CHECKPOINT")] + Checkpoint, +} diff --git a/src/Vapi.Net/Types/CallLogsPaginatedResponse.cs b/src/Vapi.Net/Types/CallLogsPaginatedResponse.cs new file mode 100644 index 0000000..a5357ed --- /dev/null +++ b/src/Vapi.Net/Types/CallLogsPaginatedResponse.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CallLogsPaginatedResponse +{ + [JsonPropertyName("results")] + public IEnumerable Results { get; set; } = new List(); + + [JsonPropertyName("metadata")] + public required PaginationMeta Metadata { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CallPhoneCallProvider.cs b/src/Vapi.Net/Types/CallPhoneCallProvider.cs index 5c2a6b7..b029efb 100644 --- a/src/Vapi.Net/Types/CallPhoneCallProvider.cs +++ b/src/Vapi.Net/Types/CallPhoneCallProvider.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CallPhoneCallProvider { [EnumMember(Value = "twilio")] diff --git a/src/Vapi.Net/Types/CallPhoneCallTransport.cs b/src/Vapi.Net/Types/CallPhoneCallTransport.cs index 019fde1..b2b1f9f 100644 --- a/src/Vapi.Net/Types/CallPhoneCallTransport.cs +++ b/src/Vapi.Net/Types/CallPhoneCallTransport.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CallPhoneCallTransport { [EnumMember(Value = "sip")] diff --git a/src/Vapi.Net/Types/CallStatus.cs b/src/Vapi.Net/Types/CallStatus.cs index d01abfa..834e964 100644 --- a/src/Vapi.Net/Types/CallStatus.cs +++ b/src/Vapi.Net/Types/CallStatus.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CallStatus { [EnumMember(Value = "queued")] diff --git a/src/Vapi.Net/Types/CallType.cs b/src/Vapi.Net/Types/CallType.cs index b59c478..e0ab5aa 100644 --- a/src/Vapi.Net/Types/CallType.cs +++ b/src/Vapi.Net/Types/CallType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CallType { [EnumMember(Value = "inboundPhoneCall")] diff --git a/src/Vapi.Net/Types/CallbackStep.cs b/src/Vapi.Net/Types/CallbackStep.cs index 2961a01..15c19dc 100644 --- a/src/Vapi.Net/Types/CallbackStep.cs +++ b/src/Vapi.Net/Types/CallbackStep.cs @@ -36,12 +36,11 @@ public record CallbackStep /// /// Example: /// { - /// "name": "John Doe", - /// "age": 20 + /// "name": "John Doe", + /// "age": 20 /// } /// /// You can reference any variable in the context of the current block: - /// /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) /// - "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1) /// - "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2) @@ -51,35 +50,34 @@ public record CallbackStep /// /// Example: /// { - /// "name": "{{my-tool-call-step.output.name}}", - /// "age": "{{my-tool-call-step.input.age}}", - /// "date": "{{workflow.input.date}}" + /// "name": "{{my-tool-call-step.output.name}}", + /// "age": "{{my-tool-call-step.input.age}}", + /// "date": "{{workflow.input.date}}" /// } /// /// You can dynamically change the key name. /// /// Example: /// { - /// "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", - /// "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", - /// "{{workflow.input.key-name-for-date}}": "{{date}}" + /// "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", + /// "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", + /// "{{workflow.input.key-name-for-date}}": "{{date}}" /// } /// /// You can represent the value as a string, number, boolean, array, or object. /// /// Example: /// { - /// "name": "john", - /// "age": 20, - /// "date": "2021-01-01", - /// "metadata": { - /// "unique-key": "{{my-tool-call-step.output.unique-key}}" - /// }, - /// "array": ["A", "B", "C"], + /// "name": "john", + /// "age": 20, + /// "date": "2021-01-01", + /// "metadata": { + /// "unique-key": "{{my-tool-call-step.output.unique-key}}" + /// }, + /// "array": ["A", "B", "C"], /// } /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow. /// diff --git a/src/Vapi.Net/Types/CartesiaCredential.cs b/src/Vapi.Net/Types/CartesiaCredential.cs index fd86cb2..813920c 100644 --- a/src/Vapi.Net/Types/CartesiaCredential.cs +++ b/src/Vapi.Net/Types/CartesiaCredential.cs @@ -40,6 +40,12 @@ public record CartesiaCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CartesiaVoice.cs b/src/Vapi.Net/Types/CartesiaVoice.cs index 7260ef5..6ea4d15 100644 --- a/src/Vapi.Net/Types/CartesiaVoice.cs +++ b/src/Vapi.Net/Types/CartesiaVoice.cs @@ -7,14 +7,6 @@ namespace Vapi.Net; public record CartesiaVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the model that will be used. This is optional and will default to the correct model for the voiceId. /// @@ -27,6 +19,12 @@ public record CartesiaVoice [JsonPropertyName("language")] public CartesiaVoiceLanguage? Language { get; set; } + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + /// /// This is the provider-specific ID that will be used. /// @@ -34,10 +32,10 @@ public record CartesiaVoice public required string VoiceId { get; set; } /// - /// This is the plan for chunking the model output before it is sent to the voice provider. + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. /// - [JsonPropertyName("chunkPlan")] - public ChunkPlan? ChunkPlan { get; set; } + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } public override string ToString() { diff --git a/src/Vapi.Net/Types/CartesiaVoiceLanguage.cs b/src/Vapi.Net/Types/CartesiaVoiceLanguage.cs index 4242736..dd88801 100644 --- a/src/Vapi.Net/Types/CartesiaVoiceLanguage.cs +++ b/src/Vapi.Net/Types/CartesiaVoiceLanguage.cs @@ -6,15 +6,15 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CartesiaVoiceLanguage { - [EnumMember(Value = "de")] - De, - [EnumMember(Value = "en")] En, + [EnumMember(Value = "de")] + De, + [EnumMember(Value = "es")] Es, @@ -29,4 +29,28 @@ public enum CartesiaVoiceLanguage [EnumMember(Value = "zh")] Zh, + + [EnumMember(Value = "hi")] + Hi, + + [EnumMember(Value = "it")] + It, + + [EnumMember(Value = "ko")] + Ko, + + [EnumMember(Value = "nl")] + Nl, + + [EnumMember(Value = "pl")] + Pl, + + [EnumMember(Value = "ru")] + Ru, + + [EnumMember(Value = "sv")] + Sv, + + [EnumMember(Value = "tr")] + Tr, } diff --git a/src/Vapi.Net/Types/CartesiaVoiceModel.cs b/src/Vapi.Net/Types/CartesiaVoiceModel.cs index fb0cbcc..6194128 100644 --- a/src/Vapi.Net/Types/CartesiaVoiceModel.cs +++ b/src/Vapi.Net/Types/CartesiaVoiceModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CartesiaVoiceModel { [EnumMember(Value = "sonic-english")] diff --git a/src/Vapi.Net/Types/ChunkPlan.cs b/src/Vapi.Net/Types/ChunkPlan.cs index dea65a1..9ab589f 100644 --- a/src/Vapi.Net/Types/ChunkPlan.cs +++ b/src/Vapi.Net/Types/ChunkPlan.cs @@ -11,11 +11,10 @@ public record ChunkPlan /// This determines whether the model output is chunked before being sent to the voice provider. Default `true`. /// /// Usage: - /// /// - To rely on the voice provider's audio generation logic, set this to `false`. /// - If seeing issues with quality, set this to `true`. /// - /// If disabled, Vapi-provided audio control tokens like will not work. + /// If disabled, Vapi-provided audio control tokens like <flush /> will not work. /// /// @default true /// @@ -26,7 +25,6 @@ public record ChunkPlan /// This is the minimum number of characters in a chunk. /// /// Usage: - /// /// - To increase quality, set this to a higher value. /// - To decrease latency, set this to a lower value. /// @@ -39,7 +37,6 @@ public record ChunkPlan /// These are the punctuations that are considered valid boundaries for a chunk to be created. /// /// Usage: - /// /// - To increase quality, constrain to fewer boundaries. /// - To decrease latency, enable all. /// diff --git a/src/Vapi.Net/Types/ClientInboundMessageAddMessage.cs b/src/Vapi.Net/Types/ClientInboundMessageAddMessage.cs index 392a41c..4befe4c 100644 --- a/src/Vapi.Net/Types/ClientInboundMessageAddMessage.cs +++ b/src/Vapi.Net/Types/ClientInboundMessageAddMessage.cs @@ -13,6 +13,18 @@ public record ClientInboundMessageAddMessage [JsonPropertyName("message")] public required OpenAiMessage Message { get; set; } + /// + /// This is the flag to trigger a response, or to insert the message into the conversation history silently. Defaults to `true`. + /// + /// Usage: + /// - Use `true` to trigger a response. + /// - Use `false` to insert the message into the conversation history silently. + /// + /// @default true + /// + [JsonPropertyName("triggerResponseEnabled")] + public bool? TriggerResponseEnabled { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/ClientInboundMessageControlControl.cs b/src/Vapi.Net/Types/ClientInboundMessageControlControl.cs index e56d3cb..e490f92 100644 --- a/src/Vapi.Net/Types/ClientInboundMessageControlControl.cs +++ b/src/Vapi.Net/Types/ClientInboundMessageControlControl.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ClientInboundMessageControlControl { [EnumMember(Value = "mute-assistant")] diff --git a/src/Vapi.Net/Types/ClientInboundMessageTransfer.cs b/src/Vapi.Net/Types/ClientInboundMessageTransfer.cs new file mode 100644 index 0000000..f2dc24b --- /dev/null +++ b/src/Vapi.Net/Types/ClientInboundMessageTransfer.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record ClientInboundMessageTransfer +{ + /// + /// This is the destination to transfer the call to. + /// + [JsonPropertyName("destination")] + public object? Destination { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/ClientMessageLanguageChanged.cs b/src/Vapi.Net/Types/ClientMessageLanguageChangeDetected.cs similarity index 88% rename from src/Vapi.Net/Types/ClientMessageLanguageChanged.cs rename to src/Vapi.Net/Types/ClientMessageLanguageChangeDetected.cs index a954c3f..7d7e00b 100644 --- a/src/Vapi.Net/Types/ClientMessageLanguageChanged.cs +++ b/src/Vapi.Net/Types/ClientMessageLanguageChangeDetected.cs @@ -5,7 +5,7 @@ namespace Vapi.Net; -public record ClientMessageLanguageChanged +public record ClientMessageLanguageChangeDetected { /// /// This is the language the transcriber is switched to. diff --git a/src/Vapi.Net/Types/ClientMessageSpeechUpdateRole.cs b/src/Vapi.Net/Types/ClientMessageSpeechUpdateRole.cs index 4462567..481321f 100644 --- a/src/Vapi.Net/Types/ClientMessageSpeechUpdateRole.cs +++ b/src/Vapi.Net/Types/ClientMessageSpeechUpdateRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ClientMessageSpeechUpdateRole { [EnumMember(Value = "assistant")] diff --git a/src/Vapi.Net/Types/ClientMessageSpeechUpdateStatus.cs b/src/Vapi.Net/Types/ClientMessageSpeechUpdateStatus.cs index 39584ff..ec7a94d 100644 --- a/src/Vapi.Net/Types/ClientMessageSpeechUpdateStatus.cs +++ b/src/Vapi.Net/Types/ClientMessageSpeechUpdateStatus.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ClientMessageSpeechUpdateStatus { [EnumMember(Value = "started")] diff --git a/src/Vapi.Net/Types/ClientMessageToolCalls.cs b/src/Vapi.Net/Types/ClientMessageToolCalls.cs index 7d00c8f..8594000 100644 --- a/src/Vapi.Net/Types/ClientMessageToolCalls.cs +++ b/src/Vapi.Net/Types/ClientMessageToolCalls.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using OneOf; using Vapi.Net.Core; #nullable enable @@ -11,7 +12,26 @@ public record ClientMessageToolCalls /// This is the list of tools calls that the model is requesting along with the original tool configuration. /// [JsonPropertyName("toolWithToolCallList")] - public IEnumerable ToolWithToolCallList { get; set; } = new List(); + public IEnumerable< + OneOf< + FunctionToolWithToolCall, + GhlToolWithToolCall, + MakeToolWithToolCall, + object, + object, + object + > + > ToolWithToolCallList { get; set; } = + new List< + OneOf< + FunctionToolWithToolCall, + GhlToolWithToolCall, + MakeToolWithToolCall, + object, + object, + object + > + >(); /// /// This is the list of tool calls that the model is requesting. diff --git a/src/Vapi.Net/Types/ClientMessageTranscriptRole.cs b/src/Vapi.Net/Types/ClientMessageTranscriptRole.cs index 98b4018..e5495e1 100644 --- a/src/Vapi.Net/Types/ClientMessageTranscriptRole.cs +++ b/src/Vapi.Net/Types/ClientMessageTranscriptRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ClientMessageTranscriptRole { [EnumMember(Value = "assistant")] diff --git a/src/Vapi.Net/Types/ClientMessageTranscriptTranscriptType.cs b/src/Vapi.Net/Types/ClientMessageTranscriptTranscriptType.cs index 7089a27..05629e9 100644 --- a/src/Vapi.Net/Types/ClientMessageTranscriptTranscriptType.cs +++ b/src/Vapi.Net/Types/ClientMessageTranscriptTranscriptType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ClientMessageTranscriptTranscriptType { [EnumMember(Value = "partial")] diff --git a/src/Vapi.Net/Types/ClientMessageTransferUpdate.cs b/src/Vapi.Net/Types/ClientMessageTransferUpdate.cs new file mode 100644 index 0000000..a3ccf09 --- /dev/null +++ b/src/Vapi.Net/Types/ClientMessageTransferUpdate.cs @@ -0,0 +1,44 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record ClientMessageTransferUpdate +{ + /// + /// This is the destination of the transfer. + /// + [JsonPropertyName("destination")] + public object? Destination { get; set; } + + /// + /// This is the assistant that the call is being transferred to. This is only sent if `destination.type` is "assistant". + /// + [JsonPropertyName("toAssistant")] + public CreateAssistantDto? ToAssistant { get; set; } + + /// + /// This is the assistant that the call is being transferred from. This is only sent if `destination.type` is "assistant". + /// + [JsonPropertyName("fromAssistant")] + public CreateAssistantDto? FromAssistant { get; set; } + + /// + /// This is the step that the conversation moved to. + /// + [JsonPropertyName("toStepRecord")] + public object? ToStepRecord { get; set; } + + /// + /// This is the step that the conversation moved from. = + /// + [JsonPropertyName("fromStepRecord")] + public object? FromStepRecord { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/ComputerTool.cs b/src/Vapi.Net/Types/ComputerTool.cs new file mode 100644 index 0000000..595cab1 --- /dev/null +++ b/src/Vapi.Net/Types/ComputerTool.cs @@ -0,0 +1,108 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record ComputerTool +{ + /// + /// This determines if the tool is async. + /// + /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + /// + /// If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + /// + /// Defaults to synchronous (`false`). + /// + [JsonPropertyName("async")] + public bool? Async { get; set; } + + /// + /// These are the messages that will be spoken to the user as the tool is running. + /// + /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// The sub type of tool. + /// + [JsonPropertyName("subType")] + public required string SubType { get; set; } + + /// + /// This is the unique identifier for the tool. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the organization that this tool belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the tool was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the tool was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the function definition of the tool. + /// + /// For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + /// + /// An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + /// + [JsonPropertyName("function")] + public OpenAiFunction? Function { get; set; } + + /// + /// This is the server that will be hit when this tool is requested by the model. + /// + /// All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + /// + /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + + /// + /// The name of the tool, fixed to 'computer' + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// The display width in pixels + /// + [JsonPropertyName("displayWidthPx")] + public required double DisplayWidthPx { get; set; } + + /// + /// The display height in pixels + /// + [JsonPropertyName("displayHeightPx")] + public required double DisplayHeightPx { get; set; } + + /// + /// Optional display number + /// + [JsonPropertyName("displayNumber")] + public double? DisplayNumber { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/Condition.cs b/src/Vapi.Net/Types/Condition.cs index af25232..f79df8f 100644 --- a/src/Vapi.Net/Types/Condition.cs +++ b/src/Vapi.Net/Types/Condition.cs @@ -7,12 +7,6 @@ namespace Vapi.Net; public record Condition { - /// - /// This is the value you want to compare against the parameter. - /// - [JsonPropertyName("value")] - public required string Value { get; set; } - /// /// This is the operator you want to use to compare the parameter and value. /// @@ -25,6 +19,12 @@ public record Condition [JsonPropertyName("param")] public required string Param { get; set; } + /// + /// This is the value you want to compare against the parameter. + /// + [JsonPropertyName("value")] + public object Value { get; set; } = new Dictionary(); + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/ConditionOperator.cs b/src/Vapi.Net/Types/ConditionOperator.cs index ee59ae8..e9ff0b4 100644 --- a/src/Vapi.Net/Types/ConditionOperator.cs +++ b/src/Vapi.Net/Types/ConditionOperator.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ConditionOperator { [EnumMember(Value = "eq")] diff --git a/src/Vapi.Net/Types/ConversationBlock.cs b/src/Vapi.Net/Types/ConversationBlock.cs index 8762ddf..e5b735f 100644 --- a/src/Vapi.Net/Types/ConversationBlock.cs +++ b/src/Vapi.Net/Types/ConversationBlock.cs @@ -17,7 +17,6 @@ public record ConversationBlock /// This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input` /// /// These are accessible as variables: - /// /// - ({{input.propertyName}}) in context of the block execution (step) /// - ({{stepName.input.propertyName}}) in context of the workflow /// @@ -28,13 +27,11 @@ public record ConversationBlock /// This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`). /// /// These are accessible as variables: - /// /// - ({{output.propertyName}}) in context of the block execution (step) /// - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) /// - ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2) /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// @@ -75,7 +72,6 @@ public record ConversationBlock /// This is the instruction to the model. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "{{input.your-property-name}}" for the current step's input /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) /// - "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1) @@ -85,13 +81,11 @@ public record ConversationBlock /// - "{{global.your-property-name}}" for the global context /// /// This can be as simple or as complex as you want it to be. - /// /// - "say hello and ask the user about their day!" /// - "collect the user's first and last name" /// - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}" /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/CreateAnthropicCredentialDto.cs b/src/Vapi.Net/Types/CreateAnthropicCredentialDto.cs index c0a6902..d9c082b 100644 --- a/src/Vapi.Net/Types/CreateAnthropicCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateAnthropicCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateAnthropicCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateAnyscaleCredentialDto.cs b/src/Vapi.Net/Types/CreateAnyscaleCredentialDto.cs index 02c0981..b80691b 100644 --- a/src/Vapi.Net/Types/CreateAnyscaleCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateAnyscaleCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateAnyscaleCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateAssemblyAiCredentialDto.cs b/src/Vapi.Net/Types/CreateAssemblyAiCredentialDto.cs new file mode 100644 index 0000000..d39a579 --- /dev/null +++ b/src/Vapi.Net/Types/CreateAssemblyAiCredentialDto.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateAssemblyAiCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateAssistantDto.cs b/src/Vapi.Net/Types/CreateAssistantDto.cs index 9d37986..df5fcd2 100644 --- a/src/Vapi.Net/Types/CreateAssistantDto.cs +++ b/src/Vapi.Net/Types/CreateAssistantDto.cs @@ -25,11 +25,18 @@ public record CreateAssistantDto [JsonPropertyName("voice")] public object? Voice { get; set; } + /// + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + /// + [JsonPropertyName("firstMessage")] + public string? FirstMessage { get; set; } + /// /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// /// Use: - /// /// - 'assistant-speaks-first' to have the assistant speak first. /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). @@ -46,7 +53,7 @@ public record CreateAssistantDto public bool? HipaaEnabled { get; set; } /// - /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. /// [JsonPropertyName("clientMessages")] public IEnumerable? ClientMessages { get; set; } @@ -79,16 +86,6 @@ public record CreateAssistantDto [JsonPropertyName("backgroundSound")] public CreateAssistantDtoBackgroundSound? BackgroundSound { get; set; } - /// - /// This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. - /// - /// Default `false` while in beta. - /// - /// @default false - /// - [JsonPropertyName("backchannelingEnabled")] - public bool? BackchannelingEnabled { get; set; } - /// /// This enables filtering of noise and background speech while the user is talking. /// @@ -123,14 +120,6 @@ public record CreateAssistantDto [JsonPropertyName("name")] public string? Name { get; set; } - /// - /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). - /// - /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. - /// - [JsonPropertyName("firstMessage")] - public string? FirstMessage { get; set; } - /// /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. /// This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. @@ -167,24 +156,6 @@ public record CreateAssistantDto [JsonPropertyName("metadata")] public object? Metadata { get; set; } - /// - /// This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. - /// - /// All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation. - /// - /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl - /// - [JsonPropertyName("serverUrl")] - public string? ServerUrl { get; set; } - - /// - /// This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. - /// - /// Same precedence logic as serverUrl. - /// - [JsonPropertyName("serverUrlSecret")] - public string? ServerUrlSecret { get; set; } - /// /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. /// @@ -211,7 +182,6 @@ public record CreateAssistantDto /// This is the plan for when the assistant should start talking. /// /// You should configure this if you're running into these issues: - /// /// - The assistant is too slow to start talking after the customer is done speaking. /// - The assistant is too fast to start talking after the customer is done speaking. /// - The assistant is so fast that it's actually interrupting the customer. @@ -223,7 +193,6 @@ public record CreateAssistantDto /// This is the plan for when assistant should stop talking on customer interruption. /// /// You should configure this if you're running into these issues: - /// /// - The assistant is too slow to recognize customer's interruption. /// - The assistant is too fast to recognize customer's interruption. /// - The assistant is getting interrupted by phrases that are just acknowledgments. @@ -237,7 +206,6 @@ public record CreateAssistantDto /// This is the plan for real-time monitoring of the assistant's calls. /// /// Usage: - /// /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. /// @@ -252,6 +220,18 @@ public record CreateAssistantDto [JsonPropertyName("credentialIds")] public IEnumerable? CredentialIds { get; set; } + /// + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateAssistantDtoBackgroundSound.cs b/src/Vapi.Net/Types/CreateAssistantDtoBackgroundSound.cs index 1db438e..43d2f1b 100644 --- a/src/Vapi.Net/Types/CreateAssistantDtoBackgroundSound.cs +++ b/src/Vapi.Net/Types/CreateAssistantDtoBackgroundSound.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateAssistantDtoBackgroundSound { [EnumMember(Value = "off")] diff --git a/src/Vapi.Net/Types/CreateAssistantDtoClientMessagesItem.cs b/src/Vapi.Net/Types/CreateAssistantDtoClientMessagesItem.cs index abd16e2..dc64bfa 100644 --- a/src/Vapi.Net/Types/CreateAssistantDtoClientMessagesItem.cs +++ b/src/Vapi.Net/Types/CreateAssistantDtoClientMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateAssistantDtoClientMessagesItem { [EnumMember(Value = "conversation-update")] @@ -45,6 +45,9 @@ public enum CreateAssistantDtoClientMessagesItem [EnumMember(Value = "tool-calls-result")] ToolCallsResult, + [EnumMember(Value = "transfer-update")] + TransferUpdate, + [EnumMember(Value = "user-interrupted")] UserInterrupted, diff --git a/src/Vapi.Net/Types/CreateAssistantDtoFirstMessageMode.cs b/src/Vapi.Net/Types/CreateAssistantDtoFirstMessageMode.cs index af3c848..90c7ea2 100644 --- a/src/Vapi.Net/Types/CreateAssistantDtoFirstMessageMode.cs +++ b/src/Vapi.Net/Types/CreateAssistantDtoFirstMessageMode.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateAssistantDtoFirstMessageMode { [EnumMember(Value = "assistant-speaks-first")] diff --git a/src/Vapi.Net/Types/CreateAssistantDtoServerMessagesItem.cs b/src/Vapi.Net/Types/CreateAssistantDtoServerMessagesItem.cs index e701da2..9723cdb 100644 --- a/src/Vapi.Net/Types/CreateAssistantDtoServerMessagesItem.cs +++ b/src/Vapi.Net/Types/CreateAssistantDtoServerMessagesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateAssistantDtoServerMessagesItem { [EnumMember(Value = "conversation-update")] @@ -24,6 +24,9 @@ public enum CreateAssistantDtoServerMessagesItem [EnumMember(Value = "language-changed")] LanguageChanged, + [EnumMember(Value = "language-change-detected")] + LanguageChangeDetected, + [EnumMember(Value = "model-output")] ModelOutput, diff --git a/src/Vapi.Net/Types/CreateAzureCredentialDto.cs b/src/Vapi.Net/Types/CreateAzureCredentialDto.cs new file mode 100644 index 0000000..b5f3513 --- /dev/null +++ b/src/Vapi.Net/Types/CreateAzureCredentialDto.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateAzureCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is the service being used in Azure. + /// + [JsonPropertyName("service")] + public required string Service { get; set; } + + /// + /// This is the region of the Azure resource. + /// + [JsonPropertyName("region")] + public CreateAzureCredentialDtoRegion? Region { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public string? ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateAzureCredentialDtoRegion.cs b/src/Vapi.Net/Types/CreateAzureCredentialDtoRegion.cs new file mode 100644 index 0000000..01d4a81 --- /dev/null +++ b/src/Vapi.Net/Types/CreateAzureCredentialDtoRegion.cs @@ -0,0 +1,59 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum CreateAzureCredentialDtoRegion +{ + [EnumMember(Value = "australia")] + Australia, + + [EnumMember(Value = "canada")] + Canada, + + [EnumMember(Value = "eastus2")] + Eastus2, + + [EnumMember(Value = "eastus")] + Eastus, + + [EnumMember(Value = "france")] + France, + + [EnumMember(Value = "india")] + India, + + [EnumMember(Value = "japan")] + Japan, + + [EnumMember(Value = "uaenorth")] + Uaenorth, + + [EnumMember(Value = "northcentralus")] + Northcentralus, + + [EnumMember(Value = "norway")] + Norway, + + [EnumMember(Value = "southcentralus")] + Southcentralus, + + [EnumMember(Value = "sweden")] + Sweden, + + [EnumMember(Value = "switzerland")] + Switzerland, + + [EnumMember(Value = "uk")] + Uk, + + [EnumMember(Value = "westus")] + Westus, + + [EnumMember(Value = "westus3")] + Westus3, +} diff --git a/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDto.cs b/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDto.cs index 0894d97..a2971ac 100644 --- a/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDto.cs @@ -26,6 +26,12 @@ public record CreateAzureOpenAiCredentialDto [JsonPropertyName("openAIEndpoint")] public required string OpenAiEndpoint { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoModelsItem.cs b/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoModelsItem.cs index cf79cd1..434b670 100644 --- a/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoModelsItem.cs +++ b/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoModelsItem.cs @@ -6,9 +6,12 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateAzureOpenAiCredentialDtoModelsItem { + [EnumMember(Value = "gpt-4o-2024-08-06")] + Gpt4O20240806, + [EnumMember(Value = "gpt-4o-mini-2024-07-18")] Gpt4OMini20240718, diff --git a/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoRegion.cs b/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoRegion.cs index 7bd446a..4a20d84 100644 --- a/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoRegion.cs +++ b/src/Vapi.Net/Types/CreateAzureOpenAiCredentialDtoRegion.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateAzureOpenAiCredentialDtoRegion { [EnumMember(Value = "australia")] @@ -30,6 +30,9 @@ public enum CreateAzureOpenAiCredentialDtoRegion [EnumMember(Value = "japan")] Japan, + [EnumMember(Value = "uaenorth")] + Uaenorth, + [EnumMember(Value = "northcentralus")] Northcentralus, diff --git a/src/Vapi.Net/Types/CreateBashToolDto.cs b/src/Vapi.Net/Types/CreateBashToolDto.cs new file mode 100644 index 0000000..838d291 --- /dev/null +++ b/src/Vapi.Net/Types/CreateBashToolDto.cs @@ -0,0 +1,66 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateBashToolDto +{ + /// + /// This determines if the tool is async. + /// + /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + /// + /// If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + /// + /// Defaults to synchronous (`false`). + /// + [JsonPropertyName("async")] + public bool? Async { get; set; } + + /// + /// These are the messages that will be spoken to the user as the tool is running. + /// + /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// The sub type of tool. + /// + [JsonPropertyName("subType")] + public required string SubType { get; set; } + + /// + /// The name of the tool, fixed to 'bash' + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// This is the function definition of the tool. + /// + /// For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + /// + /// An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + /// + [JsonPropertyName("function")] + public OpenAiFunction? Function { get; set; } + + /// + /// This is the server that will be hit when this tool is requested by the model. + /// + /// All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + /// + /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateByoPhoneNumberDto.cs b/src/Vapi.Net/Types/CreateByoPhoneNumberDto.cs index 0960ab2..ac840cc 100644 --- a/src/Vapi.Net/Types/CreateByoPhoneNumberDto.cs +++ b/src/Vapi.Net/Types/CreateByoPhoneNumberDto.cs @@ -9,7 +9,6 @@ public record CreateByoPhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -23,7 +22,6 @@ public record CreateByoPhoneNumberDto /// This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it. /// /// Use cases: - /// /// - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks. /// - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls. /// @@ -75,7 +73,7 @@ public record CreateByoPhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/CreateByoSipTrunkCredentialDto.cs b/src/Vapi.Net/Types/CreateByoSipTrunkCredentialDto.cs index 45cda00..793b11e 100644 --- a/src/Vapi.Net/Types/CreateByoSipTrunkCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateByoSipTrunkCredentialDto.cs @@ -19,12 +19,6 @@ public record CreateByoSipTrunkCredentialDto [JsonPropertyName("gateways")] public IEnumerable Gateways { get; set; } = new List(); - /// - /// This is the name of the SIP trunk. This is just for your reference. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - /// /// This can be used to configure the outbound authentication if required by the SIP trunk. /// @@ -35,7 +29,6 @@ public record CreateByoSipTrunkCredentialDto /// This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. /// /// Usage: - /// /// - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. /// /// @default false @@ -43,12 +36,30 @@ public record CreateByoSipTrunkCredentialDto [JsonPropertyName("outboundLeadingPlusEnabled")] public bool? OutboundLeadingPlusEnabled { get; set; } + /// + /// This can be used to configure the tech prefix on outbound calls. This is an advanced property. + /// + [JsonPropertyName("techPrefix")] + public string? TechPrefix { get; set; } + + /// + /// This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property. + /// + [JsonPropertyName("sipDiversionHeader")] + public string? SipDiversionHeader { get; set; } + /// /// This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC provided by Vapi. /// [JsonPropertyName("sbcConfiguration")] public SbcConfiguration? SbcConfiguration { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateCartesiaCredentialDto.cs b/src/Vapi.Net/Types/CreateCartesiaCredentialDto.cs index 6c6ed65..ec718ab 100644 --- a/src/Vapi.Net/Types/CreateCartesiaCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateCartesiaCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateCartesiaCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateComputerToolDto.cs b/src/Vapi.Net/Types/CreateComputerToolDto.cs new file mode 100644 index 0000000..c639cd6 --- /dev/null +++ b/src/Vapi.Net/Types/CreateComputerToolDto.cs @@ -0,0 +1,84 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateComputerToolDto +{ + /// + /// This determines if the tool is async. + /// + /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + /// + /// If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + /// + /// Defaults to synchronous (`false`). + /// + [JsonPropertyName("async")] + public bool? Async { get; set; } + + /// + /// These are the messages that will be spoken to the user as the tool is running. + /// + /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// The sub type of tool. + /// + [JsonPropertyName("subType")] + public required string SubType { get; set; } + + /// + /// The name of the tool, fixed to 'computer' + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// The display width in pixels + /// + [JsonPropertyName("displayWidthPx")] + public required double DisplayWidthPx { get; set; } + + /// + /// The display height in pixels + /// + [JsonPropertyName("displayHeightPx")] + public required double DisplayHeightPx { get; set; } + + /// + /// Optional display number + /// + [JsonPropertyName("displayNumber")] + public double? DisplayNumber { get; set; } + + /// + /// This is the function definition of the tool. + /// + /// For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + /// + /// An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + /// + [JsonPropertyName("function")] + public OpenAiFunction? Function { get; set; } + + /// + /// This is the server that will be hit when this tool is requested by the model. + /// + /// All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + /// + /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateConversationBlockDto.cs b/src/Vapi.Net/Types/CreateConversationBlockDto.cs index a160149..8b642b4 100644 --- a/src/Vapi.Net/Types/CreateConversationBlockDto.cs +++ b/src/Vapi.Net/Types/CreateConversationBlockDto.cs @@ -17,7 +17,6 @@ public record CreateConversationBlockDto /// This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input` /// /// These are accessible as variables: - /// /// - ({{input.propertyName}}) in context of the block execution (step) /// - ({{stepName.input.propertyName}}) in context of the workflow /// @@ -28,13 +27,11 @@ public record CreateConversationBlockDto /// This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`). /// /// These are accessible as variables: - /// /// - ({{output.propertyName}}) in context of the block execution (step) /// - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) /// - ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2) /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// @@ -45,7 +42,6 @@ public record CreateConversationBlockDto /// This is the instruction to the model. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "{{input.your-property-name}}" for the current step's input /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) /// - "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1) @@ -55,13 +51,11 @@ public record CreateConversationBlockDto /// - "{{global.your-property-name}}" for the global context /// /// This can be as simple or as complex as you want it to be. - /// /// - "say hello and ask the user about their day!" /// - "collect the user's first and last name" /// - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}" /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/CreateCustomKnowledgeBaseDto.cs b/src/Vapi.Net/Types/CreateCustomKnowledgeBaseDto.cs new file mode 100644 index 0000000..f848cb7 --- /dev/null +++ b/src/Vapi.Net/Types/CreateCustomKnowledgeBaseDto.cs @@ -0,0 +1,59 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateCustomKnowledgeBaseDto +{ + /// + /// /** + /// This is where the knowledge base request will be sent. + /// + /// Request Example: + /// + /// POST https://{server.url} + /// Content-Type: application/json + /// + /// { + /// "messsage": { + /// "type": "knowledge-base-request", + /// "messages": [ + /// { + /// "role": "user", + /// "content": "Why is ocean blue?" + /// } + /// ], + /// ...other metadata about the call... + /// } + /// } + /// + /// Response Expected: + /// ``` + /// { + /// "message": { + /// "role": "assistant", + /// "content": "The ocean is blue because water absorbs everything but blue.", + /// }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + /// "documents": [ + /// { + /// "content": "The ocean is blue primarily because water absorbs colors in the red part of the light spectrum and scatters the blue light, making it more visible to our eyes.", + /// "similarity": 1 + /// }, + /// { + /// "content": "Blue light is scattered more by the water molecules than other colors, enhancing the blue appearance of the ocean.", + /// "similarity": .5 + /// } + /// ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + /// } + /// ``` + /// + [JsonPropertyName("server")] + public required Server Server { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateCustomLlmCredentialDto.cs b/src/Vapi.Net/Types/CreateCustomLlmCredentialDto.cs index 9d64670..7ad11bf 100644 --- a/src/Vapi.Net/Types/CreateCustomLlmCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateCustomLlmCredentialDto.cs @@ -16,6 +16,18 @@ public record CreateCustomLlmCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the authentication plan. Currently supports OAuth2 RFC 6749. To use Bearer authentication, use apiKey + /// + [JsonPropertyName("authenticationPlan")] + public OAuth2AuthenticationPlan? AuthenticationPlan { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateCustomerDto.cs b/src/Vapi.Net/Types/CreateCustomerDto.cs index 222ba6c..17d6a48 100644 --- a/src/Vapi.Net/Types/CreateCustomerDto.cs +++ b/src/Vapi.Net/Types/CreateCustomerDto.cs @@ -11,7 +11,6 @@ public record CreateCustomerDto /// This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it. /// /// Use cases: - /// /// - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks. /// - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls. /// @@ -43,7 +42,7 @@ public record CreateCustomerDto /// /// This is the name of the customer. This is just for your own reference. /// - /// For SIP inbound calls, this is extracted from the `From` SIP header with format `"Display Name" `. + /// For SIP inbound calls, this is extracted from the `From` SIP header with format `"Display Name" <sip:username@domain>`. /// [JsonPropertyName("name")] public string? Name { get; set; } diff --git a/src/Vapi.Net/Types/CreateDeepInfraCredentialDto.cs b/src/Vapi.Net/Types/CreateDeepInfraCredentialDto.cs index dc66082..9db0675 100644 --- a/src/Vapi.Net/Types/CreateDeepInfraCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateDeepInfraCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateDeepInfraCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateDeepgramCredentialDto.cs b/src/Vapi.Net/Types/CreateDeepgramCredentialDto.cs index cea49be..e99217a 100644 --- a/src/Vapi.Net/Types/CreateDeepgramCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateDeepgramCredentialDto.cs @@ -22,6 +22,12 @@ public record CreateDeepgramCredentialDto [JsonPropertyName("apiUrl")] public string? ApiUrl { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateElevenLabsCredentialDto.cs b/src/Vapi.Net/Types/CreateElevenLabsCredentialDto.cs index 08b38bf..6c6da1c 100644 --- a/src/Vapi.Net/Types/CreateElevenLabsCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateElevenLabsCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateElevenLabsCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateGcpCredentialDto.cs b/src/Vapi.Net/Types/CreateGcpCredentialDto.cs index 12c9bb9..5d6fe43 100644 --- a/src/Vapi.Net/Types/CreateGcpCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateGcpCredentialDto.cs @@ -11,13 +11,7 @@ public record CreateGcpCredentialDto public required string Provider { get; set; } /// - /// This is the name of the GCP credential. This is just for your reference. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details//keys. + /// This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. /// /// The schema is identical to the JSON that GCP outputs. /// @@ -30,6 +24,12 @@ public record CreateGcpCredentialDto [JsonPropertyName("bucketPlan")] public BucketPlan? BucketPlan { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateGladiaCredentialDto.cs b/src/Vapi.Net/Types/CreateGladiaCredentialDto.cs index c84a3f5..496571c 100644 --- a/src/Vapi.Net/Types/CreateGladiaCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateGladiaCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateGladiaCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateGoHighLevelCredentialDto.cs b/src/Vapi.Net/Types/CreateGoHighLevelCredentialDto.cs index 0a0be92..6f4534e 100644 --- a/src/Vapi.Net/Types/CreateGoHighLevelCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateGoHighLevelCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateGoHighLevelCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateGoogleCredentialDto.cs b/src/Vapi.Net/Types/CreateGoogleCredentialDto.cs new file mode 100644 index 0000000..b8c70ad --- /dev/null +++ b/src/Vapi.Net/Types/CreateGoogleCredentialDto.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateGoogleCredentialDto +{ + /// + /// This is the key for Gemini in Google AI Studio. Get it from here: https://aistudio.google.com/app/apikey + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateGroqCredentialDto.cs b/src/Vapi.Net/Types/CreateGroqCredentialDto.cs index e4544a4..d187ca9 100644 --- a/src/Vapi.Net/Types/CreateGroqCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateGroqCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateGroqCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateInflectionAiCredentialDto.cs b/src/Vapi.Net/Types/CreateInflectionAiCredentialDto.cs new file mode 100644 index 0000000..54cb15e --- /dev/null +++ b/src/Vapi.Net/Types/CreateInflectionAiCredentialDto.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateInflectionAiCredentialDto +{ + /// + /// This is the api key for Pi in InflectionAI's console. Get it from here: https://developers.inflection.ai/keys, billing will need to be setup + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateLangfuseCredentialDto.cs b/src/Vapi.Net/Types/CreateLangfuseCredentialDto.cs new file mode 100644 index 0000000..2cf92cb --- /dev/null +++ b/src/Vapi.Net/Types/CreateLangfuseCredentialDto.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateLangfuseCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// The public key for Langfuse project. Eg: pk-lf-... + /// + [JsonPropertyName("publicKey")] + public required string PublicKey { get; set; } + + /// + /// The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// The host URL for Langfuse project. Eg: https://cloud.langfuse.com + /// + [JsonPropertyName("apiUrl")] + public required string ApiUrl { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateLmntCredentialDto.cs b/src/Vapi.Net/Types/CreateLmntCredentialDto.cs index e4097f4..d0338de 100644 --- a/src/Vapi.Net/Types/CreateLmntCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateLmntCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateLmntCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateMakeCredentialDto.cs b/src/Vapi.Net/Types/CreateMakeCredentialDto.cs index 42bf7eb..8b65232 100644 --- a/src/Vapi.Net/Types/CreateMakeCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateMakeCredentialDto.cs @@ -28,6 +28,12 @@ public record CreateMakeCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateOpenAiCredentialDto.cs b/src/Vapi.Net/Types/CreateOpenAiCredentialDto.cs index 4398fff..bca734a 100644 --- a/src/Vapi.Net/Types/CreateOpenAiCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateOpenAiCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateOpenAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateOpenRouterCredentialDto.cs b/src/Vapi.Net/Types/CreateOpenRouterCredentialDto.cs index c8210d3..6eb9630 100644 --- a/src/Vapi.Net/Types/CreateOpenRouterCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateOpenRouterCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateOpenRouterCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateOrgDto.cs b/src/Vapi.Net/Types/CreateOrgDto.cs index 0ab16cf..8365188 100644 --- a/src/Vapi.Net/Types/CreateOrgDto.cs +++ b/src/Vapi.Net/Types/CreateOrgDto.cs @@ -15,12 +15,24 @@ public record CreateOrgDto [JsonPropertyName("hipaaEnabled")] public bool? HipaaEnabled { get; set; } + /// + /// This is the ID of the subscription the org belongs to. + /// + [JsonPropertyName("subscriptionId")] + public string? SubscriptionId { get; set; } + /// /// This is the name of the org. This is just for your own reference. /// [JsonPropertyName("name")] public string? Name { get; set; } + /// + /// This is the channel of the org. There is the cluster the API traffic for the org will be directed. + /// + [JsonPropertyName("channel")] + public CreateOrgDtoChannel? Channel { get; set; } + /// /// This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. /// diff --git a/src/Vapi.Net/Types/CreateOrgDtoChannel.cs b/src/Vapi.Net/Types/CreateOrgDtoChannel.cs new file mode 100644 index 0000000..7bbdc60 --- /dev/null +++ b/src/Vapi.Net/Types/CreateOrgDtoChannel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum CreateOrgDtoChannel +{ + [EnumMember(Value = "default")] + Default, + + [EnumMember(Value = "weekly")] + Weekly, +} diff --git a/src/Vapi.Net/Types/CreatePerplexityAiCredentialDto.cs b/src/Vapi.Net/Types/CreatePerplexityAiCredentialDto.cs index 04b5e69..464b5c3 100644 --- a/src/Vapi.Net/Types/CreatePerplexityAiCredentialDto.cs +++ b/src/Vapi.Net/Types/CreatePerplexityAiCredentialDto.cs @@ -16,6 +16,12 @@ public record CreatePerplexityAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreatePlayHtCredentialDto.cs b/src/Vapi.Net/Types/CreatePlayHtCredentialDto.cs index 1a35229..0bd56b3 100644 --- a/src/Vapi.Net/Types/CreatePlayHtCredentialDto.cs +++ b/src/Vapi.Net/Types/CreatePlayHtCredentialDto.cs @@ -19,6 +19,12 @@ public record CreatePlayHtCredentialDto [JsonPropertyName("userId")] public required string UserId { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateRimeAiCredentialDto.cs b/src/Vapi.Net/Types/CreateRimeAiCredentialDto.cs index 463cc43..c0f4ae0 100644 --- a/src/Vapi.Net/Types/CreateRimeAiCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateRimeAiCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateRimeAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateRunpodCredentialDto.cs b/src/Vapi.Net/Types/CreateRunpodCredentialDto.cs index 9f5fb8d..5214686 100644 --- a/src/Vapi.Net/Types/CreateRunpodCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateRunpodCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateRunpodCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateS3CredentialDto.cs b/src/Vapi.Net/Types/CreateS3CredentialDto.cs index 512cdcc..4d3d3fd 100644 --- a/src/Vapi.Net/Types/CreateS3CredentialDto.cs +++ b/src/Vapi.Net/Types/CreateS3CredentialDto.cs @@ -43,6 +43,12 @@ public record CreateS3CredentialDto [JsonPropertyName("s3PathPrefix")] public required string S3PathPrefix { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateTavusCredentialDto.cs b/src/Vapi.Net/Types/CreateTavusCredentialDto.cs new file mode 100644 index 0000000..50e8915 --- /dev/null +++ b/src/Vapi.Net/Types/CreateTavusCredentialDto.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateTavusCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateTextEditorToolDto.cs b/src/Vapi.Net/Types/CreateTextEditorToolDto.cs new file mode 100644 index 0000000..871833e --- /dev/null +++ b/src/Vapi.Net/Types/CreateTextEditorToolDto.cs @@ -0,0 +1,66 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateTextEditorToolDto +{ + /// + /// This determines if the tool is async. + /// + /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + /// + /// If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + /// + /// Defaults to synchronous (`false`). + /// + [JsonPropertyName("async")] + public bool? Async { get; set; } + + /// + /// These are the messages that will be spoken to the user as the tool is running. + /// + /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// The sub type of tool. + /// + [JsonPropertyName("subType")] + public required string SubType { get; set; } + + /// + /// The name of the tool, fixed to 'str_replace_editor' + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// This is the function definition of the tool. + /// + /// For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + /// + /// An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + /// + [JsonPropertyName("function")] + public OpenAiFunction? Function { get; set; } + + /// + /// This is the server that will be hit when this tool is requested by the model. + /// + /// All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + /// + /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateTogetherAiCredentialDto.cs b/src/Vapi.Net/Types/CreateTogetherAiCredentialDto.cs index 855deaf..2917159 100644 --- a/src/Vapi.Net/Types/CreateTogetherAiCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateTogetherAiCredentialDto.cs @@ -16,6 +16,12 @@ public record CreateTogetherAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateTokenDtoTag.cs b/src/Vapi.Net/Types/CreateTokenDtoTag.cs index 88f2f14..e38c52b 100644 --- a/src/Vapi.Net/Types/CreateTokenDtoTag.cs +++ b/src/Vapi.Net/Types/CreateTokenDtoTag.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateTokenDtoTag { [EnumMember(Value = "private")] diff --git a/src/Vapi.Net/Types/CreateToolCallBlockDto.cs b/src/Vapi.Net/Types/CreateToolCallBlockDto.cs index 301c119..4edae24 100644 --- a/src/Vapi.Net/Types/CreateToolCallBlockDto.cs +++ b/src/Vapi.Net/Types/CreateToolCallBlockDto.cs @@ -17,7 +17,6 @@ public record CreateToolCallBlockDto /// This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input` /// /// These are accessible as variables: - /// /// - ({{input.propertyName}}) in context of the block execution (step) /// - ({{stepName.input.propertyName}}) in context of the workflow /// @@ -28,13 +27,11 @@ public record CreateToolCallBlockDto /// This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`). /// /// These are accessible as variables: - /// /// - ({{output.propertyName}}) in context of the block execution (step) /// - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) /// - ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2) /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/CreateToolTemplateDtoProvider.cs b/src/Vapi.Net/Types/CreateToolTemplateDtoProvider.cs index 139e81b..5dc9d65 100644 --- a/src/Vapi.Net/Types/CreateToolTemplateDtoProvider.cs +++ b/src/Vapi.Net/Types/CreateToolTemplateDtoProvider.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateToolTemplateDtoProvider { [EnumMember(Value = "make")] diff --git a/src/Vapi.Net/Types/CreateToolTemplateDtoVisibility.cs b/src/Vapi.Net/Types/CreateToolTemplateDtoVisibility.cs index ac3c017..ecfcce2 100644 --- a/src/Vapi.Net/Types/CreateToolTemplateDtoVisibility.cs +++ b/src/Vapi.Net/Types/CreateToolTemplateDtoVisibility.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CreateToolTemplateDtoVisibility { [EnumMember(Value = "public")] diff --git a/src/Vapi.Net/Types/CreateTrieveKnowledgeBaseDto.cs b/src/Vapi.Net/Types/CreateTrieveKnowledgeBaseDto.cs new file mode 100644 index 0000000..394c75c --- /dev/null +++ b/src/Vapi.Net/Types/CreateTrieveKnowledgeBaseDto.cs @@ -0,0 +1,42 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateTrieveKnowledgeBaseDto +{ + /// + /// This is the name of the knowledge base. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// This is the plan on how to search the vector store while a call is going on. + /// + [JsonPropertyName("vectorStoreSearchPlan")] + public required TrieveKnowledgeBaseVectorStoreSearchPlan VectorStoreSearchPlan { get; set; } + + /// + /// This is the plan if you want us to create a new vector store on your behalf. To use an existing vector store from your account, use `vectoreStoreProviderId` + /// + [JsonPropertyName("vectorStoreCreatePlan")] + public TrieveKnowledgeBaseVectorStoreCreatePlan? VectorStoreCreatePlan { get; set; } + + /// + /// This is an vector store that you already have on your account with the provider. To create a new vector store, use vectorStoreCreatePlan. + /// + /// Usage: + /// - To bring your own vector store from Trieve, go to https://trieve.ai + /// - Create a dataset, and use the datasetId here. + /// + [JsonPropertyName("vectorStoreProviderId")] + public string? VectorStoreProviderId { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateTwilioCredentialDto.cs b/src/Vapi.Net/Types/CreateTwilioCredentialDto.cs index 8043ee9..5b2751f 100644 --- a/src/Vapi.Net/Types/CreateTwilioCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateTwilioCredentialDto.cs @@ -19,6 +19,12 @@ public record CreateTwilioCredentialDto [JsonPropertyName("accountSid")] public required string AccountSid { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateTwilioPhoneNumberDto.cs b/src/Vapi.Net/Types/CreateTwilioPhoneNumberDto.cs index 4bb634b..4904f1e 100644 --- a/src/Vapi.Net/Types/CreateTwilioPhoneNumberDto.cs +++ b/src/Vapi.Net/Types/CreateTwilioPhoneNumberDto.cs @@ -9,7 +9,6 @@ public record CreateTwilioPhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -64,7 +63,7 @@ public record CreateTwilioPhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/CreateVapiPhoneNumberDto.cs b/src/Vapi.Net/Types/CreateVapiPhoneNumberDto.cs index b90eead..02e3eda 100644 --- a/src/Vapi.Net/Types/CreateVapiPhoneNumberDto.cs +++ b/src/Vapi.Net/Types/CreateVapiPhoneNumberDto.cs @@ -9,7 +9,6 @@ public record CreateVapiPhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -27,6 +26,14 @@ public record CreateVapiPhoneNumberDto [JsonPropertyName("sipUri")] public required string SipUri { get; set; } + /// + /// This enables authentication for incoming SIP INVITE requests to the `sipUri`. + /// + /// If not set, any username/password to the 401 challenge of the SIP INVITE will be accepted. + /// + [JsonPropertyName("authentication")] + public SipAuthentication? Authentication { get; set; } + /// /// This is the name of the phone number. This is just for your own reference. /// @@ -54,7 +61,7 @@ public record CreateVapiPhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/CreateVonageCredentialDto.cs b/src/Vapi.Net/Types/CreateVonageCredentialDto.cs index 28a06eb..f6eebf2 100644 --- a/src/Vapi.Net/Types/CreateVonageCredentialDto.cs +++ b/src/Vapi.Net/Types/CreateVonageCredentialDto.cs @@ -19,6 +19,12 @@ public record CreateVonageCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CreateVonagePhoneNumberDto.cs b/src/Vapi.Net/Types/CreateVonagePhoneNumberDto.cs index 3798167..d7274fc 100644 --- a/src/Vapi.Net/Types/CreateVonagePhoneNumberDto.cs +++ b/src/Vapi.Net/Types/CreateVonagePhoneNumberDto.cs @@ -9,7 +9,6 @@ public record CreateVonagePhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -58,7 +57,7 @@ public record CreateVonagePhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/CreateWebhookCredentialDto.cs b/src/Vapi.Net/Types/CreateWebhookCredentialDto.cs new file mode 100644 index 0000000..1afbeaf --- /dev/null +++ b/src/Vapi.Net/Types/CreateWebhookCredentialDto.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateWebhookCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is the authentication plan. Currently supports OAuth2 RFC 6749. + /// + [JsonPropertyName("authenticationPlan")] + public required OAuth2AuthenticationPlan AuthenticationPlan { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreateWorkflowBlockDto.cs b/src/Vapi.Net/Types/CreateWorkflowBlockDto.cs index f3b94fb..f4c7071 100644 --- a/src/Vapi.Net/Types/CreateWorkflowBlockDto.cs +++ b/src/Vapi.Net/Types/CreateWorkflowBlockDto.cs @@ -17,7 +17,6 @@ public record CreateWorkflowBlockDto /// This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input` /// /// These are accessible as variables: - /// /// - ({{input.propertyName}}) in context of the block execution (step) /// - ({{stepName.input.propertyName}}) in context of the workflow /// @@ -28,13 +27,11 @@ public record CreateWorkflowBlockDto /// This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`). /// /// These are accessible as variables: - /// /// - ({{output.propertyName}}) in context of the block execution (step) /// - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) /// - ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2) /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/CreateXAiCredentialDto.cs b/src/Vapi.Net/Types/CreateXAiCredentialDto.cs new file mode 100644 index 0000000..e83ce6c --- /dev/null +++ b/src/Vapi.Net/Types/CreateXAiCredentialDto.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreateXAiCredentialDto +{ + /// + /// This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CreditsBuyDto.cs b/src/Vapi.Net/Types/CreditsBuyDto.cs new file mode 100644 index 0000000..71658e4 --- /dev/null +++ b/src/Vapi.Net/Types/CreditsBuyDto.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CreditsBuyDto +{ + /// + /// This is the number of credits to add to the subscription. + /// + [JsonPropertyName("credits")] + public required double Credits { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CustomKnowledgeBase.cs b/src/Vapi.Net/Types/CustomKnowledgeBase.cs new file mode 100644 index 0000000..5a8213f --- /dev/null +++ b/src/Vapi.Net/Types/CustomKnowledgeBase.cs @@ -0,0 +1,71 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CustomKnowledgeBase +{ + /// + /// /** + /// This is where the knowledge base request will be sent. + /// + /// Request Example: + /// + /// POST https://{server.url} + /// Content-Type: application/json + /// + /// { + /// "messsage": { + /// "type": "knowledge-base-request", + /// "messages": [ + /// { + /// "role": "user", + /// "content": "Why is ocean blue?" + /// } + /// ], + /// ...other metadata about the call... + /// } + /// } + /// + /// Response Expected: + /// ``` + /// { + /// "message": { + /// "role": "assistant", + /// "content": "The ocean is blue because water absorbs everything but blue.", + /// }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + /// "documents": [ + /// { + /// "content": "The ocean is blue primarily because water absorbs colors in the red part of the light spectrum and scatters the blue light, making it more visible to our eyes.", + /// "similarity": 1 + /// }, + /// { + /// "content": "Blue light is scattered more by the water molecules than other colors, enhancing the blue appearance of the ocean.", + /// "similarity": .5 + /// } + /// ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + /// } + /// ``` + /// + [JsonPropertyName("server")] + public required Server Server { get; set; } + + /// + /// This is the id of the knowledge base. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the org id of the knowledge base. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CustomLlmCredential.cs b/src/Vapi.Net/Types/CustomLlmCredential.cs index 3ff633b..cb8ee84 100644 --- a/src/Vapi.Net/Types/CustomLlmCredential.cs +++ b/src/Vapi.Net/Types/CustomLlmCredential.cs @@ -16,6 +16,12 @@ public record CustomLlmCredential [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the authentication plan. Currently supports OAuth2 RFC 6749. To use Bearer authentication, use apiKey + /// + [JsonPropertyName("authenticationPlan")] + public OAuth2AuthenticationPlan? AuthenticationPlan { get; set; } + /// /// This is the unique identifier for the credential. /// @@ -40,6 +46,18 @@ public record CustomLlmCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the authentication session for the credential. Available for credentials that have an authentication plan. + /// + [JsonPropertyName("authenticationSession")] + public Oauth2AuthenticationSession? AuthenticationSession { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/CustomLlmModel.cs b/src/Vapi.Net/Types/CustomLlmModel.cs index 650ba80..031cc84 100644 --- a/src/Vapi.Net/Types/CustomLlmModel.cs +++ b/src/Vapi.Net/Types/CustomLlmModel.cs @@ -29,6 +29,18 @@ public record CustomLlmModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This determines whether metadata is sent in requests to the custom provider. /// @@ -61,12 +73,6 @@ public record CustomLlmModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/CustomLlmModelMetadataSendMode.cs b/src/Vapi.Net/Types/CustomLlmModelMetadataSendMode.cs index 32c5cdb..1c92e77 100644 --- a/src/Vapi.Net/Types/CustomLlmModelMetadataSendMode.cs +++ b/src/Vapi.Net/Types/CustomLlmModelMetadataSendMode.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum CustomLlmModelMetadataSendMode { [EnumMember(Value = "off")] diff --git a/src/Vapi.Net/Types/CustomMessage.cs b/src/Vapi.Net/Types/CustomMessage.cs new file mode 100644 index 0000000..d4bb4df --- /dev/null +++ b/src/Vapi.Net/Types/CustomMessage.cs @@ -0,0 +1,38 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CustomMessage +{ + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + + /// + /// This is a custom message. + /// + [JsonPropertyName("type")] + public required string Type { get; set; } + + /// + /// This is the content that the assistant will say when this message is triggered. + /// + [JsonPropertyName("content")] + public string? Content { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CustomTranscriber.cs b/src/Vapi.Net/Types/CustomTranscriber.cs new file mode 100644 index 0000000..7954677 --- /dev/null +++ b/src/Vapi.Net/Types/CustomTranscriber.cs @@ -0,0 +1,57 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CustomTranscriber +{ + /// + /// This is where the transcription request will be sent. + /// + /// Usage: + /// 1. Vapi will initiate a websocket connection with `server.url`. + /// + /// 2. Vapi will send an initial text frame with the sample rate. Format: + /// ``` + /// { + /// "type": "start", + /// "encoding": "linear16", // 16-bit raw PCM format + /// "container": "raw", + /// "sampleRate": {{sampleRate}}, + /// "channels": 2 // customer is channel 0, assistant is channel 1 + /// } + /// ``` + /// + /// 3. Vapi will send the audio data in 16-bit raw PCM format as binary frames. + /// + /// 4. You can read the messages something like this: + /// ``` + /// ws.on('message', (data, isBinary) => { + /// if (isBinary) { + /// pcmBuffer = Buffer.concat([pcmBuffer, data]); + /// console.log(`Received PCM data, buffer size: ${pcmBuffer.length}`); + /// } else { + /// console.log('Received message:', JSON.parse(data.toString())); + /// } + /// }); + /// ``` + /// + /// 5. You will respond with transcriptions as you have them. Format: + /// ``` + /// { + /// "type": "transcriber-response", + /// "transcription": "Hello, world!", + /// "channel": "customer" | "assistant" + /// } + /// ``` + /// + [JsonPropertyName("server")] + public required Server Server { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CustomVoice.cs b/src/Vapi.Net/Types/CustomVoice.cs new file mode 100644 index 0000000..cba4e11 --- /dev/null +++ b/src/Vapi.Net/Types/CustomVoice.cs @@ -0,0 +1,53 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CustomVoice +{ + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + /// + /// This is where the voice request will be sent. + /// + /// Request Example: + /// + /// POST https://{server.url} + /// Content-Type: application/json + /// + /// { + /// "message": { + /// "type": "voice-request", + /// "text": "Hello, world!", + /// "sampleRate": 24000, + /// ...other metadata about the call... + /// } + /// } + /// + /// Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified in the request. Here is how the response will be piped to the transport: + /// ``` + /// response.on('data', (chunk: Buffer) => { + /// outputStream.write(chunk); + /// }); + /// ``` + /// + [JsonPropertyName("server")] + public required Server Server { get; set; } + + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/CustomerCustomEndpointingRule.cs b/src/Vapi.Net/Types/CustomerCustomEndpointingRule.cs new file mode 100644 index 0000000..4a66399 --- /dev/null +++ b/src/Vapi.Net/Types/CustomerCustomEndpointingRule.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record CustomerCustomEndpointingRule +{ + /// + /// This is the regex pattern to match. + /// + /// Note: + /// - This works by using the `RegExp.test` method in Node.JS. Eg. `/hello/.test("hello there")` will return `true`. + /// + /// Hot tip: + /// - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + /// - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will return `true`. To do full string matching, send "^cat$". + /// + [JsonPropertyName("regex")] + public required string Regex { get; set; } + + /// + /// These are the options for the regex match. Defaults to all disabled. + /// + /// @default [] + /// + [JsonPropertyName("regexOptions")] + public IEnumerable? RegexOptions { get; set; } + + /// + /// This is the endpointing timeout in seconds, if the rule is matched. + /// + [JsonPropertyName("timeoutSeconds")] + public required double TimeoutSeconds { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/DeepInfraCredential.cs b/src/Vapi.Net/Types/DeepInfraCredential.cs index 39e093e..94645e8 100644 --- a/src/Vapi.Net/Types/DeepInfraCredential.cs +++ b/src/Vapi.Net/Types/DeepInfraCredential.cs @@ -40,6 +40,12 @@ public record DeepInfraCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/DeepInfraModel.cs b/src/Vapi.Net/Types/DeepInfraModel.cs index 45c45ec..979d368 100644 --- a/src/Vapi.Net/Types/DeepInfraModel.cs +++ b/src/Vapi.Net/Types/DeepInfraModel.cs @@ -29,6 +29,18 @@ public record DeepInfraModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b /// @@ -41,12 +53,6 @@ public record DeepInfraModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/DeepgramCredential.cs b/src/Vapi.Net/Types/DeepgramCredential.cs index 359a217..acccc73 100644 --- a/src/Vapi.Net/Types/DeepgramCredential.cs +++ b/src/Vapi.Net/Types/DeepgramCredential.cs @@ -40,6 +40,12 @@ public record DeepgramCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + /// /// This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com. /// diff --git a/src/Vapi.Net/Types/DeepgramTranscriber.cs b/src/Vapi.Net/Types/DeepgramTranscriber.cs index d0c8919..7f7ca71 100644 --- a/src/Vapi.Net/Types/DeepgramTranscriber.cs +++ b/src/Vapi.Net/Types/DeepgramTranscriber.cs @@ -26,10 +26,40 @@ public record DeepgramTranscriber public bool? SmartFormat { get; set; } /// - /// This enables or disables language detection. If true, swaps transcribers to detected language automatically. Defaults to false. + /// This automatically switches the transcriber's language when the customer's language changes. Defaults to false. + /// + /// Usage: + /// - If your customers switch languages mid-call, you can set this to true. + /// + /// Note: + /// - To detect language changes, Vapi uses a custom trained model. Languages supported (X = limited support): + /// 1. Arabic + /// 2. Bengali + /// 3. Cantonese + /// 4. Chinese + /// 5. Chinese Simplified (X) + /// 6. Chinese Traditional (X) + /// 7. English + /// 8. Farsi (X) + /// 9. French + /// 10. German + /// 11. Haitian Creole (X) + /// 12. Hindi + /// 13. Italian + /// 14. Japanese + /// 15. Korean + /// 16. Portuguese + /// 17. Russian + /// 18. Spanish + /// 19. Thai + /// 20. Urdu + /// 21. Vietnamese + /// - To receive `language-change-detected` webhook events, add it to `assistant.serverMessages`. + /// + /// @default false /// - [JsonPropertyName("languageDetectionEnabled")] - public bool? LanguageDetectionEnabled { get; set; } + [JsonPropertyName("codeSwitchingEnabled")] + public bool? CodeSwitchingEnabled { get; set; } /// /// These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. @@ -41,7 +71,6 @@ public record DeepgramTranscriber /// This is the timeout after which Deepgram will send transcription on user silence. You can read in-depth documentation here: https://developers.deepgram.com/docs/endpointing. /// /// Here are the most important bits: - /// /// - Defaults to 10. This is recommended for most use cases to optimize for latency. /// - 10 can cause some missing transcriptions since because of the shorter context. This mostly happens for one-word utterances. For those uses cases, it's recommended to try 300. It will add a bit of latency but the quality and reliability of the experience will be better. /// - If neither 10 nor 300 work, contact support@vapi.ai and we'll find another solution. diff --git a/src/Vapi.Net/Types/DeepgramTranscriberLanguage.cs b/src/Vapi.Net/Types/DeepgramTranscriberLanguage.cs index 6704c11..9c01821 100644 --- a/src/Vapi.Net/Types/DeepgramTranscriberLanguage.cs +++ b/src/Vapi.Net/Types/DeepgramTranscriberLanguage.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum DeepgramTranscriberLanguage { [EnumMember(Value = "bg")] diff --git a/src/Vapi.Net/Types/DeepgramTranscriberModel.cs b/src/Vapi.Net/Types/DeepgramTranscriberModel.cs index f298495..5202075 100644 --- a/src/Vapi.Net/Types/DeepgramTranscriberModel.cs +++ b/src/Vapi.Net/Types/DeepgramTranscriberModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum DeepgramTranscriberModel { [EnumMember(Value = "nova-2")] diff --git a/src/Vapi.Net/Types/DeepgramVoice.cs b/src/Vapi.Net/Types/DeepgramVoice.cs index ddcb828..80e957d 100644 --- a/src/Vapi.Net/Types/DeepgramVoice.cs +++ b/src/Vapi.Net/Types/DeepgramVoice.cs @@ -8,14 +8,6 @@ namespace Vapi.Net; public record DeepgramVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. /// @@ -28,6 +20,12 @@ public record DeepgramVoice [JsonPropertyName("chunkPlan")] public ChunkPlan? ChunkPlan { get; set; } + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/DeepgramVoiceIdEnum.cs b/src/Vapi.Net/Types/DeepgramVoiceIdEnum.cs index 101b30e..16df3d3 100644 --- a/src/Vapi.Net/Types/DeepgramVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/DeepgramVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum DeepgramVoiceIdEnum { [EnumMember(Value = "asteria")] diff --git a/src/Vapi.Net/Types/ElevenLabsCredential.cs b/src/Vapi.Net/Types/ElevenLabsCredential.cs index b1b677c..969fed2 100644 --- a/src/Vapi.Net/Types/ElevenLabsCredential.cs +++ b/src/Vapi.Net/Types/ElevenLabsCredential.cs @@ -40,6 +40,12 @@ public record ElevenLabsCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/ElevenLabsVoice.cs b/src/Vapi.Net/Types/ElevenLabsVoice.cs index 2f6458d..982f203 100644 --- a/src/Vapi.Net/Types/ElevenLabsVoice.cs +++ b/src/Vapi.Net/Types/ElevenLabsVoice.cs @@ -8,14 +8,6 @@ namespace Vapi.Net; public record ElevenLabsVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. Ensure the Voice is present in your 11Labs Voice Library. /// @@ -66,6 +58,12 @@ public record ElevenLabsVoice [JsonPropertyName("model")] public ElevenLabsVoiceModel? Model { get; set; } + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + /// /// This is the language (ISO 639-1) that is enforced for the model. Currently only Turbo v2.5 supports language enforcement. For other models, an error will be returned if language code is provided. /// @@ -73,10 +71,10 @@ public record ElevenLabsVoice public string? Language { get; set; } /// - /// This is the plan for chunking the model output before it is sent to the voice provider. + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. /// - [JsonPropertyName("chunkPlan")] - public ChunkPlan? ChunkPlan { get; set; } + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } public override string ToString() { diff --git a/src/Vapi.Net/Types/ElevenLabsVoiceIdEnum.cs b/src/Vapi.Net/Types/ElevenLabsVoiceIdEnum.cs index 4fd6ac9..ba896b1 100644 --- a/src/Vapi.Net/Types/ElevenLabsVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/ElevenLabsVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ElevenLabsVoiceIdEnum { [EnumMember(Value = "burt")] diff --git a/src/Vapi.Net/Types/ElevenLabsVoiceModel.cs b/src/Vapi.Net/Types/ElevenLabsVoiceModel.cs index 73b1b0a..24fa569 100644 --- a/src/Vapi.Net/Types/ElevenLabsVoiceModel.cs +++ b/src/Vapi.Net/Types/ElevenLabsVoiceModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ElevenLabsVoiceModel { [EnumMember(Value = "eleven_multilingual_v2")] diff --git a/src/Vapi.Net/Types/FallbackAzureVoice.cs b/src/Vapi.Net/Types/FallbackAzureVoice.cs new file mode 100644 index 0000000..2d1c618 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackAzureVoice.cs @@ -0,0 +1,36 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackAzureVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the speed multiplier that will be used. + /// + [JsonPropertyName("speed")] + public double? Speed { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + [JsonPropertyName("oneOf")] + public object? OneOf { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackAzureVoiceVoiceId.cs b/src/Vapi.Net/Types/FallbackAzureVoiceVoiceId.cs new file mode 100644 index 0000000..a9b73d7 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackAzureVoiceVoiceId.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackAzureVoiceVoiceId +{ + [EnumMember(Value = "andrew")] + Andrew, + + [EnumMember(Value = "brian")] + Brian, + + [EnumMember(Value = "emma")] + Emma, +} diff --git a/src/Vapi.Net/Types/FallbackCartesiaVoice.cs b/src/Vapi.Net/Types/FallbackCartesiaVoice.cs new file mode 100644 index 0000000..663f89f --- /dev/null +++ b/src/Vapi.Net/Types/FallbackCartesiaVoice.cs @@ -0,0 +1,38 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackCartesiaVoice +{ + /// + /// This is the model that will be used. This is optional and will default to the correct model for the voiceId. + /// + [JsonPropertyName("model")] + public FallbackCartesiaVoiceModel? Model { get; set; } + + /// + /// This is the language that will be used. This is optional and will default to the correct language for the voiceId. + /// + [JsonPropertyName("language")] + public FallbackCartesiaVoiceLanguage? Language { get; set; } + + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required string VoiceId { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackCartesiaVoiceLanguage.cs b/src/Vapi.Net/Types/FallbackCartesiaVoiceLanguage.cs new file mode 100644 index 0000000..8067ace --- /dev/null +++ b/src/Vapi.Net/Types/FallbackCartesiaVoiceLanguage.cs @@ -0,0 +1,56 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackCartesiaVoiceLanguage +{ + [EnumMember(Value = "en")] + En, + + [EnumMember(Value = "de")] + De, + + [EnumMember(Value = "es")] + Es, + + [EnumMember(Value = "fr")] + Fr, + + [EnumMember(Value = "ja")] + Ja, + + [EnumMember(Value = "pt")] + Pt, + + [EnumMember(Value = "zh")] + Zh, + + [EnumMember(Value = "hi")] + Hi, + + [EnumMember(Value = "it")] + It, + + [EnumMember(Value = "ko")] + Ko, + + [EnumMember(Value = "nl")] + Nl, + + [EnumMember(Value = "pl")] + Pl, + + [EnumMember(Value = "ru")] + Ru, + + [EnumMember(Value = "sv")] + Sv, + + [EnumMember(Value = "tr")] + Tr, +} diff --git a/src/Vapi.Net/Types/FallbackCartesiaVoiceModel.cs b/src/Vapi.Net/Types/FallbackCartesiaVoiceModel.cs new file mode 100644 index 0000000..1cff06e --- /dev/null +++ b/src/Vapi.Net/Types/FallbackCartesiaVoiceModel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackCartesiaVoiceModel +{ + [EnumMember(Value = "sonic-english")] + SonicEnglish, + + [EnumMember(Value = "sonic-multilingual")] + SonicMultilingual, +} diff --git a/src/Vapi.Net/Types/FallbackCustomVoice.cs b/src/Vapi.Net/Types/FallbackCustomVoice.cs new file mode 100644 index 0000000..c89f069 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackCustomVoice.cs @@ -0,0 +1,47 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackCustomVoice +{ + /// + /// This is where the voice request will be sent. + /// + /// Request Example: + /// + /// POST https://{server.url} + /// Content-Type: application/json + /// + /// { + /// "message": { + /// "type": "voice-request", + /// "text": "Hello, world!", + /// "sampleRate": 24000, + /// ...other metadata about the call... + /// } + /// } + /// + /// Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified in the request. Here is how the response will be piped to the transport: + /// ``` + /// response.on('data', (chunk: Buffer) => { + /// outputStream.write(chunk); + /// }); + /// ``` + /// + [JsonPropertyName("server")] + public required Server Server { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackDeepgramVoice.cs b/src/Vapi.Net/Types/FallbackDeepgramVoice.cs new file mode 100644 index 0000000..1a184bb --- /dev/null +++ b/src/Vapi.Net/Types/FallbackDeepgramVoice.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackDeepgramVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackDeepgramVoiceIdEnum.cs b/src/Vapi.Net/Types/FallbackDeepgramVoiceIdEnum.cs new file mode 100644 index 0000000..a091d47 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackDeepgramVoiceIdEnum.cs @@ -0,0 +1,47 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackDeepgramVoiceIdEnum +{ + [EnumMember(Value = "asteria")] + Asteria, + + [EnumMember(Value = "luna")] + Luna, + + [EnumMember(Value = "stella")] + Stella, + + [EnumMember(Value = "athena")] + Athena, + + [EnumMember(Value = "hera")] + Hera, + + [EnumMember(Value = "orion")] + Orion, + + [EnumMember(Value = "arcas")] + Arcas, + + [EnumMember(Value = "perseus")] + Perseus, + + [EnumMember(Value = "angus")] + Angus, + + [EnumMember(Value = "orpheus")] + Orpheus, + + [EnumMember(Value = "helios")] + Helios, + + [EnumMember(Value = "zeus")] + Zeus, +} diff --git a/src/Vapi.Net/Types/FallbackElevenLabsVoice.cs b/src/Vapi.Net/Types/FallbackElevenLabsVoice.cs new file mode 100644 index 0000000..393cce6 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackElevenLabsVoice.cs @@ -0,0 +1,77 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackElevenLabsVoice +{ + /// + /// This is the provider-specific ID that will be used. Ensure the Voice is present in your 11Labs Voice Library. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// Defines the stability for voice settings. + /// + [JsonPropertyName("stability")] + public double? Stability { get; set; } + + /// + /// Defines the similarity boost for voice settings. + /// + [JsonPropertyName("similarityBoost")] + public double? SimilarityBoost { get; set; } + + /// + /// Defines the style for voice settings. + /// + [JsonPropertyName("style")] + public double? Style { get; set; } + + /// + /// Defines the use speaker boost for voice settings. + /// + [JsonPropertyName("useSpeakerBoost")] + public bool? UseSpeakerBoost { get; set; } + + /// + /// Defines the optimize streaming latency for voice settings. Defaults to 3. + /// + [JsonPropertyName("optimizeStreamingLatency")] + public double? OptimizeStreamingLatency { get; set; } + + /// + /// This enables the use of https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation. Defaults to false to save latency. + /// + /// @default false + /// + [JsonPropertyName("enableSsmlParsing")] + public bool? EnableSsmlParsing { get; set; } + + /// + /// This is the model that will be used. Defaults to 'eleven_turbo_v2' if not specified. + /// + [JsonPropertyName("model")] + public FallbackElevenLabsVoiceModel? Model { get; set; } + + /// + /// This is the language (ISO 639-1) that is enforced for the model. Currently only Turbo v2.5 supports language enforcement. For other models, an error will be returned if language code is provided. + /// + [JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackElevenLabsVoiceIdEnum.cs b/src/Vapi.Net/Types/FallbackElevenLabsVoiceIdEnum.cs new file mode 100644 index 0000000..545ac95 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackElevenLabsVoiceIdEnum.cs @@ -0,0 +1,56 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackElevenLabsVoiceIdEnum +{ + [EnumMember(Value = "burt")] + Burt, + + [EnumMember(Value = "marissa")] + Marissa, + + [EnumMember(Value = "andrea")] + Andrea, + + [EnumMember(Value = "sarah")] + Sarah, + + [EnumMember(Value = "phillip")] + Phillip, + + [EnumMember(Value = "steve")] + Steve, + + [EnumMember(Value = "joseph")] + Joseph, + + [EnumMember(Value = "myra")] + Myra, + + [EnumMember(Value = "paula")] + Paula, + + [EnumMember(Value = "ryan")] + Ryan, + + [EnumMember(Value = "drew")] + Drew, + + [EnumMember(Value = "paul")] + Paul, + + [EnumMember(Value = "mrb")] + Mrb, + + [EnumMember(Value = "matilda")] + Matilda, + + [EnumMember(Value = "mark")] + Mark, +} diff --git a/src/Vapi.Net/Types/FallbackElevenLabsVoiceModel.cs b/src/Vapi.Net/Types/FallbackElevenLabsVoiceModel.cs new file mode 100644 index 0000000..b24270d --- /dev/null +++ b/src/Vapi.Net/Types/FallbackElevenLabsVoiceModel.cs @@ -0,0 +1,23 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackElevenLabsVoiceModel +{ + [EnumMember(Value = "eleven_multilingual_v2")] + ElevenMultilingualV2, + + [EnumMember(Value = "eleven_turbo_v2")] + ElevenTurboV2, + + [EnumMember(Value = "eleven_turbo_v2_5")] + ElevenTurboV25, + + [EnumMember(Value = "eleven_monolingual_v1")] + ElevenMonolingualV1, +} diff --git a/src/Vapi.Net/Types/FallbackLmntVoice.cs b/src/Vapi.Net/Types/FallbackLmntVoice.cs new file mode 100644 index 0000000..c37d6fd --- /dev/null +++ b/src/Vapi.Net/Types/FallbackLmntVoice.cs @@ -0,0 +1,33 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackLmntVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the speed multiplier that will be used. + /// + [JsonPropertyName("speed")] + public double? Speed { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackLmntVoiceIdEnum.cs b/src/Vapi.Net/Types/FallbackLmntVoiceIdEnum.cs new file mode 100644 index 0000000..5b78985 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackLmntVoiceIdEnum.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackLmntVoiceIdEnum +{ + [EnumMember(Value = "lily")] + Lily, + + [EnumMember(Value = "daniel")] + Daniel, +} diff --git a/src/Vapi.Net/Types/FallbackNeetsVoice.cs b/src/Vapi.Net/Types/FallbackNeetsVoice.cs new file mode 100644 index 0000000..9f72f4f --- /dev/null +++ b/src/Vapi.Net/Types/FallbackNeetsVoice.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackNeetsVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackNeetsVoiceIdEnum.cs b/src/Vapi.Net/Types/FallbackNeetsVoiceIdEnum.cs new file mode 100644 index 0000000..f6b3e9f --- /dev/null +++ b/src/Vapi.Net/Types/FallbackNeetsVoiceIdEnum.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackNeetsVoiceIdEnum +{ + [EnumMember(Value = "vits")] + Vits, +} diff --git a/src/Vapi.Net/Types/FallbackOpenAiVoice.cs b/src/Vapi.Net/Types/FallbackOpenAiVoice.cs new file mode 100644 index 0000000..2203862 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackOpenAiVoice.cs @@ -0,0 +1,33 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackOpenAiVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// Please note that ash, ballad, coral, sage, and verse may only be used with the `gpt-4o-realtime-preview-2024-10-01` model. + /// + [JsonPropertyName("voiceId")] + public required FallbackOpenAiVoiceId VoiceId { get; set; } + + /// + /// This is the speed multiplier that will be used. + /// + [JsonPropertyName("speed")] + public double? Speed { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackOpenAiVoiceId.cs b/src/Vapi.Net/Types/FallbackOpenAiVoiceId.cs new file mode 100644 index 0000000..1d9d048 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackOpenAiVoiceId.cs @@ -0,0 +1,44 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackOpenAiVoiceId +{ + [EnumMember(Value = "alloy")] + Alloy, + + [EnumMember(Value = "echo")] + Echo, + + [EnumMember(Value = "fable")] + Fable, + + [EnumMember(Value = "onyx")] + Onyx, + + [EnumMember(Value = "nova")] + Nova, + + [EnumMember(Value = "shimmer")] + Shimmer, + + [EnumMember(Value = "ash")] + Ash, + + [EnumMember(Value = "ballad")] + Ballad, + + [EnumMember(Value = "coral")] + Coral, + + [EnumMember(Value = "sage")] + Sage, + + [EnumMember(Value = "verse")] + Verse, +} diff --git a/src/Vapi.Net/Types/FallbackPlan.cs b/src/Vapi.Net/Types/FallbackPlan.cs new file mode 100644 index 0000000..c4bd0bc --- /dev/null +++ b/src/Vapi.Net/Types/FallbackPlan.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackPlan +{ + /// + /// This is the list of voices to fallback to in the event that the primary voice provider fails. + /// + [JsonPropertyName("voices")] + public IEnumerable Voices { get; set; } = new List(); + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackPlayHtVoice.cs b/src/Vapi.Net/Types/FallbackPlayHtVoice.cs new file mode 100644 index 0000000..c632e90 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackPlayHtVoice.cs @@ -0,0 +1,75 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackPlayHtVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the speed multiplier that will be used. + /// + [JsonPropertyName("speed")] + public double? Speed { get; set; } + + /// + /// A floating point number between 0, exclusive, and 2, inclusive. If equal to null or not provided, the model's default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice. + /// + [JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// An emotion to be applied to the speech. + /// + [JsonPropertyName("emotion")] + public FallbackPlayHtVoiceEmotion? Emotion { get; set; } + + /// + /// A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices. + /// + [JsonPropertyName("voiceGuidance")] + public double? VoiceGuidance { get; set; } + + /// + /// A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance. + /// + [JsonPropertyName("styleGuidance")] + public double? StyleGuidance { get; set; } + + /// + /// A number between 1 and 2. This number influences how closely the generated speech adheres to the input text. Use lower values to create more fluid speech, but with a higher chance of deviating from the input text. Higher numbers will make the generated speech more accurate to the input text, ensuring that the words spoken align closely with the provided text. + /// + [JsonPropertyName("textGuidance")] + public double? TextGuidance { get; set; } + + /// + /// Playht voice model/engine to use. + /// + [JsonPropertyName("model")] + public FallbackPlayHtVoiceModel? Model { get; set; } + + /// + /// The language to use for the speech. + /// + [JsonPropertyName("language")] + public FallbackPlayHtVoiceLanguage? Language { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackPlayHtVoiceEmotion.cs b/src/Vapi.Net/Types/FallbackPlayHtVoiceEmotion.cs new file mode 100644 index 0000000..33628a9 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackPlayHtVoiceEmotion.cs @@ -0,0 +1,47 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackPlayHtVoiceEmotion +{ + [EnumMember(Value = "female_happy")] + FemaleHappy, + + [EnumMember(Value = "female_sad")] + FemaleSad, + + [EnumMember(Value = "female_angry")] + FemaleAngry, + + [EnumMember(Value = "female_fearful")] + FemaleFearful, + + [EnumMember(Value = "female_disgust")] + FemaleDisgust, + + [EnumMember(Value = "female_surprised")] + FemaleSurprised, + + [EnumMember(Value = "male_happy")] + MaleHappy, + + [EnumMember(Value = "male_sad")] + MaleSad, + + [EnumMember(Value = "male_angry")] + MaleAngry, + + [EnumMember(Value = "male_fearful")] + MaleFearful, + + [EnumMember(Value = "male_disgust")] + MaleDisgust, + + [EnumMember(Value = "male_surprised")] + MaleSurprised, +} diff --git a/src/Vapi.Net/Types/FallbackPlayHtVoiceIdEnum.cs b/src/Vapi.Net/Types/FallbackPlayHtVoiceIdEnum.cs new file mode 100644 index 0000000..13e879a --- /dev/null +++ b/src/Vapi.Net/Types/FallbackPlayHtVoiceIdEnum.cs @@ -0,0 +1,41 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackPlayHtVoiceIdEnum +{ + [EnumMember(Value = "jennifer")] + Jennifer, + + [EnumMember(Value = "melissa")] + Melissa, + + [EnumMember(Value = "will")] + Will, + + [EnumMember(Value = "chris")] + Chris, + + [EnumMember(Value = "matt")] + Matt, + + [EnumMember(Value = "jack")] + Jack, + + [EnumMember(Value = "ruby")] + Ruby, + + [EnumMember(Value = "davis")] + Davis, + + [EnumMember(Value = "donna")] + Donna, + + [EnumMember(Value = "michael")] + Michael, +} diff --git a/src/Vapi.Net/Types/FallbackPlayHtVoiceLanguage.cs b/src/Vapi.Net/Types/FallbackPlayHtVoiceLanguage.cs new file mode 100644 index 0000000..3f63e8d --- /dev/null +++ b/src/Vapi.Net/Types/FallbackPlayHtVoiceLanguage.cs @@ -0,0 +1,122 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackPlayHtVoiceLanguage +{ + [EnumMember(Value = "afrikaans")] + Afrikaans, + + [EnumMember(Value = "albanian")] + Albanian, + + [EnumMember(Value = "amharic")] + Amharic, + + [EnumMember(Value = "arabic")] + Arabic, + + [EnumMember(Value = "bengali")] + Bengali, + + [EnumMember(Value = "bulgarian")] + Bulgarian, + + [EnumMember(Value = "catalan")] + Catalan, + + [EnumMember(Value = "croatian")] + Croatian, + + [EnumMember(Value = "czech")] + Czech, + + [EnumMember(Value = "danish")] + Danish, + + [EnumMember(Value = "dutch")] + Dutch, + + [EnumMember(Value = "english")] + English, + + [EnumMember(Value = "french")] + French, + + [EnumMember(Value = "galician")] + Galician, + + [EnumMember(Value = "german")] + German, + + [EnumMember(Value = "greek")] + Greek, + + [EnumMember(Value = "hebrew")] + Hebrew, + + [EnumMember(Value = "hindi")] + Hindi, + + [EnumMember(Value = "hungarian")] + Hungarian, + + [EnumMember(Value = "indonesian")] + Indonesian, + + [EnumMember(Value = "italian")] + Italian, + + [EnumMember(Value = "japanese")] + Japanese, + + [EnumMember(Value = "korean")] + Korean, + + [EnumMember(Value = "malay")] + Malay, + + [EnumMember(Value = "mandarin")] + Mandarin, + + [EnumMember(Value = "polish")] + Polish, + + [EnumMember(Value = "portuguese")] + Portuguese, + + [EnumMember(Value = "russian")] + Russian, + + [EnumMember(Value = "serbian")] + Serbian, + + [EnumMember(Value = "spanish")] + Spanish, + + [EnumMember(Value = "swedish")] + Swedish, + + [EnumMember(Value = "tagalog")] + Tagalog, + + [EnumMember(Value = "thai")] + Thai, + + [EnumMember(Value = "turkish")] + Turkish, + + [EnumMember(Value = "ukrainian")] + Ukrainian, + + [EnumMember(Value = "urdu")] + Urdu, + + [EnumMember(Value = "xhosa")] + Xhosa, +} diff --git a/src/Vapi.Net/Types/FallbackPlayHtVoiceModel.cs b/src/Vapi.Net/Types/FallbackPlayHtVoiceModel.cs new file mode 100644 index 0000000..24accca --- /dev/null +++ b/src/Vapi.Net/Types/FallbackPlayHtVoiceModel.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackPlayHtVoiceModel +{ + [EnumMember(Value = "PlayHT2.0")] + PlayHt20, + + [EnumMember(Value = "PlayHT2.0-turbo")] + PlayHt20Turbo, + + [EnumMember(Value = "Play3.0-mini")] + Play30Mini, +} diff --git a/src/Vapi.Net/Types/FallbackRimeAiVoice.cs b/src/Vapi.Net/Types/FallbackRimeAiVoice.cs new file mode 100644 index 0000000..3b93657 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackRimeAiVoice.cs @@ -0,0 +1,39 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackRimeAiVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the model that will be used. Defaults to 'v1' when not specified. + /// + [JsonPropertyName("model")] + public FallbackRimeAiVoiceModel? Model { get; set; } + + /// + /// This is the speed multiplier that will be used. + /// + [JsonPropertyName("speed")] + public double? Speed { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FallbackRimeAiVoiceIdEnum.cs b/src/Vapi.Net/Types/FallbackRimeAiVoiceIdEnum.cs new file mode 100644 index 0000000..679b242 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackRimeAiVoiceIdEnum.cs @@ -0,0 +1,254 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackRimeAiVoiceIdEnum +{ + [EnumMember(Value = "marsh")] + Marsh, + + [EnumMember(Value = "bayou")] + Bayou, + + [EnumMember(Value = "creek")] + Creek, + + [EnumMember(Value = "brook")] + Brook, + + [EnumMember(Value = "flower")] + Flower, + + [EnumMember(Value = "spore")] + Spore, + + [EnumMember(Value = "glacier")] + Glacier, + + [EnumMember(Value = "gulch")] + Gulch, + + [EnumMember(Value = "alpine")] + Alpine, + + [EnumMember(Value = "cove")] + Cove, + + [EnumMember(Value = "lagoon")] + Lagoon, + + [EnumMember(Value = "tundra")] + Tundra, + + [EnumMember(Value = "steppe")] + Steppe, + + [EnumMember(Value = "mesa")] + Mesa, + + [EnumMember(Value = "grove")] + Grove, + + [EnumMember(Value = "rainforest")] + Rainforest, + + [EnumMember(Value = "moraine")] + Moraine, + + [EnumMember(Value = "wildflower")] + Wildflower, + + [EnumMember(Value = "peak")] + Peak, + + [EnumMember(Value = "boulder")] + Boulder, + + [EnumMember(Value = "abbie")] + Abbie, + + [EnumMember(Value = "allison")] + Allison, + + [EnumMember(Value = "ally")] + Ally, + + [EnumMember(Value = "alona")] + Alona, + + [EnumMember(Value = "amber")] + Amber, + + [EnumMember(Value = "ana")] + Ana, + + [EnumMember(Value = "antoine")] + Antoine, + + [EnumMember(Value = "armon")] + Armon, + + [EnumMember(Value = "brenda")] + Brenda, + + [EnumMember(Value = "brittany")] + Brittany, + + [EnumMember(Value = "carol")] + Carol, + + [EnumMember(Value = "colin")] + Colin, + + [EnumMember(Value = "courtney")] + Courtney, + + [EnumMember(Value = "elena")] + Elena, + + [EnumMember(Value = "elliot")] + Elliot, + + [EnumMember(Value = "eva")] + Eva, + + [EnumMember(Value = "geoff")] + Geoff, + + [EnumMember(Value = "gerald")] + Gerald, + + [EnumMember(Value = "hank")] + Hank, + + [EnumMember(Value = "helen")] + Helen, + + [EnumMember(Value = "hera")] + Hera, + + [EnumMember(Value = "jen")] + Jen, + + [EnumMember(Value = "joe")] + Joe, + + [EnumMember(Value = "joy")] + Joy, + + [EnumMember(Value = "juan")] + Juan, + + [EnumMember(Value = "kendra")] + Kendra, + + [EnumMember(Value = "kendrick")] + Kendrick, + + [EnumMember(Value = "kenneth")] + Kenneth, + + [EnumMember(Value = "kevin")] + Kevin, + + [EnumMember(Value = "kris")] + Kris, + + [EnumMember(Value = "linda")] + Linda, + + [EnumMember(Value = "madison")] + Madison, + + [EnumMember(Value = "marge")] + Marge, + + [EnumMember(Value = "marina")] + Marina, + + [EnumMember(Value = "marissa")] + Marissa, + + [EnumMember(Value = "marta")] + Marta, + + [EnumMember(Value = "maya")] + Maya, + + [EnumMember(Value = "nicholas")] + Nicholas, + + [EnumMember(Value = "nyles")] + Nyles, + + [EnumMember(Value = "phil")] + Phil, + + [EnumMember(Value = "reba")] + Reba, + + [EnumMember(Value = "rex")] + Rex, + + [EnumMember(Value = "rick")] + Rick, + + [EnumMember(Value = "ritu")] + Ritu, + + [EnumMember(Value = "rob")] + Rob, + + [EnumMember(Value = "rodney")] + Rodney, + + [EnumMember(Value = "rohan")] + Rohan, + + [EnumMember(Value = "rosco")] + Rosco, + + [EnumMember(Value = "samantha")] + Samantha, + + [EnumMember(Value = "sandy")] + Sandy, + + [EnumMember(Value = "selena")] + Selena, + + [EnumMember(Value = "seth")] + Seth, + + [EnumMember(Value = "sharon")] + Sharon, + + [EnumMember(Value = "stan")] + Stan, + + [EnumMember(Value = "tamra")] + Tamra, + + [EnumMember(Value = "tanya")] + Tanya, + + [EnumMember(Value = "tibur")] + Tibur, + + [EnumMember(Value = "tj")] + Tj, + + [EnumMember(Value = "tyler")] + Tyler, + + [EnumMember(Value = "viv")] + Viv, + + [EnumMember(Value = "yadira")] + Yadira, +} diff --git a/src/Vapi.Net/Types/FallbackRimeAiVoiceModel.cs b/src/Vapi.Net/Types/FallbackRimeAiVoiceModel.cs new file mode 100644 index 0000000..d860ede --- /dev/null +++ b/src/Vapi.Net/Types/FallbackRimeAiVoiceModel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum FallbackRimeAiVoiceModel +{ + [EnumMember(Value = "v1")] + V1, + + [EnumMember(Value = "mist")] + Mist, +} diff --git a/src/Vapi.Net/Types/FallbackTavusVoice.cs b/src/Vapi.Net/Types/FallbackTavusVoice.cs new file mode 100644 index 0000000..fe927c3 --- /dev/null +++ b/src/Vapi.Net/Types/FallbackTavusVoice.cs @@ -0,0 +1,63 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record FallbackTavusVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the unique identifier for the persona that the replica will use in the conversation. + /// + [JsonPropertyName("personaId")] + public string? PersonaId { get; set; } + + /// + /// This is the url that will receive webhooks with updates regarding the conversation state. + /// + [JsonPropertyName("callbackUrl")] + public string? CallbackUrl { get; set; } + + /// + /// This is the name for the conversation. + /// + [JsonPropertyName("conversationName")] + public string? ConversationName { get; set; } + + /// + /// This is the context that will be appended to any context provided in the persona, if one is provided. + /// + [JsonPropertyName("conversationalContext")] + public string? ConversationalContext { get; set; } + + /// + /// This is the custom greeting that the replica will give once a participant joines the conversation. + /// + [JsonPropertyName("customGreeting")] + public string? CustomGreeting { get; set; } + + /// + /// These are optional properties used to customize the conversation. + /// + [JsonPropertyName("properties")] + public TavusConversationProperties? Properties { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/FileStatus.cs b/src/Vapi.Net/Types/FileStatus.cs index feb6508..f666e41 100644 --- a/src/Vapi.Net/Types/FileStatus.cs +++ b/src/Vapi.Net/Types/FileStatus.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum FileStatus { [EnumMember(Value = "indexed")] diff --git a/src/Vapi.Net/Types/FormatPlan.cs b/src/Vapi.Net/Types/FormatPlan.cs index d551f36..259b151 100644 --- a/src/Vapi.Net/Types/FormatPlan.cs +++ b/src/Vapi.Net/Types/FormatPlan.cs @@ -11,9 +11,7 @@ public record FormatPlan /// This determines whether the chunk is formatted before being sent to the voice provider. This helps with enunciation. This includes phone numbers, emails and addresses. Default `true`. /// /// Usage: - /// /// - To rely on the voice provider's formatting logic, set this to `false`. - /// - To use ElevenLabs's `enableSsmlParsing` feature, set this to `false`. /// /// If `voice.chunkPlan.enabled` is `false`, this is automatically `false` since there's no chunk to format. /// @@ -26,11 +24,9 @@ public record FormatPlan /// This is the cutoff after which a number is converted to individual digits instead of being spoken as words. /// /// Example: - /// /// - If cutoff 2025, "12345" is converted to "1 2 3 4 5" while "1200" is converted to "twelve hundred". /// /// Usage: - /// /// - If your use case doesn't involve IDs like zip codes, set this to a high value. /// - If your use case involves IDs that are shorter than 5 digits, set this to a lower value. /// @@ -43,7 +39,6 @@ public record FormatPlan /// These are the custom replacements you can make to the chunk before it is sent to the voice provider. /// /// Usage: - /// /// - To replace a specific word or phrase with a different word or phrase, use the `ExactReplacement` type. Eg. `{ type: 'exact', key: 'hello', value: 'hi' }` /// - To replace a word or phrase that matches a pattern, use the `RegexReplacement` type. Eg. `{ type: 'regex', regex: '\\b[a-zA-Z]{5}\\b', value: 'hi' }` /// diff --git a/src/Vapi.Net/Types/FunctionToolWithToolCall.cs b/src/Vapi.Net/Types/FunctionToolWithToolCall.cs index d59492e..79c4f3e 100644 --- a/src/Vapi.Net/Types/FunctionToolWithToolCall.cs +++ b/src/Vapi.Net/Types/FunctionToolWithToolCall.cs @@ -27,6 +27,12 @@ public record FunctionToolWithToolCall [JsonPropertyName("messages")] public IEnumerable? Messages { get; set; } + /// + /// The type of tool. "function" for Function tool. + /// + [JsonPropertyName("type")] + public required string Type { get; set; } + [JsonPropertyName("toolCall")] public required ToolCall ToolCall { get; set; } diff --git a/src/Vapi.Net/Types/GcpCredential.cs b/src/Vapi.Net/Types/GcpCredential.cs index d328fda..cfb472d 100644 --- a/src/Vapi.Net/Types/GcpCredential.cs +++ b/src/Vapi.Net/Types/GcpCredential.cs @@ -35,13 +35,13 @@ public record GcpCredential public required DateTime UpdatedAt { get; set; } /// - /// This is the name of the GCP credential. This is just for your reference. + /// This is the name of credential. This is just for your reference. /// [JsonPropertyName("name")] public string? Name { get; set; } /// - /// This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details//keys. + /// This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. /// /// The schema is identical to the JSON that GCP outputs. /// diff --git a/src/Vapi.Net/Types/GhlToolWithToolCall.cs b/src/Vapi.Net/Types/GhlToolWithToolCall.cs index 4f42981..718c52b 100644 --- a/src/Vapi.Net/Types/GhlToolWithToolCall.cs +++ b/src/Vapi.Net/Types/GhlToolWithToolCall.cs @@ -27,6 +27,12 @@ public record GhlToolWithToolCall [JsonPropertyName("messages")] public IEnumerable? Messages { get; set; } + /// + /// The type of tool. "ghl" for GHL tool. + /// + [JsonPropertyName("type")] + public required string Type { get; set; } + [JsonPropertyName("toolCall")] public required ToolCall ToolCall { get; set; } diff --git a/src/Vapi.Net/Types/GladiaCredential.cs b/src/Vapi.Net/Types/GladiaCredential.cs index 54f84bb..41cbfaf 100644 --- a/src/Vapi.Net/Types/GladiaCredential.cs +++ b/src/Vapi.Net/Types/GladiaCredential.cs @@ -40,6 +40,12 @@ public record GladiaCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/GladiaTranscriberLanguage.cs b/src/Vapi.Net/Types/GladiaTranscriberLanguage.cs index b69edf2..ac9cbe7 100644 --- a/src/Vapi.Net/Types/GladiaTranscriberLanguage.cs +++ b/src/Vapi.Net/Types/GladiaTranscriberLanguage.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum GladiaTranscriberLanguage { [EnumMember(Value = "af")] diff --git a/src/Vapi.Net/Types/GladiaTranscriberLanguageBehaviour.cs b/src/Vapi.Net/Types/GladiaTranscriberLanguageBehaviour.cs index 80caabd..c374251 100644 --- a/src/Vapi.Net/Types/GladiaTranscriberLanguageBehaviour.cs +++ b/src/Vapi.Net/Types/GladiaTranscriberLanguageBehaviour.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum GladiaTranscriberLanguageBehaviour { [EnumMember(Value = "manual")] diff --git a/src/Vapi.Net/Types/GladiaTranscriberModel.cs b/src/Vapi.Net/Types/GladiaTranscriberModel.cs index beb1cf0..e16054b 100644 --- a/src/Vapi.Net/Types/GladiaTranscriberModel.cs +++ b/src/Vapi.Net/Types/GladiaTranscriberModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum GladiaTranscriberModel { [EnumMember(Value = "fast")] diff --git a/src/Vapi.Net/Types/GoHighLevelCredential.cs b/src/Vapi.Net/Types/GoHighLevelCredential.cs index fb4d6c1..4796efb 100644 --- a/src/Vapi.Net/Types/GoHighLevelCredential.cs +++ b/src/Vapi.Net/Types/GoHighLevelCredential.cs @@ -40,6 +40,12 @@ public record GoHighLevelCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/GoogleCredential.cs b/src/Vapi.Net/Types/GoogleCredential.cs new file mode 100644 index 0000000..58f2f73 --- /dev/null +++ b/src/Vapi.Net/Types/GoogleCredential.cs @@ -0,0 +1,56 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record GoogleCredential +{ + /// + /// This is the key for Gemini in Google AI Studio. Get it from here: https://aistudio.google.com/app/apikey + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/GoogleModel.cs b/src/Vapi.Net/Types/GoogleModel.cs new file mode 100644 index 0000000..288ca1a --- /dev/null +++ b/src/Vapi.Net/Types/GoogleModel.cs @@ -0,0 +1,86 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record GoogleModel +{ + /// + /// This is the starting state for the conversation. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// These are the tools that the assistant can use during the call. To use existing tools, use `toolIds`. + /// + /// Both `tools` and `toolIds` can be used together. + /// + [JsonPropertyName("tools")] + public IEnumerable? Tools { get; set; } + + /// + /// These are the tools that the assistant can use during the call. To use transient tools, use `tools`. + /// + /// Both `tools` and `toolIds` can be used together. + /// + [JsonPropertyName("toolIds")] + public IEnumerable? ToolIds { get; set; } + + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + + /// + /// This is the Google model that will be used. + /// + [JsonPropertyName("model")] + public required GoogleModelModel Model { get; set; } + + /// + /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// + [JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + /// + [JsonPropertyName("maxTokens")] + public double? MaxTokens { get; set; } + + /// + /// This determines whether we detect user's emotion while they speak and send it as an additional info to model. + /// + /// Default `false` because the model is usually are good at understanding the user's emotion from text. + /// + /// @default false + /// + [JsonPropertyName("emotionRecognitionEnabled")] + public bool? EmotionRecognitionEnabled { get; set; } + + /// + /// This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + /// + /// Default is 0. + /// + /// @default 0 + /// + [JsonPropertyName("numFastTurns")] + public double? NumFastTurns { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/GoogleModelModel.cs b/src/Vapi.Net/Types/GoogleModelModel.cs new file mode 100644 index 0000000..f4c5a7d --- /dev/null +++ b/src/Vapi.Net/Types/GoogleModelModel.cs @@ -0,0 +1,26 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum GoogleModelModel +{ + [EnumMember(Value = "gemini-1.5-flash")] + Gemini15Flash, + + [EnumMember(Value = "gemini-1.5-flash-002")] + Gemini15Flash002, + + [EnumMember(Value = "gemini-1.5-pro")] + Gemini15Pro, + + [EnumMember(Value = "gemini-1.5-pro-002")] + Gemini15Pro002, + + [EnumMember(Value = "gemini-1.0-pro")] + Gemini10Pro, +} diff --git a/src/Vapi.Net/Types/GroqCredential.cs b/src/Vapi.Net/Types/GroqCredential.cs index b44b557..3021135 100644 --- a/src/Vapi.Net/Types/GroqCredential.cs +++ b/src/Vapi.Net/Types/GroqCredential.cs @@ -40,6 +40,12 @@ public record GroqCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/GroqModel.cs b/src/Vapi.Net/Types/GroqModel.cs index 2894aa5..7b1bf23 100644 --- a/src/Vapi.Net/Types/GroqModel.cs +++ b/src/Vapi.Net/Types/GroqModel.cs @@ -29,6 +29,18 @@ public record GroqModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b /// @@ -41,12 +53,6 @@ public record GroqModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/GroqModelModel.cs b/src/Vapi.Net/Types/GroqModelModel.cs index b1546e1..3499a11 100644 --- a/src/Vapi.Net/Types/GroqModelModel.cs +++ b/src/Vapi.Net/Types/GroqModelModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum GroqModelModel { [EnumMember(Value = "llama-3.1-405b-reasoning")] diff --git a/src/Vapi.Net/Types/HandoffStep.cs b/src/Vapi.Net/Types/HandoffStep.cs index 2eaafd5..d794b5f 100644 --- a/src/Vapi.Net/Types/HandoffStep.cs +++ b/src/Vapi.Net/Types/HandoffStep.cs @@ -36,12 +36,11 @@ public record HandoffStep /// /// Example: /// { - /// "name": "John Doe", - /// "age": 20 + /// "name": "John Doe", + /// "age": 20 /// } /// /// You can reference any variable in the context of the current block: - /// /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) /// - "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1) /// - "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2) @@ -51,35 +50,34 @@ public record HandoffStep /// /// Example: /// { - /// "name": "{{my-tool-call-step.output.name}}", - /// "age": "{{my-tool-call-step.input.age}}", - /// "date": "{{workflow.input.date}}" + /// "name": "{{my-tool-call-step.output.name}}", + /// "age": "{{my-tool-call-step.input.age}}", + /// "date": "{{workflow.input.date}}" /// } /// /// You can dynamically change the key name. /// /// Example: /// { - /// "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", - /// "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", - /// "{{workflow.input.key-name-for-date}}": "{{date}}" + /// "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", + /// "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", + /// "{{workflow.input.key-name-for-date}}": "{{date}}" /// } /// /// You can represent the value as a string, number, boolean, array, or object. /// /// Example: /// { - /// "name": "john", - /// "age": 20, - /// "date": "2021-01-01", - /// "metadata": { - /// "unique-key": "{{my-tool-call-step.output.unique-key}}" - /// }, - /// "array": ["A", "B", "C"], + /// "name": "john", + /// "age": 20, + /// "date": "2021-01-01", + /// "metadata": { + /// "unique-key": "{{my-tool-call-step.output.unique-key}}" + /// }, + /// "array": ["A", "B", "C"], /// } /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow. /// diff --git a/src/Vapi.Net/Types/HipaaBuyDto.cs b/src/Vapi.Net/Types/HipaaBuyDto.cs new file mode 100644 index 0000000..b7e425a --- /dev/null +++ b/src/Vapi.Net/Types/HipaaBuyDto.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record HipaaBuyDto +{ + /// + /// This is the name of the recipient. + /// + [JsonPropertyName("recipientName")] + public required string RecipientName { get; set; } + + /// + /// This is the name of the recipient organization. + /// + [JsonPropertyName("recipientOrganization")] + public required string RecipientOrganization { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/ImportTwilioPhoneNumberDto.cs b/src/Vapi.Net/Types/ImportTwilioPhoneNumberDto.cs index a1ab59e..8fbac7d 100644 --- a/src/Vapi.Net/Types/ImportTwilioPhoneNumberDto.cs +++ b/src/Vapi.Net/Types/ImportTwilioPhoneNumberDto.cs @@ -9,7 +9,6 @@ public record ImportTwilioPhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -64,7 +63,7 @@ public record ImportTwilioPhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/ImportVonagePhoneNumberDto.cs b/src/Vapi.Net/Types/ImportVonagePhoneNumberDto.cs index 74245df..cde0879 100644 --- a/src/Vapi.Net/Types/ImportVonagePhoneNumberDto.cs +++ b/src/Vapi.Net/Types/ImportVonagePhoneNumberDto.cs @@ -9,7 +9,6 @@ public record ImportVonagePhoneNumberDto { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -60,7 +59,7 @@ public record ImportVonagePhoneNumberDto /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/InflectionAiCredential.cs b/src/Vapi.Net/Types/InflectionAiCredential.cs new file mode 100644 index 0000000..fb8eeb8 --- /dev/null +++ b/src/Vapi.Net/Types/InflectionAiCredential.cs @@ -0,0 +1,56 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record InflectionAiCredential +{ + /// + /// This is the api key for Pi in InflectionAI's console. Get it from here: https://developers.inflection.ai/keys, billing will need to be setup + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/InflectionAiModel.cs b/src/Vapi.Net/Types/InflectionAiModel.cs new file mode 100644 index 0000000..23b9176 --- /dev/null +++ b/src/Vapi.Net/Types/InflectionAiModel.cs @@ -0,0 +1,86 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record InflectionAiModel +{ + /// + /// This is the starting state for the conversation. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// These are the tools that the assistant can use during the call. To use existing tools, use `toolIds`. + /// + /// Both `tools` and `toolIds` can be used together. + /// + [JsonPropertyName("tools")] + public IEnumerable? Tools { get; set; } + + /// + /// These are the tools that the assistant can use during the call. To use transient tools, use `tools`. + /// + /// Both `tools` and `toolIds` can be used together. + /// + [JsonPropertyName("toolIds")] + public IEnumerable? ToolIds { get; set; } + + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + + /// + /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + /// + [JsonPropertyName("model")] + public required string Model { get; set; } + + /// + /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// + [JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + /// + [JsonPropertyName("maxTokens")] + public double? MaxTokens { get; set; } + + /// + /// This determines whether we detect user's emotion while they speak and send it as an additional info to model. + /// + /// Default `false` because the model is usually are good at understanding the user's emotion from text. + /// + /// @default false + /// + [JsonPropertyName("emotionRecognitionEnabled")] + public bool? EmotionRecognitionEnabled { get; set; } + + /// + /// This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + /// + /// Default is 0. + /// + /// @default 0 + /// + [JsonPropertyName("numFastTurns")] + public double? NumFastTurns { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/InviteUserDto.cs b/src/Vapi.Net/Types/InviteUserDto.cs index 868f6ed..30fd1ad 100644 --- a/src/Vapi.Net/Types/InviteUserDto.cs +++ b/src/Vapi.Net/Types/InviteUserDto.cs @@ -7,8 +7,8 @@ namespace Vapi.Net; public record InviteUserDto { - [JsonPropertyName("email")] - public required string Email { get; set; } + [JsonPropertyName("emails")] + public IEnumerable Emails { get; set; } = new List(); [JsonPropertyName("role")] public required InviteUserDtoRole Role { get; set; } diff --git a/src/Vapi.Net/Types/InviteUserDtoRole.cs b/src/Vapi.Net/Types/InviteUserDtoRole.cs index 55fd870..1ba3dfb 100644 --- a/src/Vapi.Net/Types/InviteUserDtoRole.cs +++ b/src/Vapi.Net/Types/InviteUserDtoRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum InviteUserDtoRole { [EnumMember(Value = "admin")] diff --git a/src/Vapi.Net/Types/JsonSchemaType.cs b/src/Vapi.Net/Types/JsonSchemaType.cs index 350a3c7..0beb963 100644 --- a/src/Vapi.Net/Types/JsonSchemaType.cs +++ b/src/Vapi.Net/Types/JsonSchemaType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum JsonSchemaType { [EnumMember(Value = "string")] diff --git a/src/Vapi.Net/Types/KnowledgeBase.cs b/src/Vapi.Net/Types/KnowledgeBase.cs deleted file mode 100644 index a896d22..0000000 --- a/src/Vapi.Net/Types/KnowledgeBase.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Text.Json.Serialization; -using Vapi.Net.Core; - -#nullable enable - -namespace Vapi.Net; - -public record KnowledgeBase -{ - [JsonPropertyName("provider")] - public required string Provider { get; set; } - - [JsonPropertyName("topK")] - public double? TopK { get; set; } - - [JsonPropertyName("fileIds")] - public IEnumerable FileIds { get; set; } = new List(); - - public override string ToString() - { - return JsonUtils.Serialize(this); - } -} diff --git a/src/Vapi.Net/Types/KnowledgeBaseResponseDocument.cs b/src/Vapi.Net/Types/KnowledgeBaseResponseDocument.cs new file mode 100644 index 0000000..6d30197 --- /dev/null +++ b/src/Vapi.Net/Types/KnowledgeBaseResponseDocument.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record KnowledgeBaseResponseDocument +{ + /// + /// This is the content of the document. + /// + [JsonPropertyName("content")] + public required string Content { get; set; } + + /// + /// This is the similarity score of the document. + /// + [JsonPropertyName("similarity")] + public required double Similarity { get; set; } + + /// + /// This is the uuid of the document. + /// + [JsonPropertyName("uuid")] + public string? Uuid { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/LangfuseCredential.cs b/src/Vapi.Net/Types/LangfuseCredential.cs new file mode 100644 index 0000000..9074569 --- /dev/null +++ b/src/Vapi.Net/Types/LangfuseCredential.cs @@ -0,0 +1,65 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record LangfuseCredential +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// The public key for Langfuse project. Eg: pk-lf-... + /// + [JsonPropertyName("publicKey")] + public required string PublicKey { get; set; } + + /// + /// The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// The host URL for Langfuse project. Eg: https://cloud.langfuse.com + /// + [JsonPropertyName("apiUrl")] + public required string ApiUrl { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/LmntCredential.cs b/src/Vapi.Net/Types/LmntCredential.cs index 6b69fb4..c93dc0a 100644 --- a/src/Vapi.Net/Types/LmntCredential.cs +++ b/src/Vapi.Net/Types/LmntCredential.cs @@ -40,6 +40,12 @@ public record LmntCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/LmntVoice.cs b/src/Vapi.Net/Types/LmntVoice.cs index 71fd320..286307a 100644 --- a/src/Vapi.Net/Types/LmntVoice.cs +++ b/src/Vapi.Net/Types/LmntVoice.cs @@ -8,14 +8,6 @@ namespace Vapi.Net; public record LmntVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. /// @@ -34,6 +26,12 @@ public record LmntVoice [JsonPropertyName("chunkPlan")] public ChunkPlan? ChunkPlan { get; set; } + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/LmntVoiceIdEnum.cs b/src/Vapi.Net/Types/LmntVoiceIdEnum.cs index cb5f36d..a017947 100644 --- a/src/Vapi.Net/Types/LmntVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/LmntVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum LmntVoiceIdEnum { [EnumMember(Value = "lily")] diff --git a/src/Vapi.Net/Types/Log.cs b/src/Vapi.Net/Types/Log.cs index b20e8a2..d427bed 100644 --- a/src/Vapi.Net/Types/Log.cs +++ b/src/Vapi.Net/Types/Log.cs @@ -11,7 +11,7 @@ public record Log /// This is the timestamp at which the log was written. /// [JsonPropertyName("time")] - public required double Time { get; set; } + public required string Time { get; set; } /// /// This is the unique identifier for the org that this log belongs to. @@ -25,6 +25,12 @@ public record Log [JsonPropertyName("type")] public required LogType Type { get; set; } + /// + /// This is the type of the webhook, given the log is from a webhook. + /// + [JsonPropertyName("webhookType")] + public string? WebhookType { get; set; } + /// /// This is the specific resource, relevant only to API logs. /// diff --git a/src/Vapi.Net/Types/LogRequestHttpMethod.cs b/src/Vapi.Net/Types/LogRequestHttpMethod.cs index d181044..6c3e93f 100644 --- a/src/Vapi.Net/Types/LogRequestHttpMethod.cs +++ b/src/Vapi.Net/Types/LogRequestHttpMethod.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum LogRequestHttpMethod { [EnumMember(Value = "POST")] diff --git a/src/Vapi.Net/Types/LogResource.cs b/src/Vapi.Net/Types/LogResource.cs index 05d68b2..07a48e9 100644 --- a/src/Vapi.Net/Types/LogResource.cs +++ b/src/Vapi.Net/Types/LogResource.cs @@ -6,18 +6,42 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum LogResource { + [EnumMember(Value = "org")] + Org, + [EnumMember(Value = "assistant")] Assistant, + [EnumMember(Value = "analytics")] + Analytics, + + [EnumMember(Value = "credential")] + Credential, + [EnumMember(Value = "phone-number")] PhoneNumber, + [EnumMember(Value = "block")] + Block, + + [EnumMember(Value = "voice-library")] + VoiceLibrary, + + [EnumMember(Value = "provider")] + Provider, + [EnumMember(Value = "tool")] Tool, + [EnumMember(Value = "token")] + Token, + + [EnumMember(Value = "template")] + Template, + [EnumMember(Value = "squad")] Squad, diff --git a/src/Vapi.Net/Types/LogType.cs b/src/Vapi.Net/Types/LogType.cs index ce29970..f69f861 100644 --- a/src/Vapi.Net/Types/LogType.cs +++ b/src/Vapi.Net/Types/LogType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum LogType { [EnumMember(Value = "API")] diff --git a/src/Vapi.Net/Types/MakeCredential.cs b/src/Vapi.Net/Types/MakeCredential.cs index 8b54908..0bcc0ae 100644 --- a/src/Vapi.Net/Types/MakeCredential.cs +++ b/src/Vapi.Net/Types/MakeCredential.cs @@ -52,6 +52,12 @@ public record MakeCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/MakeToolWithToolCall.cs b/src/Vapi.Net/Types/MakeToolWithToolCall.cs index 5f40b4c..745d90a 100644 --- a/src/Vapi.Net/Types/MakeToolWithToolCall.cs +++ b/src/Vapi.Net/Types/MakeToolWithToolCall.cs @@ -27,6 +27,12 @@ public record MakeToolWithToolCall [JsonPropertyName("messages")] public IEnumerable? Messages { get; set; } + /// + /// The type of tool. "make" for Make tool. + /// + [JsonPropertyName("type")] + public required string Type { get; set; } + [JsonPropertyName("toolCall")] public required ToolCall ToolCall { get; set; } diff --git a/src/Vapi.Net/Types/MessagePlan.cs b/src/Vapi.Net/Types/MessagePlan.cs index 26d24bd..c33b55a 100644 --- a/src/Vapi.Net/Types/MessagePlan.cs +++ b/src/Vapi.Net/Types/MessagePlan.cs @@ -11,7 +11,6 @@ public record MessagePlan /// This are the messages that the assistant will speak when the user hasn't responded for `idleTimeoutSeconds`. Each time the timeout is triggered, a random message will be chosen from this array. /// /// Usage: - /// /// - If user gets distracted and doesn't respond for a while, this can be used to grab their attention. /// - If the transcriber doesn't pick up what the user said, this can be used to ask the user to repeat themselves. (From the perspective of the assistant, the conversation is idle since it didn't "hear" any user messages.) /// diff --git a/src/Vapi.Net/Types/ModelBasedCondition.cs b/src/Vapi.Net/Types/ModelBasedCondition.cs index 24300d5..273b2b5 100644 --- a/src/Vapi.Net/Types/ModelBasedCondition.cs +++ b/src/Vapi.Net/Types/ModelBasedCondition.cs @@ -11,7 +11,6 @@ public record ModelBasedCondition /// This is the instruction which should output a boolean value when passed to a model. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "{{output.your-property-name}}" for current step's output /// - "{{input.your-property-name}}" for current step's input /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) @@ -22,18 +21,15 @@ public record ModelBasedCondition /// - "{{global.your-property-name}}" for the global context /// /// You can also talk about the current step's output or input directly: - /// /// - "{{output.your-property-name}} is greater than 10" /// - "{{input.your-property-name}} is greater than 10" /// /// Examples: - /// - /// - "{{input.age}} is greater than 10" - /// - "{{input.age}} is greater than {{input.age2}}" - /// - "{{output.age}} is greater than 10" + /// - "{{input.age}} is greater than 10" + /// - "{{input.age}} is greater than {{input.age2}}" + /// - "{{output.age}} is greater than 10" /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/ModelCost.cs b/src/Vapi.Net/Types/ModelCost.cs index 10ecb30..6296bd8 100644 --- a/src/Vapi.Net/Types/ModelCost.cs +++ b/src/Vapi.Net/Types/ModelCost.cs @@ -11,13 +11,12 @@ public record ModelCost /// This is the model that was used during the call. /// /// This matches one of the following: - /// /// - `call.assistant.model`, - /// - `call.assistantId->model`, + /// - `call.assistantId->model`, /// - `call.squad[n].assistant.model`, - /// - `call.squad[n].assistantId->model`, - /// - `call.squadId->[n].assistant.model`, - /// - `call.squadId->[n].assistantId->model`. + /// - `call.squad[n].assistantId->model`, + /// - `call.squadId->[n].assistant.model`, + /// - `call.squadId->[n].assistantId->model`. /// [JsonPropertyName("model")] public object Model { get; set; } = new Dictionary(); diff --git a/src/Vapi.Net/Types/NeetsVoice.cs b/src/Vapi.Net/Types/NeetsVoice.cs index 1856d60..447fc58 100644 --- a/src/Vapi.Net/Types/NeetsVoice.cs +++ b/src/Vapi.Net/Types/NeetsVoice.cs @@ -8,14 +8,6 @@ namespace Vapi.Net; public record NeetsVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. /// @@ -28,6 +20,12 @@ public record NeetsVoice [JsonPropertyName("chunkPlan")] public ChunkPlan? ChunkPlan { get; set; } + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/NeetsVoiceIdEnum.cs b/src/Vapi.Net/Types/NeetsVoiceIdEnum.cs index 79528a9..316d03a 100644 --- a/src/Vapi.Net/Types/NeetsVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/NeetsVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum NeetsVoiceIdEnum { [EnumMember(Value = "vits")] diff --git a/src/Vapi.Net/Types/OAuth2AuthenticationPlan.cs b/src/Vapi.Net/Types/OAuth2AuthenticationPlan.cs new file mode 100644 index 0000000..713f7dc --- /dev/null +++ b/src/Vapi.Net/Types/OAuth2AuthenticationPlan.cs @@ -0,0 +1,35 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record OAuth2AuthenticationPlan +{ + [JsonPropertyName("type")] + public required string Type { get; set; } + + /// + /// This is the OAuth2 URL. + /// + [JsonPropertyName("url")] + public required string Url { get; set; } + + /// + /// This is the OAuth2 client ID. + /// + [JsonPropertyName("clientId")] + public required string ClientId { get; set; } + + /// + /// This is the OAuth2 client secret. + /// + [JsonPropertyName("clientSecret")] + public required string ClientSecret { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/Oauth2AuthenticationSession.cs b/src/Vapi.Net/Types/Oauth2AuthenticationSession.cs new file mode 100644 index 0000000..925e8b0 --- /dev/null +++ b/src/Vapi.Net/Types/Oauth2AuthenticationSession.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record Oauth2AuthenticationSession +{ + /// + /// This is the OAuth2 access token. + /// + [JsonPropertyName("accessToken")] + public string? AccessToken { get; set; } + + /// + /// This is the OAuth2 access token expiration. + /// + [JsonPropertyName("expiresAt")] + public DateTime? ExpiresAt { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/OpenAiCredential.cs b/src/Vapi.Net/Types/OpenAiCredential.cs index 7b59637..3757b9a 100644 --- a/src/Vapi.Net/Types/OpenAiCredential.cs +++ b/src/Vapi.Net/Types/OpenAiCredential.cs @@ -40,6 +40,12 @@ public record OpenAiCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/OpenAiFunction.cs b/src/Vapi.Net/Types/OpenAiFunction.cs index b908084..7da5685 100644 --- a/src/Vapi.Net/Types/OpenAiFunction.cs +++ b/src/Vapi.Net/Types/OpenAiFunction.cs @@ -7,6 +7,14 @@ namespace Vapi.Net; public record OpenAiFunction { + /// + /// This is a boolean that controls whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is true. Learn more about Structured Outputs in the [OpenAI guide](https://openai.com/index/introducing-structured-outputs-in-the-api/). + /// + /// @default false + /// + [JsonPropertyName("strict")] + public bool? Strict { get; set; } + /// /// This is the the name of the function to be called. /// @@ -15,6 +23,9 @@ public record OpenAiFunction [JsonPropertyName("name")] public required string Name { get; set; } + /// + /// This is the description of what the function does, used by the AI to choose when and how to call the function. + /// [JsonPropertyName("description")] public string? Description { get; set; } diff --git a/src/Vapi.Net/Types/OpenAiMessageRole.cs b/src/Vapi.Net/Types/OpenAiMessageRole.cs index d55efbc..fb257f1 100644 --- a/src/Vapi.Net/Types/OpenAiMessageRole.cs +++ b/src/Vapi.Net/Types/OpenAiMessageRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum OpenAiMessageRole { [EnumMember(Value = "assistant")] diff --git a/src/Vapi.Net/Types/OpenAiModel.cs b/src/Vapi.Net/Types/OpenAiModel.cs index b7879b3..301a553 100644 --- a/src/Vapi.Net/Types/OpenAiModel.cs +++ b/src/Vapi.Net/Types/OpenAiModel.cs @@ -29,6 +29,18 @@ public record OpenAiModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the OpenAI model that will be used. /// @@ -50,12 +62,6 @@ public record OpenAiModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/OpenAiModelFallbackModelsItem.cs b/src/Vapi.Net/Types/OpenAiModelFallbackModelsItem.cs index 4ac68db..3eb351b 100644 --- a/src/Vapi.Net/Types/OpenAiModelFallbackModelsItem.cs +++ b/src/Vapi.Net/Types/OpenAiModelFallbackModelsItem.cs @@ -6,9 +6,12 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum OpenAiModelFallbackModelsItem { + [EnumMember(Value = "gpt-4o-realtime-preview-2024-10-01")] + Gpt4ORealtimePreview20241001, + [EnumMember(Value = "gpt-4o-mini")] Gpt4OMini, @@ -24,6 +27,9 @@ public enum OpenAiModelFallbackModelsItem [EnumMember(Value = "gpt-4o-2024-08-06")] Gpt4O20240806, + [EnumMember(Value = "gpt-4o-2024-11-20")] + Gpt4O20241120, + [EnumMember(Value = "gpt-4-turbo")] Gpt4Turbo, diff --git a/src/Vapi.Net/Types/OpenAiModelModel.cs b/src/Vapi.Net/Types/OpenAiModelModel.cs index cadf12a..701a228 100644 --- a/src/Vapi.Net/Types/OpenAiModelModel.cs +++ b/src/Vapi.Net/Types/OpenAiModelModel.cs @@ -6,9 +6,12 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum OpenAiModelModel { + [EnumMember(Value = "gpt-4o-realtime-preview-2024-10-01")] + Gpt4ORealtimePreview20241001, + [EnumMember(Value = "gpt-4o-mini")] Gpt4OMini, @@ -24,6 +27,9 @@ public enum OpenAiModelModel [EnumMember(Value = "gpt-4o-2024-08-06")] Gpt4O20240806, + [EnumMember(Value = "gpt-4o-2024-11-20")] + Gpt4O20241120, + [EnumMember(Value = "gpt-4-turbo")] Gpt4Turbo, diff --git a/src/Vapi.Net/Types/OpenAiVoice.cs b/src/Vapi.Net/Types/OpenAiVoice.cs index d23cc87..258075d 100644 --- a/src/Vapi.Net/Types/OpenAiVoice.cs +++ b/src/Vapi.Net/Types/OpenAiVoice.cs @@ -7,16 +7,9 @@ namespace Vapi.Net; public record OpenAiVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. + /// Please note that ash, ballad, coral, sage, and verse may only be used with the `gpt-4o-realtime-preview-2024-10-01` model. /// [JsonPropertyName("voiceId")] public required OpenAiVoiceId VoiceId { get; set; } @@ -33,6 +26,12 @@ public record OpenAiVoice [JsonPropertyName("chunkPlan")] public ChunkPlan? ChunkPlan { get; set; } + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/OpenAiVoiceId.cs b/src/Vapi.Net/Types/OpenAiVoiceId.cs index 89c189f..30501ec 100644 --- a/src/Vapi.Net/Types/OpenAiVoiceId.cs +++ b/src/Vapi.Net/Types/OpenAiVoiceId.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum OpenAiVoiceId { [EnumMember(Value = "alloy")] @@ -26,4 +26,19 @@ public enum OpenAiVoiceId [EnumMember(Value = "shimmer")] Shimmer, + + [EnumMember(Value = "ash")] + Ash, + + [EnumMember(Value = "ballad")] + Ballad, + + [EnumMember(Value = "coral")] + Coral, + + [EnumMember(Value = "sage")] + Sage, + + [EnumMember(Value = "verse")] + Verse, } diff --git a/src/Vapi.Net/Types/OpenRouterCredential.cs b/src/Vapi.Net/Types/OpenRouterCredential.cs index 3b1b009..30ab03b 100644 --- a/src/Vapi.Net/Types/OpenRouterCredential.cs +++ b/src/Vapi.Net/Types/OpenRouterCredential.cs @@ -40,6 +40,12 @@ public record OpenRouterCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/OpenRouterModel.cs b/src/Vapi.Net/Types/OpenRouterModel.cs index f64316f..729571a 100644 --- a/src/Vapi.Net/Types/OpenRouterModel.cs +++ b/src/Vapi.Net/Types/OpenRouterModel.cs @@ -29,6 +29,18 @@ public record OpenRouterModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b /// @@ -41,12 +53,6 @@ public record OpenRouterModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/Org.cs b/src/Vapi.Net/Types/Org.cs index 8b8f4c4..36a05d3 100644 --- a/src/Vapi.Net/Types/Org.cs +++ b/src/Vapi.Net/Types/Org.cs @@ -15,6 +15,15 @@ public record Org [JsonPropertyName("hipaaEnabled")] public bool? HipaaEnabled { get; set; } + [JsonPropertyName("subscription")] + public Subscription? Subscription { get; set; } + + /// + /// This is the ID of the subscription the org belongs to. + /// + [JsonPropertyName("subscriptionId")] + public string? SubscriptionId { get; set; } + /// /// This is the unique identifier for the org. /// @@ -75,6 +84,12 @@ public record Org [JsonPropertyName("name")] public string? Name { get; set; } + /// + /// This is the channel of the org. There is the cluster the API traffic for the org will be directed. + /// + [JsonPropertyName("channel")] + public OrgChannel? Channel { get; set; } + /// /// This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. /// diff --git a/src/Vapi.Net/Types/OrgChannel.cs b/src/Vapi.Net/Types/OrgChannel.cs new file mode 100644 index 0000000..12e24f5 --- /dev/null +++ b/src/Vapi.Net/Types/OrgChannel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum OrgChannel +{ + [EnumMember(Value = "default")] + Default, + + [EnumMember(Value = "weekly")] + Weekly, +} diff --git a/src/Vapi.Net/Types/OrgWithOrgUser.cs b/src/Vapi.Net/Types/OrgWithOrgUser.cs new file mode 100644 index 0000000..4634c11 --- /dev/null +++ b/src/Vapi.Net/Types/OrgWithOrgUser.cs @@ -0,0 +1,129 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record OrgWithOrgUser +{ + /// + /// When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + /// When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be available for LLM and Voice respectively. + /// This is due to the compliance requirements of HIPAA. Other providers may not meet these requirements. + /// + [JsonPropertyName("hipaaEnabled")] + public bool? HipaaEnabled { get; set; } + + [JsonPropertyName("subscription")] + public Subscription? Subscription { get; set; } + + /// + /// This is the ID of the subscription the org belongs to. + /// + [JsonPropertyName("subscriptionId")] + public string? SubscriptionId { get; set; } + + /// + /// This is the unique identifier for the org. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the org was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the org was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the Stripe customer for the org. + /// + [JsonPropertyName("stripeCustomerId")] + public string? StripeCustomerId { get; set; } + + /// + /// This is the subscription for the org. + /// + [JsonPropertyName("stripeSubscriptionId")] + public string? StripeSubscriptionId { get; set; } + + /// + /// This is the subscription's subscription item. + /// + [JsonPropertyName("stripeSubscriptionItemId")] + public string? StripeSubscriptionItemId { get; set; } + + /// + /// This is the subscription's current period start. + /// + [JsonPropertyName("stripeSubscriptionCurrentPeriodStart")] + public DateTime? StripeSubscriptionCurrentPeriodStart { get; set; } + + /// + /// This is the subscription's status. + /// + [JsonPropertyName("stripeSubscriptionStatus")] + public string? StripeSubscriptionStatus { get; set; } + + /// + /// This is the plan for the org. + /// + [JsonPropertyName("plan")] + public OrgPlan? Plan { get; set; } + + /// + /// This is the name of the org. This is just for your own reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// This is the channel of the org. There is the cluster the API traffic for the org will be directed. + /// + [JsonPropertyName("channel")] + public OrgWithOrgUserChannel? Channel { get; set; } + + /// + /// This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. + /// + [JsonPropertyName("billingLimit")] + public double? BillingLimit { get; set; } + + /// + /// This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + /// + /// All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation. + /// + [JsonPropertyName("serverUrl")] + public string? ServerUrl { get; set; } + + /// + /// This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + /// + [JsonPropertyName("serverUrlSecret")] + public string? ServerUrlSecret { get; set; } + + /// + /// This is the concurrency limit for the org. This is the maximum number of calls that can be active at any given time. To go beyond 10, please contact us at support@vapi.ai. + /// + [JsonPropertyName("concurrencyLimit")] + public double? ConcurrencyLimit { get; set; } + + [JsonPropertyName("invitedByUserId")] + public string? InvitedByUserId { get; set; } + + [JsonPropertyName("role")] + public OrgWithOrgUserRole? Role { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/OrgWithOrgUserChannel.cs b/src/Vapi.Net/Types/OrgWithOrgUserChannel.cs new file mode 100644 index 0000000..6580df4 --- /dev/null +++ b/src/Vapi.Net/Types/OrgWithOrgUserChannel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum OrgWithOrgUserChannel +{ + [EnumMember(Value = "default")] + Default, + + [EnumMember(Value = "weekly")] + Weekly, +} diff --git a/src/Vapi.Net/Types/OrgWithOrgUserRole.cs b/src/Vapi.Net/Types/OrgWithOrgUserRole.cs new file mode 100644 index 0000000..2b8045c --- /dev/null +++ b/src/Vapi.Net/Types/OrgWithOrgUserRole.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum OrgWithOrgUserRole +{ + [EnumMember(Value = "admin")] + Admin, + + [EnumMember(Value = "editor")] + Editor, + + [EnumMember(Value = "viewer")] + Viewer, +} diff --git a/src/Vapi.Net/Types/Payment.cs b/src/Vapi.Net/Types/Payment.cs new file mode 100644 index 0000000..6302b02 --- /dev/null +++ b/src/Vapi.Net/Types/Payment.cs @@ -0,0 +1,94 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record Payment +{ + /// + /// This is the id of the payment + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the id of the org + /// + [JsonPropertyName("orgId")] + public string? OrgId { get; set; } + + /// + /// This is the total cost of the payment, which is the sum of all the costs in the costs object. + /// + /// Note: this is a string to avoid floating point precision issues. + /// + [JsonPropertyName("cost")] + public required string Cost { get; set; } + + /// + /// This is the itemized breakdown of payment amounts + /// + [JsonPropertyName("costs")] + public IEnumerable Costs { get; set; } = new List(); + + /// + /// This is the status of the payment + /// + [JsonPropertyName("status")] + public required PaymentStatus Status { get; set; } + + /// + /// This is the timestamp when the payment was created + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the timestamp when the payment was last updated + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This indicates if this payment was automatically generated by the auto-reload feature + /// + [JsonPropertyName("isAutoReload")] + public required bool IsAutoReload { get; set; } + + /// + /// This is the id of the subscription the payment belongs to + /// + [JsonPropertyName("subscriptionId")] + public required string SubscriptionId { get; set; } + + /// + /// This is the id of the call + /// + [JsonPropertyName("callId")] + public string? CallId { get; set; } + + /// + /// This is the id of the purchased phone number + /// + [JsonPropertyName("phoneNumberId")] + public string? PhoneNumberId { get; set; } + + /// + /// This is the id of the associated stripe payment intent + /// + [JsonPropertyName("stripePaymentIntentId")] + public string? StripePaymentIntentId { get; set; } + + /// + /// This is the id of the associated stripe invoice + /// + [JsonPropertyName("stripeInvoiceId")] + public string? StripeInvoiceId { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/PaymentRetryDto.cs b/src/Vapi.Net/Types/PaymentRetryDto.cs new file mode 100644 index 0000000..1df12ba --- /dev/null +++ b/src/Vapi.Net/Types/PaymentRetryDto.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record PaymentRetryDto +{ + /// + /// This is the payment ID to retry. + /// + [JsonPropertyName("paymentId")] + public required string PaymentId { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/PaymentStatus.cs b/src/Vapi.Net/Types/PaymentStatus.cs new file mode 100644 index 0000000..fd9eda1 --- /dev/null +++ b/src/Vapi.Net/Types/PaymentStatus.cs @@ -0,0 +1,23 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum PaymentStatus +{ + [EnumMember(Value = "past-due")] + PastDue, + + [EnumMember(Value = "pending")] + Pending, + + [EnumMember(Value = "finalized")] + Finalized, + + [EnumMember(Value = "refunded")] + Refunded, +} diff --git a/src/Vapi.Net/Types/PaymentsPaginatedResponse.cs b/src/Vapi.Net/Types/PaymentsPaginatedResponse.cs new file mode 100644 index 0000000..1a627e0 --- /dev/null +++ b/src/Vapi.Net/Types/PaymentsPaginatedResponse.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record PaymentsPaginatedResponse +{ + [JsonPropertyName("results")] + public IEnumerable Results { get; set; } = new List(); + + [JsonPropertyName("metadata")] + public required PaginationMeta Metadata { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/PerplexityAiCredential.cs b/src/Vapi.Net/Types/PerplexityAiCredential.cs index dab4b25..a217fcc 100644 --- a/src/Vapi.Net/Types/PerplexityAiCredential.cs +++ b/src/Vapi.Net/Types/PerplexityAiCredential.cs @@ -40,6 +40,12 @@ public record PerplexityAiCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/PerplexityAiModel.cs b/src/Vapi.Net/Types/PerplexityAiModel.cs index bd8da80..46ba1f7 100644 --- a/src/Vapi.Net/Types/PerplexityAiModel.cs +++ b/src/Vapi.Net/Types/PerplexityAiModel.cs @@ -29,6 +29,18 @@ public record PerplexityAiModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b /// @@ -41,12 +53,6 @@ public record PerplexityAiModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/PhoneNumberPaginatedResponse.cs b/src/Vapi.Net/Types/PhoneNumberPaginatedResponse.cs new file mode 100644 index 0000000..6980766 --- /dev/null +++ b/src/Vapi.Net/Types/PhoneNumberPaginatedResponse.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record PhoneNumberPaginatedResponse +{ + /// + /// A list of phone numbers, which can be of any provider type. + /// + [JsonPropertyName("results")] + public IEnumerable Results { get; set; } = new List(); + + /// + /// Metadata about the pagination. + /// + [JsonPropertyName("metadata")] + public required PaginationMeta Metadata { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/PlayHtCredential.cs b/src/Vapi.Net/Types/PlayHtCredential.cs index 071c787..1b215d0 100644 --- a/src/Vapi.Net/Types/PlayHtCredential.cs +++ b/src/Vapi.Net/Types/PlayHtCredential.cs @@ -40,6 +40,12 @@ public record PlayHtCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + [JsonPropertyName("userId")] public required string UserId { get; set; } diff --git a/src/Vapi.Net/Types/PlayHtVoice.cs b/src/Vapi.Net/Types/PlayHtVoice.cs index fd86fbe..bbce0df 100644 --- a/src/Vapi.Net/Types/PlayHtVoice.cs +++ b/src/Vapi.Net/Types/PlayHtVoice.cs @@ -8,14 +8,6 @@ namespace Vapi.Net; public record PlayHtVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. /// @@ -58,12 +50,30 @@ public record PlayHtVoice [JsonPropertyName("textGuidance")] public double? TextGuidance { get; set; } + /// + /// Playht voice model/engine to use. + /// + [JsonPropertyName("model")] + public PlayHtVoiceModel? Model { get; set; } + + /// + /// The language to use for the speech. + /// + [JsonPropertyName("language")] + public PlayHtVoiceLanguage? Language { get; set; } + /// /// This is the plan for chunking the model output before it is sent to the voice provider. /// [JsonPropertyName("chunkPlan")] public ChunkPlan? ChunkPlan { get; set; } + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/PlayHtVoiceEmotion.cs b/src/Vapi.Net/Types/PlayHtVoiceEmotion.cs index 2ad054e..0760288 100644 --- a/src/Vapi.Net/Types/PlayHtVoiceEmotion.cs +++ b/src/Vapi.Net/Types/PlayHtVoiceEmotion.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum PlayHtVoiceEmotion { [EnumMember(Value = "female_happy")] diff --git a/src/Vapi.Net/Types/PlayHtVoiceIdEnum.cs b/src/Vapi.Net/Types/PlayHtVoiceIdEnum.cs index f792846..c3c76b8 100644 --- a/src/Vapi.Net/Types/PlayHtVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/PlayHtVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum PlayHtVoiceIdEnum { [EnumMember(Value = "jennifer")] diff --git a/src/Vapi.Net/Types/PlayHtVoiceLanguage.cs b/src/Vapi.Net/Types/PlayHtVoiceLanguage.cs new file mode 100644 index 0000000..bfb3d4a --- /dev/null +++ b/src/Vapi.Net/Types/PlayHtVoiceLanguage.cs @@ -0,0 +1,122 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum PlayHtVoiceLanguage +{ + [EnumMember(Value = "afrikaans")] + Afrikaans, + + [EnumMember(Value = "albanian")] + Albanian, + + [EnumMember(Value = "amharic")] + Amharic, + + [EnumMember(Value = "arabic")] + Arabic, + + [EnumMember(Value = "bengali")] + Bengali, + + [EnumMember(Value = "bulgarian")] + Bulgarian, + + [EnumMember(Value = "catalan")] + Catalan, + + [EnumMember(Value = "croatian")] + Croatian, + + [EnumMember(Value = "czech")] + Czech, + + [EnumMember(Value = "danish")] + Danish, + + [EnumMember(Value = "dutch")] + Dutch, + + [EnumMember(Value = "english")] + English, + + [EnumMember(Value = "french")] + French, + + [EnumMember(Value = "galician")] + Galician, + + [EnumMember(Value = "german")] + German, + + [EnumMember(Value = "greek")] + Greek, + + [EnumMember(Value = "hebrew")] + Hebrew, + + [EnumMember(Value = "hindi")] + Hindi, + + [EnumMember(Value = "hungarian")] + Hungarian, + + [EnumMember(Value = "indonesian")] + Indonesian, + + [EnumMember(Value = "italian")] + Italian, + + [EnumMember(Value = "japanese")] + Japanese, + + [EnumMember(Value = "korean")] + Korean, + + [EnumMember(Value = "malay")] + Malay, + + [EnumMember(Value = "mandarin")] + Mandarin, + + [EnumMember(Value = "polish")] + Polish, + + [EnumMember(Value = "portuguese")] + Portuguese, + + [EnumMember(Value = "russian")] + Russian, + + [EnumMember(Value = "serbian")] + Serbian, + + [EnumMember(Value = "spanish")] + Spanish, + + [EnumMember(Value = "swedish")] + Swedish, + + [EnumMember(Value = "tagalog")] + Tagalog, + + [EnumMember(Value = "thai")] + Thai, + + [EnumMember(Value = "turkish")] + Turkish, + + [EnumMember(Value = "ukrainian")] + Ukrainian, + + [EnumMember(Value = "urdu")] + Urdu, + + [EnumMember(Value = "xhosa")] + Xhosa, +} diff --git a/src/Vapi.Net/Types/PlayHtVoiceModel.cs b/src/Vapi.Net/Types/PlayHtVoiceModel.cs new file mode 100644 index 0000000..e82a9e0 --- /dev/null +++ b/src/Vapi.Net/Types/PlayHtVoiceModel.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum PlayHtVoiceModel +{ + [EnumMember(Value = "PlayHT2.0")] + PlayHt20, + + [EnumMember(Value = "PlayHT2.0-turbo")] + PlayHt20Turbo, + + [EnumMember(Value = "Play3.0-mini")] + Play30Mini, +} diff --git a/src/Vapi.Net/Types/PunctuationBoundary.cs b/src/Vapi.Net/Types/PunctuationBoundary.cs index 676d9aa..fc7b3a6 100644 --- a/src/Vapi.Net/Types/PunctuationBoundary.cs +++ b/src/Vapi.Net/Types/PunctuationBoundary.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum PunctuationBoundary { [EnumMember(Value = "。")] diff --git a/src/Vapi.Net/Types/RegexOption.cs b/src/Vapi.Net/Types/RegexOption.cs index 165e5c8..792373a 100644 --- a/src/Vapi.Net/Types/RegexOption.cs +++ b/src/Vapi.Net/Types/RegexOption.cs @@ -9,8 +9,7 @@ public record RegexOption { /// /// This is the type of the regex option. Options are: - /// - /// - `ignore-case`: Ignores the case of the text being matched. + /// - `ignore-case`: Ignores the case of the text being matched. Add /// - `whole-word`: Matches whole words only. /// - `multi-line`: Matches across multiple lines. /// diff --git a/src/Vapi.Net/Types/RegexOptionType.cs b/src/Vapi.Net/Types/RegexOptionType.cs index f19fad0..e436fca 100644 --- a/src/Vapi.Net/Types/RegexOptionType.cs +++ b/src/Vapi.Net/Types/RegexOptionType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum RegexOptionType { [EnumMember(Value = "ignore-case")] diff --git a/src/Vapi.Net/Types/RegexReplacement.cs b/src/Vapi.Net/Types/RegexReplacement.cs index 750f175..2fb1a15 100644 --- a/src/Vapi.Net/Types/RegexReplacement.cs +++ b/src/Vapi.Net/Types/RegexReplacement.cs @@ -9,12 +9,18 @@ public record RegexReplacement { /// /// This is the regex pattern to replace. + /// + /// Note: + /// - This works by using the `string.replace` method in Node.JS. Eg. `"hello there".replace(/hello/g, "hi")` will return `"hi there"`. + /// + /// Hot tip: + /// - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. /// [JsonPropertyName("regex")] public required string Regex { get; set; } /// - /// These are the options for the regex replacement. Default all options are disabled. + /// These are the options for the regex replacement. Defaults to all disabled. /// /// @default [] /// diff --git a/src/Vapi.Net/Types/RimeAiCredential.cs b/src/Vapi.Net/Types/RimeAiCredential.cs index 7d4092a..71a2d70 100644 --- a/src/Vapi.Net/Types/RimeAiCredential.cs +++ b/src/Vapi.Net/Types/RimeAiCredential.cs @@ -40,6 +40,12 @@ public record RimeAiCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/RimeAiVoice.cs b/src/Vapi.Net/Types/RimeAiVoice.cs index 03fee16..41a5a61 100644 --- a/src/Vapi.Net/Types/RimeAiVoice.cs +++ b/src/Vapi.Net/Types/RimeAiVoice.cs @@ -8,14 +8,6 @@ namespace Vapi.Net; public record RimeAiVoice { - /// - /// This determines whether fillers are injected into the model output before inputting it into the voice provider. - /// - /// Default `false` because you can achieve better results with prompting the model. - /// - [JsonPropertyName("fillerInjectionEnabled")] - public bool? FillerInjectionEnabled { get; set; } - /// /// This is the provider-specific ID that will be used. /// @@ -40,6 +32,12 @@ public record RimeAiVoice [JsonPropertyName("chunkPlan")] public ChunkPlan? ChunkPlan { get; set; } + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/RimeAiVoiceIdEnum.cs b/src/Vapi.Net/Types/RimeAiVoiceIdEnum.cs index 63c7475..67c4847 100644 --- a/src/Vapi.Net/Types/RimeAiVoiceIdEnum.cs +++ b/src/Vapi.Net/Types/RimeAiVoiceIdEnum.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum RimeAiVoiceIdEnum { [EnumMember(Value = "marsh")] diff --git a/src/Vapi.Net/Types/RimeAiVoiceModel.cs b/src/Vapi.Net/Types/RimeAiVoiceModel.cs index 27e0319..60e716f 100644 --- a/src/Vapi.Net/Types/RimeAiVoiceModel.cs +++ b/src/Vapi.Net/Types/RimeAiVoiceModel.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum RimeAiVoiceModel { [EnumMember(Value = "v1")] diff --git a/src/Vapi.Net/Types/RuleBasedCondition.cs b/src/Vapi.Net/Types/RuleBasedCondition.cs index 34e105a..82079c2 100644 --- a/src/Vapi.Net/Types/RuleBasedCondition.cs +++ b/src/Vapi.Net/Types/RuleBasedCondition.cs @@ -19,7 +19,6 @@ public record RuleBasedCondition /// This is the left side of the operation. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "{{output.your-property-name}}" for current step's output /// - "{{input.your-property-name}}" for current step's input /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) @@ -30,18 +29,15 @@ public record RuleBasedCondition /// - "{{global.your-property-name}}" for the global context /// /// Or, you can use a constant: - /// /// - "1" /// - "text" /// - "true" /// - "false" /// /// Or, you can mix and match with string interpolation: - /// /// - "{{your-property-name}}-{{input.your-property-name-2}}-1" /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// @@ -52,7 +48,6 @@ public record RuleBasedCondition /// This is the right side of the operation. /// /// You can reference any variable in the context of the current block execution (step): - /// /// - "{{output.your-property-name}}" for current step's output /// - "{{input.your-property-name}}" for current step's input /// - "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1) @@ -63,18 +58,15 @@ public record RuleBasedCondition /// - "{{global.your-property-name}}" for the global context /// /// Or, you can use a constant: - /// /// - "1" /// - "text" /// - "true" /// - "false" /// /// Or, you can mix and match with string interpolation: - /// /// - "{{your-property-name}}-{{input.your-property-name-2}}-1" /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/RuleBasedConditionOperator.cs b/src/Vapi.Net/Types/RuleBasedConditionOperator.cs index f927d4c..ce3be34 100644 --- a/src/Vapi.Net/Types/RuleBasedConditionOperator.cs +++ b/src/Vapi.Net/Types/RuleBasedConditionOperator.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum RuleBasedConditionOperator { [EnumMember(Value = "eq")] diff --git a/src/Vapi.Net/Types/RunpodCredential.cs b/src/Vapi.Net/Types/RunpodCredential.cs index 2a32c1a..74d8c93 100644 --- a/src/Vapi.Net/Types/RunpodCredential.cs +++ b/src/Vapi.Net/Types/RunpodCredential.cs @@ -40,6 +40,12 @@ public record RunpodCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/S3Credential.cs b/src/Vapi.Net/Types/S3Credential.cs index ebba341..a06a233 100644 --- a/src/Vapi.Net/Types/S3Credential.cs +++ b/src/Vapi.Net/Types/S3Credential.cs @@ -67,6 +67,12 @@ public record S3Credential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/Server.cs b/src/Vapi.Net/Types/Server.cs index 2b0eaea..399d29b 100644 --- a/src/Vapi.Net/Types/Server.cs +++ b/src/Vapi.Net/Types/Server.cs @@ -29,6 +29,14 @@ public record Server [JsonPropertyName("secret")] public string? Secret { get; set; } + /// + /// These are the custom headers to include in the request sent to your server. + /// + /// Each key-value pair represents a header name and its value. + /// + [JsonPropertyName("headers")] + public object? Headers { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/ServerMessageAssistantRequest.cs b/src/Vapi.Net/Types/ServerMessageAssistantRequest.cs index 1c0c176..a8eef13 100644 --- a/src/Vapi.Net/Types/ServerMessageAssistantRequest.cs +++ b/src/Vapi.Net/Types/ServerMessageAssistantRequest.cs @@ -11,7 +11,6 @@ public record ServerMessageAssistantRequest /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageAssistantRequest /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageAssistantRequest /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageConversationUpdate.cs b/src/Vapi.Net/Types/ServerMessageConversationUpdate.cs index 5f7d0dd..dfefcca 100644 --- a/src/Vapi.Net/Types/ServerMessageConversationUpdate.cs +++ b/src/Vapi.Net/Types/ServerMessageConversationUpdate.cs @@ -12,7 +12,6 @@ public record ServerMessageConversationUpdate /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -52,13 +51,12 @@ public IEnumerable< /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -67,7 +65,6 @@ public IEnumerable< /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageEndOfCallReport.cs b/src/Vapi.Net/Types/ServerMessageEndOfCallReport.cs index f60c647..a05bfe6 100644 --- a/src/Vapi.Net/Types/ServerMessageEndOfCallReport.cs +++ b/src/Vapi.Net/Types/ServerMessageEndOfCallReport.cs @@ -11,7 +11,6 @@ public record ServerMessageEndOfCallReport /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -52,13 +51,12 @@ public record ServerMessageEndOfCallReport /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -67,7 +65,6 @@ public record ServerMessageEndOfCallReport /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageEndOfCallReportEndedReason.cs b/src/Vapi.Net/Types/ServerMessageEndOfCallReportEndedReason.cs index 405a33f..e98b84d 100644 --- a/src/Vapi.Net/Types/ServerMessageEndOfCallReportEndedReason.cs +++ b/src/Vapi.Net/Types/ServerMessageEndOfCallReportEndedReason.cs @@ -6,69 +6,18 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageEndOfCallReportEndedReason { - [EnumMember(Value = "assistant-error")] - AssistantError, - - [EnumMember(Value = "assistant-not-found")] - AssistantNotFound, - - [EnumMember(Value = "db-error")] - DbError, - - [EnumMember(Value = "no-server-available")] - NoServerAvailable, - - [EnumMember(Value = "license-check-failed")] - LicenseCheckFailed, - - [EnumMember(Value = "pipeline-error-openai-llm-failed")] - PipelineErrorOpenaiLlmFailed, - - [EnumMember(Value = "pipeline-error-azure-openai-llm-failed")] - PipelineErrorAzureOpenaiLlmFailed, - - [EnumMember(Value = "pipeline-error-groq-llm-failed")] - PipelineErrorGroqLlmFailed, - - [EnumMember(Value = "pipeline-error-anthropic-llm-failed")] - PipelineErrorAnthropicLlmFailed, - - [EnumMember(Value = "pipeline-error-vapi-llm-failed")] - PipelineErrorVapiLlmFailed, - - [EnumMember(Value = "pipeline-error-vapi-400-bad-request-validation-failed")] - PipelineErrorVapi400BadRequestValidationFailed, - - [EnumMember(Value = "pipeline-error-vapi-401-unauthorized")] - PipelineErrorVapi401Unauthorized, - - [EnumMember(Value = "pipeline-error-vapi-403-model-access-denied")] - PipelineErrorVapi403ModelAccessDenied, - - [EnumMember(Value = "pipeline-error-vapi-429-exceeded-quota")] - PipelineErrorVapi429ExceededQuota, - - [EnumMember(Value = "pipeline-error-vapi-500-server-error")] - PipelineErrorVapi500ServerError, - [EnumMember(Value = "pipeline-error-openai-voice-failed")] PipelineErrorOpenaiVoiceFailed, [EnumMember(Value = "pipeline-error-cartesia-voice-failed")] PipelineErrorCartesiaVoiceFailed, - [EnumMember(Value = "pipeline-error-deepgram-transcriber-failed")] - PipelineErrorDeepgramTranscriberFailed, - [EnumMember(Value = "pipeline-error-deepgram-voice-failed")] PipelineErrorDeepgramVoiceFailed, - [EnumMember(Value = "pipeline-error-gladia-transcriber-failed")] - PipelineErrorGladiaTranscriberFailed, - [EnumMember(Value = "pipeline-error-eleven-labs-voice-failed")] PipelineErrorElevenLabsVoiceFailed, @@ -87,6 +36,33 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-neets-voice-failed")] PipelineErrorNeetsVoiceFailed, + [EnumMember(Value = "db-error")] + DbError, + + [EnumMember(Value = "assistant-not-found")] + AssistantNotFound, + + [EnumMember(Value = "license-check-failed")] + LicenseCheckFailed, + + [EnumMember(Value = "pipeline-error-vapi-llm-failed")] + PipelineErrorVapiLlmFailed, + + [EnumMember(Value = "pipeline-error-vapi-400-bad-request-validation-failed")] + PipelineErrorVapi400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-vapi-401-unauthorized")] + PipelineErrorVapi401Unauthorized, + + [EnumMember(Value = "pipeline-error-vapi-403-model-access-denied")] + PipelineErrorVapi403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-vapi-429-exceeded-quota")] + PipelineErrorVapi429ExceededQuota, + + [EnumMember(Value = "pipeline-error-vapi-500-server-error")] + PipelineErrorVapi500ServerError, + [EnumMember(Value = "pipeline-no-available-model")] PipelineNoAvailableModel, @@ -123,6 +99,36 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "vapifault-transport-connected-but-call-not-active")] VapifaultTransportConnectedButCallNotActive, + [EnumMember(Value = "vapifault-call-started-but-connection-to-transport-missing")] + VapifaultCallStartedButConnectionToTransportMissing, + + [EnumMember(Value = "pipeline-error-deepgram-transcriber-failed")] + PipelineErrorDeepgramTranscriberFailed, + + [EnumMember(Value = "pipeline-error-gladia-transcriber-failed")] + PipelineErrorGladiaTranscriberFailed, + + [EnumMember(Value = "pipeline-error-assembly-ai-transcriber-failed")] + PipelineErrorAssemblyAiTranscriberFailed, + + [EnumMember(Value = "pipeline-error-openai-llm-failed")] + PipelineErrorOpenaiLlmFailed, + + [EnumMember(Value = "pipeline-error-azure-openai-llm-failed")] + PipelineErrorAzureOpenaiLlmFailed, + + [EnumMember(Value = "pipeline-error-groq-llm-failed")] + PipelineErrorGroqLlmFailed, + + [EnumMember(Value = "pipeline-error-google-llm-failed")] + PipelineErrorGoogleLlmFailed, + + [EnumMember(Value = "pipeline-error-xai-llm-failed")] + PipelineErrorXaiLlmFailed, + + [EnumMember(Value = "pipeline-error-inflection-ai-llm-failed")] + PipelineErrorInflectionAiLlmFailed, + [EnumMember(Value = "assistant-not-invalid")] AssistantNotInvalid, @@ -201,6 +207,51 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-openai-500-server-error")] PipelineErrorOpenai500ServerError, + [EnumMember(Value = "pipeline-error-google-400-bad-request-validation-failed")] + PipelineErrorGoogle400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-google-401-unauthorized")] + PipelineErrorGoogle401Unauthorized, + + [EnumMember(Value = "pipeline-error-google-403-model-access-denied")] + PipelineErrorGoogle403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-google-429-exceeded-quota")] + PipelineErrorGoogle429ExceededQuota, + + [EnumMember(Value = "pipeline-error-google-500-server-error")] + PipelineErrorGoogle500ServerError, + + [EnumMember(Value = "pipeline-error-xai-400-bad-request-validation-failed")] + PipelineErrorXai400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-xai-401-unauthorized")] + PipelineErrorXai401Unauthorized, + + [EnumMember(Value = "pipeline-error-xai-403-model-access-denied")] + PipelineErrorXai403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-xai-429-exceeded-quota")] + PipelineErrorXai429ExceededQuota, + + [EnumMember(Value = "pipeline-error-xai-500-server-error")] + PipelineErrorXai500ServerError, + + [EnumMember(Value = "pipeline-error-inflection-ai-400-bad-request-validation-failed")] + PipelineErrorInflectionAi400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-inflection-ai-401-unauthorized")] + PipelineErrorInflectionAi401Unauthorized, + + [EnumMember(Value = "pipeline-error-inflection-ai-403-model-access-denied")] + PipelineErrorInflectionAi403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-inflection-ai-429-exceeded-quota")] + PipelineErrorInflectionAi429ExceededQuota, + + [EnumMember(Value = "pipeline-error-inflection-ai-500-server-error")] + PipelineErrorInflectionAi500ServerError, + [EnumMember(Value = "pipeline-error-azure-openai-400-bad-request-validation-failed")] PipelineErrorAzureOpenai400BadRequestValidationFailed, @@ -246,6 +297,9 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-anthropic-500-server-error")] PipelineErrorAnthropic500ServerError, + [EnumMember(Value = "pipeline-error-anthropic-llm-failed")] + PipelineErrorAnthropicLlmFailed, + [EnumMember(Value = "pipeline-error-together-ai-400-bad-request-validation-failed")] PipelineErrorTogetherAi400BadRequestValidationFailed, @@ -372,6 +426,9 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-custom-llm-llm-failed")] PipelineErrorCustomLlmLlmFailed, + [EnumMember(Value = "pipeline-error-custom-voice-failed")] + PipelineErrorCustomVoiceFailed, + [EnumMember(Value = "pipeline-error-cartesia-socket-hang-up")] PipelineErrorCartesiaSocketHangUp, @@ -387,9 +444,6 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-cartesia-522-server-error")] PipelineErrorCartesia522ServerError, - [EnumMember(Value = "pipeline-error-custom-voice-failed")] - PipelineErrorCustomVoiceFailed, - [EnumMember(Value = "pipeline-error-eleven-labs-voice-not-found")] PipelineErrorElevenLabsVoiceNotFound, @@ -454,6 +508,11 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-eleven-labs-max-character-limit-exceeded")] PipelineErrorElevenLabsMaxCharacterLimitExceeded, + [EnumMember( + Value = "pipeline-error-eleven-labs-blocked-voice-potentially-against-terms-of-service-and-awaiting-verification" + )] + PipelineErrorElevenLabsBlockedVoicePotentiallyAgainstTermsOfServiceAndAwaitingVerification, + [EnumMember(Value = "pipeline-error-playht-request-timed-out")] PipelineErrorPlayhtRequestTimedOut, @@ -466,6 +525,9 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-playht-out-of-credits")] PipelineErrorPlayhtOutOfCredits, + [EnumMember(Value = "pipeline-error-playht-invalid-emotion")] + PipelineErrorPlayhtInvalidEmotion, + [EnumMember(Value = "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri")] PipelineErrorPlayhtVoiceMustBeAValidVoiceManifestUri, @@ -487,33 +549,50 @@ public enum ServerMessageEndOfCallReportEndedReason [EnumMember(Value = "pipeline-error-playht-504-gateway-error")] PipelineErrorPlayht504GatewayError, - [EnumMember(Value = "pipeline-error-deepgram-403-model-access-denied")] - PipelineErrorDeepgram403ModelAccessDenied, + [EnumMember(Value = "pipeline-error-deepgram-returning-403-model-access-denied")] + PipelineErrorDeepgramReturning403ModelAccessDenied, - [EnumMember(Value = "pipeline-error-deepgram-404-not-found")] - PipelineErrorDeepgram404NotFound, + [EnumMember(Value = "pipeline-error-deepgram-returning-401-invalid-credentials")] + PipelineErrorDeepgramReturning401InvalidCredentials, - [EnumMember(Value = "pipeline-error-deepgram-400-no-such-model-language-tier-combination")] - PipelineErrorDeepgram400NoSuchModelLanguageTierCombination, + [EnumMember(Value = "pipeline-error-deepgram-returning-404-not-found")] + PipelineErrorDeepgramReturning404NotFound, - [EnumMember(Value = "pipeline-error-deepgram-500-returning-invalid-json")] - PipelineErrorDeepgram500ReturningInvalidJson, + [EnumMember( + Value = "pipeline-error-deepgram-returning-400-no-such-model-language-tier-combination" + )] + PipelineErrorDeepgramReturning400NoSuchModelLanguageTierCombination, - [EnumMember(Value = "sip-gateway-failed-to-connect-call")] - SipGatewayFailedToConnectCall, + [EnumMember(Value = "pipeline-error-deepgram-returning-500-invalid-json")] + PipelineErrorDeepgramReturning500InvalidJson, + + [EnumMember(Value = "pipeline-error-deepgram-returning-502-network-error")] + PipelineErrorDeepgramReturning502NetworkError, + + [EnumMember(Value = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach")] + PipelineErrorDeepgramReturning502BadGatewayEhostunreach, + + [EnumMember(Value = "pipeline-error-tavus-video-failed")] + PipelineErrorTavusVideoFailed, + + [EnumMember(Value = "pipeline-error-custom-transcriber-failed")] + PipelineErrorCustomTranscriberFailed, [EnumMember(Value = "silence-timed-out")] SilenceTimedOut, + [EnumMember(Value = "sip-gateway-failed-to-connect-call")] + SipGatewayFailedToConnectCall, + [EnumMember(Value = "twilio-failed-to-connect-call")] TwilioFailedToConnectCall, [EnumMember(Value = "twilio-reported-customer-misdialed")] TwilioReportedCustomerMisdialed, - [EnumMember(Value = "voicemail")] - Voicemail, - [EnumMember(Value = "vonage-rejected")] VonageRejected, + + [EnumMember(Value = "voicemail")] + Voicemail, } diff --git a/src/Vapi.Net/Types/ServerMessageHang.cs b/src/Vapi.Net/Types/ServerMessageHang.cs index 4b9ab71..92f18a3 100644 --- a/src/Vapi.Net/Types/ServerMessageHang.cs +++ b/src/Vapi.Net/Types/ServerMessageHang.cs @@ -11,7 +11,6 @@ public record ServerMessageHang /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageHang /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageHang /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageKnowledgeBaseRequest.cs b/src/Vapi.Net/Types/ServerMessageKnowledgeBaseRequest.cs new file mode 100644 index 0000000..3677c37 --- /dev/null +++ b/src/Vapi.Net/Types/ServerMessageKnowledgeBaseRequest.cs @@ -0,0 +1,88 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record ServerMessageKnowledgeBaseRequest +{ + /// + /// This is the phone number associated with the call. + /// + /// This matches one of the following: + /// - `call.phoneNumber`, + /// - `call.phoneNumberId`. + /// + [JsonPropertyName("phoneNumber")] + public object? PhoneNumber { get; set; } + + /// + /// These are the messages that are going to be sent to the `model` right after the `knowledge-base-request` webhook completes. + /// + [JsonPropertyName("messages")] + public IEnumerable< + OneOf + >? Messages { get; set; } + + /// + /// This is just `messages` formatted for OpenAI. + /// + [JsonPropertyName("messagesOpenAIFormatted")] + public IEnumerable MessagesOpenAiFormatted { get; set; } = + new List(); + + /// + /// This is the ISO-8601 formatted timestamp of when the message was sent. + /// + [JsonPropertyName("timestamp")] + public string? Timestamp { get; set; } + + /// + /// This is a live version of the `call.artifact`. + /// + /// This matches what is stored on `call.artifact` after the call. + /// + [JsonPropertyName("artifact")] + public Artifact? Artifact { get; set; } + + /// + /// This is the assistant that is currently active. This is provided for convenience. + /// + /// This matches one of the following: + /// - `call.assistant`, + /// - `call.assistantId`, + /// - `call.squad[n].assistant`, + /// - `call.squad[n].assistantId`, + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. + /// + [JsonPropertyName("assistant")] + public CreateAssistantDto? Assistant { get; set; } + + /// + /// This is the customer associated with the call. + /// + /// This matches one of the following: + /// - `call.customer`, + /// - `call.customerId`. + /// + [JsonPropertyName("customer")] + public CreateCustomerDto? Customer { get; set; } + + /// + /// This is the call object. + /// + /// This matches what was returned in POST /call. + /// + /// Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id. + /// + [JsonPropertyName("call")] + public Call? Call { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/ServerMessageLanguageChanged.cs b/src/Vapi.Net/Types/ServerMessageLanguageChangeDetected.cs similarity index 93% rename from src/Vapi.Net/Types/ServerMessageLanguageChanged.cs rename to src/Vapi.Net/Types/ServerMessageLanguageChangeDetected.cs index 9b225a3..cb5cf83 100644 --- a/src/Vapi.Net/Types/ServerMessageLanguageChanged.cs +++ b/src/Vapi.Net/Types/ServerMessageLanguageChangeDetected.cs @@ -5,13 +5,12 @@ namespace Vapi.Net; -public record ServerMessageLanguageChanged +public record ServerMessageLanguageChangeDetected { /// /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageLanguageChanged /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageLanguageChanged /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageModelOutput.cs b/src/Vapi.Net/Types/ServerMessageModelOutput.cs index 63ed0f5..edd41f6 100644 --- a/src/Vapi.Net/Types/ServerMessageModelOutput.cs +++ b/src/Vapi.Net/Types/ServerMessageModelOutput.cs @@ -11,7 +11,6 @@ public record ServerMessageModelOutput /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageModelOutput /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageModelOutput /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessagePhoneCallControl.cs b/src/Vapi.Net/Types/ServerMessagePhoneCallControl.cs index fad33fd..00ecb43 100644 --- a/src/Vapi.Net/Types/ServerMessagePhoneCallControl.cs +++ b/src/Vapi.Net/Types/ServerMessagePhoneCallControl.cs @@ -11,7 +11,6 @@ public record ServerMessagePhoneCallControl /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -48,13 +47,12 @@ public record ServerMessagePhoneCallControl /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -63,7 +61,6 @@ public record ServerMessagePhoneCallControl /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessagePhoneCallControlRequest.cs b/src/Vapi.Net/Types/ServerMessagePhoneCallControlRequest.cs index ced9c6c..e7f5d65 100644 --- a/src/Vapi.Net/Types/ServerMessagePhoneCallControlRequest.cs +++ b/src/Vapi.Net/Types/ServerMessagePhoneCallControlRequest.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessagePhoneCallControlRequest { [EnumMember(Value = "forward")] diff --git a/src/Vapi.Net/Types/ServerMessageResponse.cs b/src/Vapi.Net/Types/ServerMessageResponse.cs index a671ea9..4caf805 100644 --- a/src/Vapi.Net/Types/ServerMessageResponse.cs +++ b/src/Vapi.Net/Types/ServerMessageResponse.cs @@ -16,6 +16,7 @@ public record ServerMessageResponse [JsonPropertyName("messageResponse")] public required OneOf< ServerMessageResponseAssistantRequest, + ServerMessageResponseKnowledgeBaseRequest, ServerMessageResponseToolCalls, ServerMessageResponseTransferDestinationRequest, ServerMessageResponseVoiceRequest diff --git a/src/Vapi.Net/Types/ServerMessageResponseKnowledgeBaseRequest.cs b/src/Vapi.Net/Types/ServerMessageResponseKnowledgeBaseRequest.cs new file mode 100644 index 0000000..14f1bd6 --- /dev/null +++ b/src/Vapi.Net/Types/ServerMessageResponseKnowledgeBaseRequest.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record ServerMessageResponseKnowledgeBaseRequest +{ + /// + /// This is the list of documents that will be sent to the model alongside the `messages` to generate a response. + /// + [JsonPropertyName("documents")] + public IEnumerable? Documents { get; set; } + + /// + /// This can be used to skip the model output generation and speak a custom message. + /// + [JsonPropertyName("message")] + public CustomMessage? Message { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/ServerMessageResponseVoiceRequest.cs b/src/Vapi.Net/Types/ServerMessageResponseVoiceRequest.cs index df4b1a7..2ab6fc3 100644 --- a/src/Vapi.Net/Types/ServerMessageResponseVoiceRequest.cs +++ b/src/Vapi.Net/Types/ServerMessageResponseVoiceRequest.cs @@ -16,18 +16,17 @@ public record ServerMessageResponseVoiceRequest /// Content-Type: application/json /// /// { - /// "messsage": { - /// "type": "voice-request", - /// "text": "Hello, world!", - /// "sampleRate": 24000, - /// ...other metadata about the call... - /// } + /// "messsage": { + /// "type": "voice-request", + /// "text": "Hello, world!", + /// "sampleRate": 24000, + /// ...other metadata about the call... + /// } /// } /// /// The expected response is 1-channel 16-bit raw PCM audio at the sample rate specified in the request. Here is how the response will be piped to the transport: - /// /// ``` - /// response.on('data', (chunk: Buffer) => { + /// response.on('data', (chunk: Buffer) => { /// outputStream.write(chunk); /// }); /// ``` diff --git a/src/Vapi.Net/Types/ServerMessageSpeechUpdate.cs b/src/Vapi.Net/Types/ServerMessageSpeechUpdate.cs index 9fad8d7..1484f41 100644 --- a/src/Vapi.Net/Types/ServerMessageSpeechUpdate.cs +++ b/src/Vapi.Net/Types/ServerMessageSpeechUpdate.cs @@ -11,7 +11,6 @@ public record ServerMessageSpeechUpdate /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -48,13 +47,12 @@ public record ServerMessageSpeechUpdate /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -63,7 +61,6 @@ public record ServerMessageSpeechUpdate /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageSpeechUpdateRole.cs b/src/Vapi.Net/Types/ServerMessageSpeechUpdateRole.cs index 7ce4661..3d822de 100644 --- a/src/Vapi.Net/Types/ServerMessageSpeechUpdateRole.cs +++ b/src/Vapi.Net/Types/ServerMessageSpeechUpdateRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageSpeechUpdateRole { [EnumMember(Value = "assistant")] diff --git a/src/Vapi.Net/Types/ServerMessageSpeechUpdateStatus.cs b/src/Vapi.Net/Types/ServerMessageSpeechUpdateStatus.cs index d346272..245b455 100644 --- a/src/Vapi.Net/Types/ServerMessageSpeechUpdateStatus.cs +++ b/src/Vapi.Net/Types/ServerMessageSpeechUpdateStatus.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageSpeechUpdateStatus { [EnumMember(Value = "started")] diff --git a/src/Vapi.Net/Types/ServerMessageStatusUpdate.cs b/src/Vapi.Net/Types/ServerMessageStatusUpdate.cs index e70b9a7..04779d5 100644 --- a/src/Vapi.Net/Types/ServerMessageStatusUpdate.cs +++ b/src/Vapi.Net/Types/ServerMessageStatusUpdate.cs @@ -12,7 +12,6 @@ public record ServerMessageStatusUpdate /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -69,13 +68,12 @@ public IEnumerable< /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -84,7 +82,6 @@ public IEnumerable< /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageStatusUpdateEndedReason.cs b/src/Vapi.Net/Types/ServerMessageStatusUpdateEndedReason.cs index e0a5980..b7824b1 100644 --- a/src/Vapi.Net/Types/ServerMessageStatusUpdateEndedReason.cs +++ b/src/Vapi.Net/Types/ServerMessageStatusUpdateEndedReason.cs @@ -6,69 +6,18 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageStatusUpdateEndedReason { - [EnumMember(Value = "assistant-error")] - AssistantError, - - [EnumMember(Value = "assistant-not-found")] - AssistantNotFound, - - [EnumMember(Value = "db-error")] - DbError, - - [EnumMember(Value = "no-server-available")] - NoServerAvailable, - - [EnumMember(Value = "license-check-failed")] - LicenseCheckFailed, - - [EnumMember(Value = "pipeline-error-openai-llm-failed")] - PipelineErrorOpenaiLlmFailed, - - [EnumMember(Value = "pipeline-error-azure-openai-llm-failed")] - PipelineErrorAzureOpenaiLlmFailed, - - [EnumMember(Value = "pipeline-error-groq-llm-failed")] - PipelineErrorGroqLlmFailed, - - [EnumMember(Value = "pipeline-error-anthropic-llm-failed")] - PipelineErrorAnthropicLlmFailed, - - [EnumMember(Value = "pipeline-error-vapi-llm-failed")] - PipelineErrorVapiLlmFailed, - - [EnumMember(Value = "pipeline-error-vapi-400-bad-request-validation-failed")] - PipelineErrorVapi400BadRequestValidationFailed, - - [EnumMember(Value = "pipeline-error-vapi-401-unauthorized")] - PipelineErrorVapi401Unauthorized, - - [EnumMember(Value = "pipeline-error-vapi-403-model-access-denied")] - PipelineErrorVapi403ModelAccessDenied, - - [EnumMember(Value = "pipeline-error-vapi-429-exceeded-quota")] - PipelineErrorVapi429ExceededQuota, - - [EnumMember(Value = "pipeline-error-vapi-500-server-error")] - PipelineErrorVapi500ServerError, - [EnumMember(Value = "pipeline-error-openai-voice-failed")] PipelineErrorOpenaiVoiceFailed, [EnumMember(Value = "pipeline-error-cartesia-voice-failed")] PipelineErrorCartesiaVoiceFailed, - [EnumMember(Value = "pipeline-error-deepgram-transcriber-failed")] - PipelineErrorDeepgramTranscriberFailed, - [EnumMember(Value = "pipeline-error-deepgram-voice-failed")] PipelineErrorDeepgramVoiceFailed, - [EnumMember(Value = "pipeline-error-gladia-transcriber-failed")] - PipelineErrorGladiaTranscriberFailed, - [EnumMember(Value = "pipeline-error-eleven-labs-voice-failed")] PipelineErrorElevenLabsVoiceFailed, @@ -87,6 +36,33 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-neets-voice-failed")] PipelineErrorNeetsVoiceFailed, + [EnumMember(Value = "db-error")] + DbError, + + [EnumMember(Value = "assistant-not-found")] + AssistantNotFound, + + [EnumMember(Value = "license-check-failed")] + LicenseCheckFailed, + + [EnumMember(Value = "pipeline-error-vapi-llm-failed")] + PipelineErrorVapiLlmFailed, + + [EnumMember(Value = "pipeline-error-vapi-400-bad-request-validation-failed")] + PipelineErrorVapi400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-vapi-401-unauthorized")] + PipelineErrorVapi401Unauthorized, + + [EnumMember(Value = "pipeline-error-vapi-403-model-access-denied")] + PipelineErrorVapi403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-vapi-429-exceeded-quota")] + PipelineErrorVapi429ExceededQuota, + + [EnumMember(Value = "pipeline-error-vapi-500-server-error")] + PipelineErrorVapi500ServerError, + [EnumMember(Value = "pipeline-no-available-model")] PipelineNoAvailableModel, @@ -123,6 +99,36 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "vapifault-transport-connected-but-call-not-active")] VapifaultTransportConnectedButCallNotActive, + [EnumMember(Value = "vapifault-call-started-but-connection-to-transport-missing")] + VapifaultCallStartedButConnectionToTransportMissing, + + [EnumMember(Value = "pipeline-error-deepgram-transcriber-failed")] + PipelineErrorDeepgramTranscriberFailed, + + [EnumMember(Value = "pipeline-error-gladia-transcriber-failed")] + PipelineErrorGladiaTranscriberFailed, + + [EnumMember(Value = "pipeline-error-assembly-ai-transcriber-failed")] + PipelineErrorAssemblyAiTranscriberFailed, + + [EnumMember(Value = "pipeline-error-openai-llm-failed")] + PipelineErrorOpenaiLlmFailed, + + [EnumMember(Value = "pipeline-error-azure-openai-llm-failed")] + PipelineErrorAzureOpenaiLlmFailed, + + [EnumMember(Value = "pipeline-error-groq-llm-failed")] + PipelineErrorGroqLlmFailed, + + [EnumMember(Value = "pipeline-error-google-llm-failed")] + PipelineErrorGoogleLlmFailed, + + [EnumMember(Value = "pipeline-error-xai-llm-failed")] + PipelineErrorXaiLlmFailed, + + [EnumMember(Value = "pipeline-error-inflection-ai-llm-failed")] + PipelineErrorInflectionAiLlmFailed, + [EnumMember(Value = "assistant-not-invalid")] AssistantNotInvalid, @@ -201,6 +207,51 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-openai-500-server-error")] PipelineErrorOpenai500ServerError, + [EnumMember(Value = "pipeline-error-google-400-bad-request-validation-failed")] + PipelineErrorGoogle400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-google-401-unauthorized")] + PipelineErrorGoogle401Unauthorized, + + [EnumMember(Value = "pipeline-error-google-403-model-access-denied")] + PipelineErrorGoogle403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-google-429-exceeded-quota")] + PipelineErrorGoogle429ExceededQuota, + + [EnumMember(Value = "pipeline-error-google-500-server-error")] + PipelineErrorGoogle500ServerError, + + [EnumMember(Value = "pipeline-error-xai-400-bad-request-validation-failed")] + PipelineErrorXai400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-xai-401-unauthorized")] + PipelineErrorXai401Unauthorized, + + [EnumMember(Value = "pipeline-error-xai-403-model-access-denied")] + PipelineErrorXai403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-xai-429-exceeded-quota")] + PipelineErrorXai429ExceededQuota, + + [EnumMember(Value = "pipeline-error-xai-500-server-error")] + PipelineErrorXai500ServerError, + + [EnumMember(Value = "pipeline-error-inflection-ai-400-bad-request-validation-failed")] + PipelineErrorInflectionAi400BadRequestValidationFailed, + + [EnumMember(Value = "pipeline-error-inflection-ai-401-unauthorized")] + PipelineErrorInflectionAi401Unauthorized, + + [EnumMember(Value = "pipeline-error-inflection-ai-403-model-access-denied")] + PipelineErrorInflectionAi403ModelAccessDenied, + + [EnumMember(Value = "pipeline-error-inflection-ai-429-exceeded-quota")] + PipelineErrorInflectionAi429ExceededQuota, + + [EnumMember(Value = "pipeline-error-inflection-ai-500-server-error")] + PipelineErrorInflectionAi500ServerError, + [EnumMember(Value = "pipeline-error-azure-openai-400-bad-request-validation-failed")] PipelineErrorAzureOpenai400BadRequestValidationFailed, @@ -246,6 +297,9 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-anthropic-500-server-error")] PipelineErrorAnthropic500ServerError, + [EnumMember(Value = "pipeline-error-anthropic-llm-failed")] + PipelineErrorAnthropicLlmFailed, + [EnumMember(Value = "pipeline-error-together-ai-400-bad-request-validation-failed")] PipelineErrorTogetherAi400BadRequestValidationFailed, @@ -372,6 +426,9 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-custom-llm-llm-failed")] PipelineErrorCustomLlmLlmFailed, + [EnumMember(Value = "pipeline-error-custom-voice-failed")] + PipelineErrorCustomVoiceFailed, + [EnumMember(Value = "pipeline-error-cartesia-socket-hang-up")] PipelineErrorCartesiaSocketHangUp, @@ -387,9 +444,6 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-cartesia-522-server-error")] PipelineErrorCartesia522ServerError, - [EnumMember(Value = "pipeline-error-custom-voice-failed")] - PipelineErrorCustomVoiceFailed, - [EnumMember(Value = "pipeline-error-eleven-labs-voice-not-found")] PipelineErrorElevenLabsVoiceNotFound, @@ -454,6 +508,11 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-eleven-labs-max-character-limit-exceeded")] PipelineErrorElevenLabsMaxCharacterLimitExceeded, + [EnumMember( + Value = "pipeline-error-eleven-labs-blocked-voice-potentially-against-terms-of-service-and-awaiting-verification" + )] + PipelineErrorElevenLabsBlockedVoicePotentiallyAgainstTermsOfServiceAndAwaitingVerification, + [EnumMember(Value = "pipeline-error-playht-request-timed-out")] PipelineErrorPlayhtRequestTimedOut, @@ -466,6 +525,9 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-playht-out-of-credits")] PipelineErrorPlayhtOutOfCredits, + [EnumMember(Value = "pipeline-error-playht-invalid-emotion")] + PipelineErrorPlayhtInvalidEmotion, + [EnumMember(Value = "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri")] PipelineErrorPlayhtVoiceMustBeAValidVoiceManifestUri, @@ -487,33 +549,50 @@ public enum ServerMessageStatusUpdateEndedReason [EnumMember(Value = "pipeline-error-playht-504-gateway-error")] PipelineErrorPlayht504GatewayError, - [EnumMember(Value = "pipeline-error-deepgram-403-model-access-denied")] - PipelineErrorDeepgram403ModelAccessDenied, + [EnumMember(Value = "pipeline-error-deepgram-returning-403-model-access-denied")] + PipelineErrorDeepgramReturning403ModelAccessDenied, - [EnumMember(Value = "pipeline-error-deepgram-404-not-found")] - PipelineErrorDeepgram404NotFound, + [EnumMember(Value = "pipeline-error-deepgram-returning-401-invalid-credentials")] + PipelineErrorDeepgramReturning401InvalidCredentials, - [EnumMember(Value = "pipeline-error-deepgram-400-no-such-model-language-tier-combination")] - PipelineErrorDeepgram400NoSuchModelLanguageTierCombination, + [EnumMember(Value = "pipeline-error-deepgram-returning-404-not-found")] + PipelineErrorDeepgramReturning404NotFound, - [EnumMember(Value = "pipeline-error-deepgram-500-returning-invalid-json")] - PipelineErrorDeepgram500ReturningInvalidJson, + [EnumMember( + Value = "pipeline-error-deepgram-returning-400-no-such-model-language-tier-combination" + )] + PipelineErrorDeepgramReturning400NoSuchModelLanguageTierCombination, - [EnumMember(Value = "sip-gateway-failed-to-connect-call")] - SipGatewayFailedToConnectCall, + [EnumMember(Value = "pipeline-error-deepgram-returning-500-invalid-json")] + PipelineErrorDeepgramReturning500InvalidJson, + + [EnumMember(Value = "pipeline-error-deepgram-returning-502-network-error")] + PipelineErrorDeepgramReturning502NetworkError, + + [EnumMember(Value = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach")] + PipelineErrorDeepgramReturning502BadGatewayEhostunreach, + + [EnumMember(Value = "pipeline-error-tavus-video-failed")] + PipelineErrorTavusVideoFailed, + + [EnumMember(Value = "pipeline-error-custom-transcriber-failed")] + PipelineErrorCustomTranscriberFailed, [EnumMember(Value = "silence-timed-out")] SilenceTimedOut, + [EnumMember(Value = "sip-gateway-failed-to-connect-call")] + SipGatewayFailedToConnectCall, + [EnumMember(Value = "twilio-failed-to-connect-call")] TwilioFailedToConnectCall, [EnumMember(Value = "twilio-reported-customer-misdialed")] TwilioReportedCustomerMisdialed, - [EnumMember(Value = "voicemail")] - Voicemail, - [EnumMember(Value = "vonage-rejected")] VonageRejected, + + [EnumMember(Value = "voicemail")] + Voicemail, } diff --git a/src/Vapi.Net/Types/ServerMessageStatusUpdateStatus.cs b/src/Vapi.Net/Types/ServerMessageStatusUpdateStatus.cs index 595b1db..8820625 100644 --- a/src/Vapi.Net/Types/ServerMessageStatusUpdateStatus.cs +++ b/src/Vapi.Net/Types/ServerMessageStatusUpdateStatus.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageStatusUpdateStatus { [EnumMember(Value = "queued")] diff --git a/src/Vapi.Net/Types/ServerMessageToolCalls.cs b/src/Vapi.Net/Types/ServerMessageToolCalls.cs index 57baeca..6543e10 100644 --- a/src/Vapi.Net/Types/ServerMessageToolCalls.cs +++ b/src/Vapi.Net/Types/ServerMessageToolCalls.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using OneOf; using Vapi.Net.Core; #nullable enable @@ -11,7 +12,6 @@ public record ServerMessageToolCalls /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -22,7 +22,26 @@ public record ServerMessageToolCalls /// This is the list of tools calls that the model is requesting along with the original tool configuration. /// [JsonPropertyName("toolWithToolCallList")] - public IEnumerable ToolWithToolCallList { get; set; } = new List(); + public IEnumerable< + OneOf< + FunctionToolWithToolCall, + GhlToolWithToolCall, + MakeToolWithToolCall, + object, + object, + object + > + > ToolWithToolCallList { get; set; } = + new List< + OneOf< + FunctionToolWithToolCall, + GhlToolWithToolCall, + MakeToolWithToolCall, + object, + object, + object + > + >(); /// /// This is the ISO-8601 formatted timestamp of when the message was sent. @@ -42,13 +61,12 @@ public record ServerMessageToolCalls /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -57,7 +75,6 @@ public record ServerMessageToolCalls /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageTranscript.cs b/src/Vapi.Net/Types/ServerMessageTranscript.cs index 8ba8f3f..31fb6e6 100644 --- a/src/Vapi.Net/Types/ServerMessageTranscript.cs +++ b/src/Vapi.Net/Types/ServerMessageTranscript.cs @@ -11,7 +11,6 @@ public record ServerMessageTranscript /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageTranscript /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageTranscript /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageTranscriptRole.cs b/src/Vapi.Net/Types/ServerMessageTranscriptRole.cs index 46f266f..ec867eb 100644 --- a/src/Vapi.Net/Types/ServerMessageTranscriptRole.cs +++ b/src/Vapi.Net/Types/ServerMessageTranscriptRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageTranscriptRole { [EnumMember(Value = "assistant")] diff --git a/src/Vapi.Net/Types/ServerMessageTranscriptTranscriptType.cs b/src/Vapi.Net/Types/ServerMessageTranscriptTranscriptType.cs index 49063ad..c9c4cce 100644 --- a/src/Vapi.Net/Types/ServerMessageTranscriptTranscriptType.cs +++ b/src/Vapi.Net/Types/ServerMessageTranscriptTranscriptType.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ServerMessageTranscriptTranscriptType { [EnumMember(Value = "partial")] diff --git a/src/Vapi.Net/Types/ServerMessageTransferDestinationRequest.cs b/src/Vapi.Net/Types/ServerMessageTransferDestinationRequest.cs index a52a58c..dafc588 100644 --- a/src/Vapi.Net/Types/ServerMessageTransferDestinationRequest.cs +++ b/src/Vapi.Net/Types/ServerMessageTransferDestinationRequest.cs @@ -11,7 +11,6 @@ public record ServerMessageTransferDestinationRequest /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageTransferDestinationRequest /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageTransferDestinationRequest /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageTransferUpdate.cs b/src/Vapi.Net/Types/ServerMessageTransferUpdate.cs index 2e4f1b1..0209ef2 100644 --- a/src/Vapi.Net/Types/ServerMessageTransferUpdate.cs +++ b/src/Vapi.Net/Types/ServerMessageTransferUpdate.cs @@ -11,7 +11,6 @@ public record ServerMessageTransferUpdate /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -42,13 +41,12 @@ public record ServerMessageTransferUpdate /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -57,7 +55,6 @@ public record ServerMessageTransferUpdate /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// @@ -86,6 +83,18 @@ public record ServerMessageTransferUpdate [JsonPropertyName("fromAssistant")] public CreateAssistantDto? FromAssistant { get; set; } + /// + /// This is the step that the conversation moved to. + /// + [JsonPropertyName("toStepRecord")] + public object? ToStepRecord { get; set; } + + /// + /// This is the step that the conversation moved from. = + /// + [JsonPropertyName("fromStepRecord")] + public object? FromStepRecord { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/ServerMessageUserInterrupted.cs b/src/Vapi.Net/Types/ServerMessageUserInterrupted.cs index 03338a7..2e8667a 100644 --- a/src/Vapi.Net/Types/ServerMessageUserInterrupted.cs +++ b/src/Vapi.Net/Types/ServerMessageUserInterrupted.cs @@ -11,7 +11,6 @@ public record ServerMessageUserInterrupted /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageUserInterrupted /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageUserInterrupted /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageVoiceInput.cs b/src/Vapi.Net/Types/ServerMessageVoiceInput.cs index 4207b99..90924cf 100644 --- a/src/Vapi.Net/Types/ServerMessageVoiceInput.cs +++ b/src/Vapi.Net/Types/ServerMessageVoiceInput.cs @@ -11,7 +11,6 @@ public record ServerMessageVoiceInput /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageVoiceInput /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageVoiceInput /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/ServerMessageVoiceRequest.cs b/src/Vapi.Net/Types/ServerMessageVoiceRequest.cs index ecbb45a..76d9bc9 100644 --- a/src/Vapi.Net/Types/ServerMessageVoiceRequest.cs +++ b/src/Vapi.Net/Types/ServerMessageVoiceRequest.cs @@ -11,7 +11,6 @@ public record ServerMessageVoiceRequest /// This is the phone number associated with the call. /// /// This matches one of the following: - /// /// - `call.phoneNumber`, /// - `call.phoneNumberId`. /// @@ -36,13 +35,12 @@ public record ServerMessageVoiceRequest /// This is the assistant that is currently active. This is provided for convenience. /// /// This matches one of the following: - /// /// - `call.assistant`, /// - `call.assistantId`, /// - `call.squad[n].assistant`, /// - `call.squad[n].assistantId`, - /// - `call.squadId->[n].assistant`, - /// - `call.squadId->[n].assistantId`. + /// - `call.squadId->[n].assistant`, + /// - `call.squadId->[n].assistantId`. /// [JsonPropertyName("assistant")] public CreateAssistantDto? Assistant { get; set; } @@ -51,7 +49,6 @@ public record ServerMessageVoiceRequest /// This is the customer associated with the call. /// /// This matches one of the following: - /// /// - `call.customer`, /// - `call.customerId`. /// diff --git a/src/Vapi.Net/Types/SipAuthentication.cs b/src/Vapi.Net/Types/SipAuthentication.cs new file mode 100644 index 0000000..3cbc94e --- /dev/null +++ b/src/Vapi.Net/Types/SipAuthentication.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record SipAuthentication +{ + /// + /// This will be expected in the `realm` field of the `authorization` header of the SIP INVITE. Defaults to sip.vapi.ai. + /// + [JsonPropertyName("realm")] + public string? Realm { get; set; } + + /// + /// This will be expected in the `username` field of the `authorization` header of the SIP INVITE. + /// + [JsonPropertyName("username")] + public required string Username { get; set; } + + /// + /// This will be expected to generate the `response` field of the `authorization` header of the SIP INVITE, through digest authentication. + /// + [JsonPropertyName("password")] + public required string Password { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/SipTrunkGatewayOutboundProtocol.cs b/src/Vapi.Net/Types/SipTrunkGatewayOutboundProtocol.cs index bd5e211..08c636a 100644 --- a/src/Vapi.Net/Types/SipTrunkGatewayOutboundProtocol.cs +++ b/src/Vapi.Net/Types/SipTrunkGatewayOutboundProtocol.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum SipTrunkGatewayOutboundProtocol { [EnumMember(Value = "tls/srtp")] diff --git a/src/Vapi.Net/Types/StartSpeakingPlan.cs b/src/Vapi.Net/Types/StartSpeakingPlan.cs index ba49f33..a5ffc50 100644 --- a/src/Vapi.Net/Types/StartSpeakingPlan.cs +++ b/src/Vapi.Net/Types/StartSpeakingPlan.cs @@ -10,14 +10,12 @@ public record StartSpeakingPlan /// /// This is how long assistant waits before speaking. Defaults to 0.4. /// - /// This is the minimum it will wait but if there is latency is the pipeline, this minimum will be exceeded. This is really a stopgap in case the pipeline is moving too fast. + /// This is the minimum it will wait but if there is latency is the pipeline, this minimum will be exceeded. This is intended as a stopgap in case the pipeline is moving too fast. /// /// Example: - /// /// - If model generates tokens and voice generates bytes within 100ms, the pipeline still waits 300ms before outputting speech. /// /// Usage: - /// /// - If the customer is taking long pauses, set this to a higher value. /// - If the assistant is accidentally jumping in too much, set this to a higher value. /// @@ -27,17 +25,37 @@ public record StartSpeakingPlan public double? WaitSeconds { get; set; } /// - /// This determines if a customer speech is considered done (endpointing) using the VAP model on customer's speech. This is good for middle-of-thought detection. + /// This determines if a customer speech is considered done (endpointing) using a Vapi custom-trained model on customer's speech. This is good for middle-of-thought detection. /// /// Once an endpoint is triggered, the request is sent to `assistant.model`. /// - /// Default `false` since experimental. + /// Usage: + /// - If your conversations are long-form and you want assistant to wait smartly even if customer pauses for a bit to think, you can use this instead. + /// + /// This overrides `transcriptionEndpointingPlan`. /// /// @default false /// [JsonPropertyName("smartEndpointingEnabled")] public bool? SmartEndpointingEnabled { get; set; } + /// + /// These are the custom endpointing rules to set an endpointing timeout based on a regex on the customer's speech or the assistant's last message. + /// + /// Usage: + /// - If you have yes/no questions like "are you interested in a loan?", you can set a shorter timeout. + /// - If you have questions where the customer may pause to look up information like "what's my account number?", you can set a longer timeout. + /// - If you want to wait longer while customer is enumerating a list of numbers, you can set a longer timeout. + /// + /// These override `transcriptionEndpointingPlan` and `smartEndpointingEnabled` when a rule is matched. + /// + /// The rules are evaluated in order and the first one that matches will be used. + /// + /// @default [] + /// + [JsonPropertyName("customEndpointingRules")] + public IEnumerable? CustomEndpointingRules { get; set; } + /// /// This determines how a customer speech is considered done (endpointing) using the transcription of customer's speech. /// diff --git a/src/Vapi.Net/Types/StopSpeakingPlan.cs b/src/Vapi.Net/Types/StopSpeakingPlan.cs index d3be58d..17603cd 100644 --- a/src/Vapi.Net/Types/StopSpeakingPlan.cs +++ b/src/Vapi.Net/Types/StopSpeakingPlan.cs @@ -27,7 +27,6 @@ public record StopSpeakingPlan /// This is the seconds customer has to speak before the assistant stops talking. This uses the VAD (Voice Activity Detection) spike to determine if the customer has started speaking. /// /// Considerations: - /// /// - A lower value might be more responsive but could potentially pick up non-speech sounds. /// - A higher value reduces false positives but might slightly delay the detection of speech onset. /// diff --git a/src/Vapi.Net/Types/StructuredDataPlan.cs b/src/Vapi.Net/Types/StructuredDataPlan.cs index a51d325..8c57abf 100644 --- a/src/Vapi.Net/Types/StructuredDataPlan.cs +++ b/src/Vapi.Net/Types/StructuredDataPlan.cs @@ -10,12 +10,21 @@ public record StructuredDataPlan /// /// These are the messages used to generate the structured data. /// - /// @default: ` [ { "role": "system", "content": "You are an expert data extractor. You will be given a transcript of a call. Extract structured data per the JSON Schema. DO NOT return anything except the structured data.\n\nJson Schema:\\n{{schema}}\n\nOnly respond with the JSON." }, { "role": "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" } ]` + /// @default: ``` + /// [ + /// { + /// "role": "system", + /// "content": "You are an expert data extractor. You will be given a transcript of a call. Extract structured data per the JSON Schema. DO NOT return anything except the structured data.\n\nJson Schema:\\n{{schema}}\n\nOnly respond with the JSON." + /// }, + /// { + /// "role": "user", + /// "content": "Here is the transcript:\n\n{{transcript}}\n\n" + /// } + /// ]``` /// /// You can customize by providing any messages you want. /// /// Here are the template variables available: - /// /// - {{transcript}}: the transcript of the call from `call.artifact.transcript`- {{systemPrompt}}: the system prompt of the call from `assistant.model.messages[type=system].content`- {{schema}}: the schema of the structured data from `structuredDataPlan.schema` /// [JsonPropertyName("messages")] @@ -25,7 +34,6 @@ public record StructuredDataPlan /// This determines whether structured data is generated and stored in `call.analysis.structuredData`. Defaults to false. /// /// Usage: - /// /// - If you want to extract structured data, set this to true and provide a `schema`. /// /// @default false @@ -45,7 +53,6 @@ public record StructuredDataPlan /// This is how long the request is tried before giving up. When request times out, `call.analysis.structuredData` will be empty. /// /// Usage: - /// /// - To guarantee the structured data is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond. /// /// @default 5 seconds diff --git a/src/Vapi.Net/Types/Subscription.cs b/src/Vapi.Net/Types/Subscription.cs new file mode 100644 index 0000000..f38bcec --- /dev/null +++ b/src/Vapi.Net/Types/Subscription.cs @@ -0,0 +1,200 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record Subscription +{ + /// + /// This is the unique identifier for the subscription. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the timestamp when the subscription was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the timestamp when the subscription was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the type / tier of the subscription. + /// + [JsonPropertyName("type")] + public required SubscriptionType Type { get; set; } + + /// + /// This is the status of the subscription. Past due subscriptions are subscriptions + /// with past due payments. + /// + [JsonPropertyName("status")] + public required SubscriptionStatus Status { get; set; } + + /// + /// This is the number of credits the subscription currently has. + /// + /// Note: This is a string to avoid floating point precision issues. + /// + [JsonPropertyName("credits")] + public required string Credits { get; set; } + + /// + /// This is the total concurrency limit for the subscription. + /// + [JsonPropertyName("concurrencyLimit")] + public required double ConcurrencyLimit { get; set; } + + /// + /// This is the default concurrency limit for the subscription. + /// + [JsonPropertyName("concurrencyLimitIncluded")] + public required double ConcurrencyLimitIncluded { get; set; } + + /// + /// This is the purchased add-on concurrency limit for the subscription. + /// + [JsonPropertyName("concurrencyLimitPurchased")] + public required double ConcurrencyLimitPurchased { get; set; } + + /// + /// This is the ID of the monthly job that charges for subscription add ons and phone numbers. + /// + [JsonPropertyName("monthlyChargeScheduleId")] + public double? MonthlyChargeScheduleId { get; set; } + + /// + /// This is the ID of the monthly job that checks whether the credit balance of the subscription + /// is sufficient for the monthly charge. + /// + [JsonPropertyName("monthlyCreditCheckScheduleId")] + public double? MonthlyCreditCheckScheduleId { get; set; } + + /// + /// This is the Stripe customer ID. + /// + [JsonPropertyName("stripeCustomerId")] + public string? StripeCustomerId { get; set; } + + /// + /// This is the Stripe payment ID. + /// + [JsonPropertyName("stripePaymentMethodId")] + public string? StripePaymentMethodId { get; set; } + + /// + /// If this flag is true, then the user has purchased slack support. + /// + [JsonPropertyName("slackSupportEnabled")] + public bool? SlackSupportEnabled { get; set; } + + /// + /// If this subscription has a slack support subscription, the slack channel's ID will be stored here. + /// + [JsonPropertyName("slackChannelId")] + public string? SlackChannelId { get; set; } + + /// + /// This is the HIPAA enabled flag for the subscription. It determines whether orgs under this + /// subscription have the option to enable HIPAA compliance. + /// + [JsonPropertyName("hipaaEnabled")] + public bool? HipaaEnabled { get; set; } + + /// + /// This is the ID for the Common Paper agreement outlining the HIPAA contract. + /// + [JsonPropertyName("hipaaCommonPaperAgreementId")] + public string? HipaaCommonPaperAgreementId { get; set; } + + /// + /// This is the Stripe fingerprint of the payment method (card). It allows us + /// to detect users who try to abuse our system through multiple sign-ups. + /// + [JsonPropertyName("stripePaymentMethodFingerprint")] + public string? StripePaymentMethodFingerprint { get; set; } + + /// + /// This is the stripe customer's email. + /// + [JsonPropertyName("stripeCustomerEmail")] + public string? StripeCustomerEmail { get; set; } + + /// + /// This is the email of the referrer for the subscription. + /// + [JsonPropertyName("referredByEmail")] + public string? ReferredByEmail { get; set; } + + /// + /// This is the auto reload plan configured for the subscription. + /// + [JsonPropertyName("autoReloadPlan")] + public AutoReloadPlan? AutoReloadPlan { get; set; } + + /// + /// The number of minutes included in the subscription. Enterprise only. + /// + [JsonPropertyName("minutesIncluded")] + public double? MinutesIncluded { get; set; } + + /// + /// The number of minutes used in the subscription. Enterprise only. + /// + [JsonPropertyName("minutesUsed")] + public double? MinutesUsed { get; set; } + + /// + /// The per minute charge on minutes that exceed the included minutes. Enterprise only. + /// + [JsonPropertyName("minutesOverageCost")] + public double? MinutesOverageCost { get; set; } + + /// + /// The list of providers included in the subscription. Enterprise only. + /// + [JsonPropertyName("providersIncluded")] + public IEnumerable? ProvidersIncluded { get; set; } + + /// + /// The maximum number of outbound calls this subscription may make in a day. Resets every night. + /// + [JsonPropertyName("outboundCallsDailyLimit")] + public double? OutboundCallsDailyLimit { get; set; } + + /// + /// The current number of outbound calls the subscription has made in the current day. + /// + [JsonPropertyName("outboundCallsCounter")] + public double? OutboundCallsCounter { get; set; } + + /// + /// This is the timestamp at which the outbound calls counter is scheduled to reset at. + /// + [JsonPropertyName("outboundCallsCounterNextResetAt")] + public DateTime? OutboundCallsCounterNextResetAt { get; set; } + + /// + /// This is the IDs of the coupons applicable to this subscription. + /// + [JsonPropertyName("couponIds")] + public IEnumerable? CouponIds { get; set; } + + /// + /// This is the number of credits left obtained from a coupon. + /// + [JsonPropertyName("couponUsageLeft")] + public string? CouponUsageLeft { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/SubscriptionConcurrencyLineBuyDto.cs b/src/Vapi.Net/Types/SubscriptionConcurrencyLineBuyDto.cs new file mode 100644 index 0000000..556b1a2 --- /dev/null +++ b/src/Vapi.Net/Types/SubscriptionConcurrencyLineBuyDto.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record SubscriptionConcurrencyLineBuyDto +{ + /// + /// This is the number of concurrency lines to purchase. + /// + [JsonPropertyName("quantity")] + public required double Quantity { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/SubscriptionConcurrencyLineRemoveDto.cs b/src/Vapi.Net/Types/SubscriptionConcurrencyLineRemoveDto.cs new file mode 100644 index 0000000..dd180b5 --- /dev/null +++ b/src/Vapi.Net/Types/SubscriptionConcurrencyLineRemoveDto.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record SubscriptionConcurrencyLineRemoveDto +{ + /// + /// This is the number of concurrency lines to remove. + /// + [JsonPropertyName("quantity")] + public required double Quantity { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/SubscriptionCouponAddDto.cs b/src/Vapi.Net/Types/SubscriptionCouponAddDto.cs new file mode 100644 index 0000000..ebdebef --- /dev/null +++ b/src/Vapi.Net/Types/SubscriptionCouponAddDto.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record SubscriptionCouponAddDto +{ + /// + /// This is the ID of the org within the subscription which the coupon will take effect on. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the code of the coupon to apply to the subscription. + /// + [JsonPropertyName("couponCode")] + public required string CouponCode { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/SubscriptionMonthlyCharge.cs b/src/Vapi.Net/Types/SubscriptionMonthlyCharge.cs new file mode 100644 index 0000000..340bf1b --- /dev/null +++ b/src/Vapi.Net/Types/SubscriptionMonthlyCharge.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record SubscriptionMonthlyCharge +{ + /// + /// This is the monthly charge for the subscription. + /// + [JsonPropertyName("monthlyCharge")] + public required double MonthlyCharge { get; set; } + + /// + /// These are the different costs that make up the monthly charge. + /// + [JsonPropertyName("costs")] + public IEnumerable Costs { get; set; } = new List(); + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/SubscriptionStatus.cs b/src/Vapi.Net/Types/SubscriptionStatus.cs new file mode 100644 index 0000000..4b34231 --- /dev/null +++ b/src/Vapi.Net/Types/SubscriptionStatus.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum SubscriptionStatus +{ + [EnumMember(Value = "active")] + Active, + + [EnumMember(Value = "frozen")] + Frozen, +} diff --git a/src/Vapi.Net/Types/SubscriptionType.cs b/src/Vapi.Net/Types/SubscriptionType.cs new file mode 100644 index 0000000..0a853eb --- /dev/null +++ b/src/Vapi.Net/Types/SubscriptionType.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum SubscriptionType +{ + [EnumMember(Value = "trial")] + Trial, + + [EnumMember(Value = "pay-as-you-go")] + PayAsYouGo, + + [EnumMember(Value = "enterprise")] + Enterprise, +} diff --git a/src/Vapi.Net/Types/SuccessEvaluationPlan.cs b/src/Vapi.Net/Types/SuccessEvaluationPlan.cs index b9592c7..ba8bfe4 100644 --- a/src/Vapi.Net/Types/SuccessEvaluationPlan.cs +++ b/src/Vapi.Net/Types/SuccessEvaluationPlan.cs @@ -11,7 +11,6 @@ public record SuccessEvaluationPlan /// This enforces the rubric of the evaluation. The output is stored in `call.analysis.successEvaluation`. /// /// Options include: - /// /// - 'NumericScale': A scale of 1 to 10. /// - 'DescriptiveScale': A scale of Excellent, Good, Fair, Poor. /// - 'Checklist': A checklist of criteria and their status. @@ -29,12 +28,25 @@ public record SuccessEvaluationPlan /// /// These are the messages used to generate the success evaluation. /// - /// @default: ` [ { "role": "system", "content": "You are an expert call evaluator. You will be given a transcript of a call and the system prompt of the AI participant. Determine if the call was successful based on the objectives inferred from the system prompt. DO NOT return anything except the result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with the result." }, { "role": "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" }, { "role": "user", "content": "Here was the system prompt of the call:\n\n{{systemPrompt}}\n\n" } ]` + /// @default: ``` + /// [ + /// { + /// "role": "system", + /// "content": "You are an expert call evaluator. You will be given a transcript of a call and the system prompt of the AI participant. Determine if the call was successful based on the objectives inferred from the system prompt. DO NOT return anything except the result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with the result." + /// }, + /// { + /// "role": "user", + /// "content": "Here is the transcript:\n\n{{transcript}}\n\n" + /// }, + /// { + /// "role": "user", + /// "content": "Here was the system prompt of the call:\n\n{{systemPrompt}}\n\n" + /// } + /// ]``` /// /// You can customize by providing any messages you want. /// /// Here are the template variables available: - /// /// - {{transcript}}: the transcript of the call from `call.artifact.transcript`- {{systemPrompt}}: the system prompt of the call from `assistant.model.messages[type=system].content`- {{rubric}}: the rubric of the success evaluation from `successEvaluationPlan.rubric` /// [JsonPropertyName("messages")] @@ -44,7 +56,6 @@ public record SuccessEvaluationPlan /// This determines whether a success evaluation is generated and stored in `call.analysis.successEvaluation`. Defaults to true. /// /// Usage: - /// /// - If you want to disable the success evaluation, set this to false. /// /// @default true @@ -56,7 +67,6 @@ public record SuccessEvaluationPlan /// This is how long the request is tried before giving up. When request times out, `call.analysis.successEvaluation` will be empty. /// /// Usage: - /// /// - To guarantee the success evaluation is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond. /// /// @default 5 seconds diff --git a/src/Vapi.Net/Types/SuccessEvaluationPlanRubric.cs b/src/Vapi.Net/Types/SuccessEvaluationPlanRubric.cs index 5f99202..6e93bd5 100644 --- a/src/Vapi.Net/Types/SuccessEvaluationPlanRubric.cs +++ b/src/Vapi.Net/Types/SuccessEvaluationPlanRubric.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum SuccessEvaluationPlanRubric { [EnumMember(Value = "NumericScale")] diff --git a/src/Vapi.Net/Types/SummaryPlan.cs b/src/Vapi.Net/Types/SummaryPlan.cs index 5ca089d..fd92c3a 100644 --- a/src/Vapi.Net/Types/SummaryPlan.cs +++ b/src/Vapi.Net/Types/SummaryPlan.cs @@ -10,12 +10,21 @@ public record SummaryPlan /// /// These are the messages used to generate the summary. /// - /// @default: ` [ { "role": "system", "content": "You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences. DO NOT return anything except the summary." }, { "role": "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" } ]` + /// @default: ``` + /// [ + /// { + /// "role": "system", + /// "content": "You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences. DO NOT return anything except the summary." + /// }, + /// { + /// "role": "user", + /// "content": "Here is the transcript:\n\n{{transcript}}\n\n" + /// } + /// ]``` /// /// You can customize by providing any messages you want. /// /// Here are the template variables available: - /// /// - {{transcript}}: The transcript of the call from `call.artifact.transcript`- {{systemPrompt}}: The system prompt of the call from `assistant.model.messages[type=system].content` /// [JsonPropertyName("messages")] @@ -25,7 +34,6 @@ public record SummaryPlan /// This determines whether a summary is generated and stored in `call.analysis.summary`. Defaults to true. /// /// Usage: - /// /// - If you want to disable the summary, set this to false. /// /// @default true @@ -37,7 +45,6 @@ public record SummaryPlan /// This is how long the request is tried before giving up. When request times out, `call.analysis.summary` will be empty. /// /// Usage: - /// /// - To guarantee the summary is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond. /// /// @default 5 seconds diff --git a/src/Vapi.Net/Types/SyncVoiceLibraryDtoProvidersItem.cs b/src/Vapi.Net/Types/SyncVoiceLibraryDtoProvidersItem.cs index f46e071..b328e7a 100644 --- a/src/Vapi.Net/Types/SyncVoiceLibraryDtoProvidersItem.cs +++ b/src/Vapi.Net/Types/SyncVoiceLibraryDtoProvidersItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum SyncVoiceLibraryDtoProvidersItem { [EnumMember(Value = "11labs")] @@ -38,4 +38,7 @@ public enum SyncVoiceLibraryDtoProvidersItem [EnumMember(Value = "rime-ai")] RimeAi, + + [EnumMember(Value = "tavus")] + Tavus, } diff --git a/src/Vapi.Net/Types/TalkscriberTranscriberLanguage.cs b/src/Vapi.Net/Types/TalkscriberTranscriberLanguage.cs index a681a90..f8902fc 100644 --- a/src/Vapi.Net/Types/TalkscriberTranscriberLanguage.cs +++ b/src/Vapi.Net/Types/TalkscriberTranscriberLanguage.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TalkscriberTranscriberLanguage { [EnumMember(Value = "en")] diff --git a/src/Vapi.Net/Types/TavusConversationProperties.cs b/src/Vapi.Net/Types/TavusConversationProperties.cs new file mode 100644 index 0000000..46b0ce9 --- /dev/null +++ b/src/Vapi.Net/Types/TavusConversationProperties.cs @@ -0,0 +1,82 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TavusConversationProperties +{ + /// + /// The maximum duration of the call in seconds. The default `maxCallDuration` is 3600 seconds (1 hour). + /// Once the time limit specified by this parameter has been reached, the conversation will automatically shut down. + /// + [JsonPropertyName("maxCallDuration")] + public double? MaxCallDuration { get; set; } + + /// + /// The duration in seconds after which the call will be automatically shut down once the last participant leaves. + /// + [JsonPropertyName("participantLeftTimeout")] + public double? ParticipantLeftTimeout { get; set; } + + /// + /// Starting from conversation creation, the duration in seconds after which the call will be automatically shut down if no participant joins the call. + /// Default is 300 seconds (5 minutes). + /// + [JsonPropertyName("participantAbsentTimeout")] + public double? ParticipantAbsentTimeout { get; set; } + + /// + /// If true, the user will be able to record the conversation. + /// + [JsonPropertyName("enableRecording")] + public bool? EnableRecording { get; set; } + + /// + /// If true, the user will be able to transcribe the conversation. + /// You can find more instructions on displaying transcriptions if you are using your custom DailyJS components here. + /// You need to have an event listener on Daily that listens for `app-messages`. + /// + [JsonPropertyName("enableTranscription")] + public bool? EnableTranscription { get; set; } + + /// + /// If true, the background will be replaced with a greenscreen (RGB values: `[0, 255, 155]`). + /// You can use WebGL on the frontend to make the greenscreen transparent or change its color. + /// + [JsonPropertyName("applyGreenscreen")] + public bool? ApplyGreenscreen { get; set; } + + /// + /// The language of the conversation. Please provide the **full language name**, not the two-letter code. + /// If you are using your own TTS voice, please ensure it supports the language you provide. + /// If you are using a stock replica or default persona, please note that only ElevenLabs and Cartesia supported languages are available. + /// You can find a full list of supported languages for Cartesia here, for ElevenLabs here, and for PlayHT here. + /// + [JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// The name of the S3 bucket where the recording will be stored. + /// + [JsonPropertyName("recordingS3BucketName")] + public string? RecordingS3BucketName { get; set; } + + /// + /// The region of the S3 bucket where the recording will be stored. + /// + [JsonPropertyName("recordingS3BucketRegion")] + public string? RecordingS3BucketRegion { get; set; } + + /// + /// The ARN of the role that will be assumed to access the S3 bucket. + /// + [JsonPropertyName("awsAssumeRoleArn")] + public string? AwsAssumeRoleArn { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TavusCredential.cs b/src/Vapi.Net/Types/TavusCredential.cs new file mode 100644 index 0000000..b603870 --- /dev/null +++ b/src/Vapi.Net/Types/TavusCredential.cs @@ -0,0 +1,53 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TavusCredential +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TavusVoice.cs b/src/Vapi.Net/Types/TavusVoice.cs new file mode 100644 index 0000000..a6279b8 --- /dev/null +++ b/src/Vapi.Net/Types/TavusVoice.cs @@ -0,0 +1,69 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TavusVoice +{ + /// + /// This is the provider-specific ID that will be used. + /// + [JsonPropertyName("voiceId")] + public required OneOf VoiceId { get; set; } + + /// + /// This is the plan for chunking the model output before it is sent to the voice provider. + /// + [JsonPropertyName("chunkPlan")] + public ChunkPlan? ChunkPlan { get; set; } + + /// + /// This is the unique identifier for the persona that the replica will use in the conversation. + /// + [JsonPropertyName("personaId")] + public string? PersonaId { get; set; } + + /// + /// This is the url that will receive webhooks with updates regarding the conversation state. + /// + [JsonPropertyName("callbackUrl")] + public string? CallbackUrl { get; set; } + + /// + /// This is the name for the conversation. + /// + [JsonPropertyName("conversationName")] + public string? ConversationName { get; set; } + + /// + /// This is the context that will be appended to any context provided in the persona, if one is provided. + /// + [JsonPropertyName("conversationalContext")] + public string? ConversationalContext { get; set; } + + /// + /// This is the custom greeting that the replica will give once a participant joines the conversation. + /// + [JsonPropertyName("customGreeting")] + public string? CustomGreeting { get; set; } + + /// + /// These are optional properties used to customize the conversation. + /// + [JsonPropertyName("properties")] + public TavusConversationProperties? Properties { get; set; } + + /// + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + /// + [JsonPropertyName("fallbackPlan")] + public FallbackPlan? FallbackPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TemplateProvider.cs b/src/Vapi.Net/Types/TemplateProvider.cs index d6f939b..a8484ee 100644 --- a/src/Vapi.Net/Types/TemplateProvider.cs +++ b/src/Vapi.Net/Types/TemplateProvider.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TemplateProvider { [EnumMember(Value = "make")] diff --git a/src/Vapi.Net/Types/TemplateVisibility.cs b/src/Vapi.Net/Types/TemplateVisibility.cs index f8bdbc5..45074d4 100644 --- a/src/Vapi.Net/Types/TemplateVisibility.cs +++ b/src/Vapi.Net/Types/TemplateVisibility.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TemplateVisibility { [EnumMember(Value = "public")] diff --git a/src/Vapi.Net/Types/TextContent.cs b/src/Vapi.Net/Types/TextContent.cs new file mode 100644 index 0000000..90eaa62 --- /dev/null +++ b/src/Vapi.Net/Types/TextContent.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TextContent +{ + [JsonPropertyName("type")] + public required string Type { get; set; } + + [JsonPropertyName("text")] + public required string Text { get; set; } + + [JsonPropertyName("language")] + public required TextContentLanguage Language { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TextContentLanguage.cs b/src/Vapi.Net/Types/TextContentLanguage.cs new file mode 100644 index 0000000..86ee188 --- /dev/null +++ b/src/Vapi.Net/Types/TextContentLanguage.cs @@ -0,0 +1,566 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum TextContentLanguage +{ + [EnumMember(Value = "aa")] + Aa, + + [EnumMember(Value = "ab")] + Ab, + + [EnumMember(Value = "ae")] + Ae, + + [EnumMember(Value = "af")] + Af, + + [EnumMember(Value = "ak")] + Ak, + + [EnumMember(Value = "am")] + Am, + + [EnumMember(Value = "an")] + An, + + [EnumMember(Value = "ar")] + Ar, + + [EnumMember(Value = "as")] + As, + + [EnumMember(Value = "av")] + Av, + + [EnumMember(Value = "ay")] + Ay, + + [EnumMember(Value = "az")] + Az, + + [EnumMember(Value = "ba")] + Ba, + + [EnumMember(Value = "be")] + Be, + + [EnumMember(Value = "bg")] + Bg, + + [EnumMember(Value = "bh")] + Bh, + + [EnumMember(Value = "bi")] + Bi, + + [EnumMember(Value = "bm")] + Bm, + + [EnumMember(Value = "bn")] + Bn, + + [EnumMember(Value = "bo")] + Bo, + + [EnumMember(Value = "br")] + Br, + + [EnumMember(Value = "bs")] + Bs, + + [EnumMember(Value = "ca")] + Ca, + + [EnumMember(Value = "ce")] + Ce, + + [EnumMember(Value = "ch")] + Ch, + + [EnumMember(Value = "co")] + Co, + + [EnumMember(Value = "cr")] + Cr, + + [EnumMember(Value = "cs")] + Cs, + + [EnumMember(Value = "cu")] + Cu, + + [EnumMember(Value = "cv")] + Cv, + + [EnumMember(Value = "cy")] + Cy, + + [EnumMember(Value = "da")] + Da, + + [EnumMember(Value = "de")] + De, + + [EnumMember(Value = "dv")] + Dv, + + [EnumMember(Value = "dz")] + Dz, + + [EnumMember(Value = "ee")] + Ee, + + [EnumMember(Value = "el")] + El, + + [EnumMember(Value = "en")] + En, + + [EnumMember(Value = "eo")] + Eo, + + [EnumMember(Value = "es")] + Es, + + [EnumMember(Value = "et")] + Et, + + [EnumMember(Value = "eu")] + Eu, + + [EnumMember(Value = "fa")] + Fa, + + [EnumMember(Value = "ff")] + Ff, + + [EnumMember(Value = "fi")] + Fi, + + [EnumMember(Value = "fj")] + Fj, + + [EnumMember(Value = "fo")] + Fo, + + [EnumMember(Value = "fr")] + Fr, + + [EnumMember(Value = "fy")] + Fy, + + [EnumMember(Value = "ga")] + Ga, + + [EnumMember(Value = "gd")] + Gd, + + [EnumMember(Value = "gl")] + Gl, + + [EnumMember(Value = "gn")] + Gn, + + [EnumMember(Value = "gu")] + Gu, + + [EnumMember(Value = "gv")] + Gv, + + [EnumMember(Value = "ha")] + Ha, + + [EnumMember(Value = "he")] + He, + + [EnumMember(Value = "hi")] + Hi, + + [EnumMember(Value = "ho")] + Ho, + + [EnumMember(Value = "hr")] + Hr, + + [EnumMember(Value = "ht")] + Ht, + + [EnumMember(Value = "hu")] + Hu, + + [EnumMember(Value = "hy")] + Hy, + + [EnumMember(Value = "hz")] + Hz, + + [EnumMember(Value = "ia")] + Ia, + + [EnumMember(Value = "id")] + Id, + + [EnumMember(Value = "ie")] + Ie, + + [EnumMember(Value = "ig")] + Ig, + + [EnumMember(Value = "ii")] + Ii, + + [EnumMember(Value = "ik")] + Ik, + + [EnumMember(Value = "io")] + Io, + + [EnumMember(Value = "is")] + Is, + + [EnumMember(Value = "it")] + It, + + [EnumMember(Value = "iu")] + Iu, + + [EnumMember(Value = "ja")] + Ja, + + [EnumMember(Value = "jv")] + Jv, + + [EnumMember(Value = "ka")] + Ka, + + [EnumMember(Value = "kg")] + Kg, + + [EnumMember(Value = "ki")] + Ki, + + [EnumMember(Value = "kj")] + Kj, + + [EnumMember(Value = "kk")] + Kk, + + [EnumMember(Value = "kl")] + Kl, + + [EnumMember(Value = "km")] + Km, + + [EnumMember(Value = "kn")] + Kn, + + [EnumMember(Value = "ko")] + Ko, + + [EnumMember(Value = "kr")] + Kr, + + [EnumMember(Value = "ks")] + Ks, + + [EnumMember(Value = "ku")] + Ku, + + [EnumMember(Value = "kv")] + Kv, + + [EnumMember(Value = "kw")] + Kw, + + [EnumMember(Value = "ky")] + Ky, + + [EnumMember(Value = "la")] + La, + + [EnumMember(Value = "lb")] + Lb, + + [EnumMember(Value = "lg")] + Lg, + + [EnumMember(Value = "li")] + Li, + + [EnumMember(Value = "ln")] + Ln, + + [EnumMember(Value = "lo")] + Lo, + + [EnumMember(Value = "lt")] + Lt, + + [EnumMember(Value = "lu")] + Lu, + + [EnumMember(Value = "lv")] + Lv, + + [EnumMember(Value = "mg")] + Mg, + + [EnumMember(Value = "mh")] + Mh, + + [EnumMember(Value = "mi")] + Mi, + + [EnumMember(Value = "mk")] + Mk, + + [EnumMember(Value = "ml")] + Ml, + + [EnumMember(Value = "mn")] + Mn, + + [EnumMember(Value = "mr")] + Mr, + + [EnumMember(Value = "ms")] + Ms, + + [EnumMember(Value = "mt")] + Mt, + + [EnumMember(Value = "my")] + My, + + [EnumMember(Value = "na")] + Na, + + [EnumMember(Value = "nb")] + Nb, + + [EnumMember(Value = "nd")] + Nd, + + [EnumMember(Value = "ne")] + Ne, + + [EnumMember(Value = "ng")] + Ng, + + [EnumMember(Value = "nl")] + Nl, + + [EnumMember(Value = "nn")] + Nn, + + [EnumMember(Value = "no")] + No, + + [EnumMember(Value = "nr")] + Nr, + + [EnumMember(Value = "nv")] + Nv, + + [EnumMember(Value = "ny")] + Ny, + + [EnumMember(Value = "oc")] + Oc, + + [EnumMember(Value = "oj")] + Oj, + + [EnumMember(Value = "om")] + Om, + + [EnumMember(Value = "or")] + Or, + + [EnumMember(Value = "os")] + Os, + + [EnumMember(Value = "pa")] + Pa, + + [EnumMember(Value = "pi")] + Pi, + + [EnumMember(Value = "pl")] + Pl, + + [EnumMember(Value = "ps")] + Ps, + + [EnumMember(Value = "pt")] + Pt, + + [EnumMember(Value = "qu")] + Qu, + + [EnumMember(Value = "rm")] + Rm, + + [EnumMember(Value = "rn")] + Rn, + + [EnumMember(Value = "ro")] + Ro, + + [EnumMember(Value = "ru")] + Ru, + + [EnumMember(Value = "rw")] + Rw, + + [EnumMember(Value = "sa")] + Sa, + + [EnumMember(Value = "sc")] + Sc, + + [EnumMember(Value = "sd")] + Sd, + + [EnumMember(Value = "se")] + Se, + + [EnumMember(Value = "sg")] + Sg, + + [EnumMember(Value = "si")] + Si, + + [EnumMember(Value = "sk")] + Sk, + + [EnumMember(Value = "sl")] + Sl, + + [EnumMember(Value = "sm")] + Sm, + + [EnumMember(Value = "sn")] + Sn, + + [EnumMember(Value = "so")] + So, + + [EnumMember(Value = "sq")] + Sq, + + [EnumMember(Value = "sr")] + Sr, + + [EnumMember(Value = "ss")] + Ss, + + [EnumMember(Value = "st")] + St, + + [EnumMember(Value = "su")] + Su, + + [EnumMember(Value = "sv")] + Sv, + + [EnumMember(Value = "sw")] + Sw, + + [EnumMember(Value = "ta")] + Ta, + + [EnumMember(Value = "te")] + Te, + + [EnumMember(Value = "tg")] + Tg, + + [EnumMember(Value = "th")] + Th, + + [EnumMember(Value = "ti")] + Ti, + + [EnumMember(Value = "tk")] + Tk, + + [EnumMember(Value = "tl")] + Tl, + + [EnumMember(Value = "tn")] + Tn, + + [EnumMember(Value = "to")] + To, + + [EnumMember(Value = "tr")] + Tr, + + [EnumMember(Value = "ts")] + Ts, + + [EnumMember(Value = "tt")] + Tt, + + [EnumMember(Value = "tw")] + Tw, + + [EnumMember(Value = "ty")] + Ty, + + [EnumMember(Value = "ug")] + Ug, + + [EnumMember(Value = "uk")] + Uk, + + [EnumMember(Value = "ur")] + Ur, + + [EnumMember(Value = "uz")] + Uz, + + [EnumMember(Value = "ve")] + Ve, + + [EnumMember(Value = "vi")] + Vi, + + [EnumMember(Value = "vo")] + Vo, + + [EnumMember(Value = "wa")] + Wa, + + [EnumMember(Value = "wo")] + Wo, + + [EnumMember(Value = "xh")] + Xh, + + [EnumMember(Value = "yi")] + Yi, + + [EnumMember(Value = "yue")] + Yue, + + [EnumMember(Value = "yo")] + Yo, + + [EnumMember(Value = "za")] + Za, + + [EnumMember(Value = "zh")] + Zh, + + [EnumMember(Value = "zu")] + Zu, +} diff --git a/src/Vapi.Net/Types/TextEditorTool.cs b/src/Vapi.Net/Types/TextEditorTool.cs new file mode 100644 index 0000000..99aa082 --- /dev/null +++ b/src/Vapi.Net/Types/TextEditorTool.cs @@ -0,0 +1,90 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TextEditorTool +{ + /// + /// This determines if the tool is async. + /// + /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + /// + /// If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + /// + /// Defaults to synchronous (`false`). + /// + [JsonPropertyName("async")] + public bool? Async { get; set; } + + /// + /// These are the messages that will be spoken to the user as the tool is running. + /// + /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// The sub type of tool. + /// + [JsonPropertyName("subType")] + public required string SubType { get; set; } + + /// + /// This is the unique identifier for the tool. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the organization that this tool belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the tool was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the tool was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the function definition of the tool. + /// + /// For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + /// + /// An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + /// + [JsonPropertyName("function")] + public OpenAiFunction? Function { get; set; } + + /// + /// This is the server that will be hit when this tool is requested by the model. + /// + /// All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + /// + /// This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + /// + [JsonPropertyName("server")] + public Server? Server { get; set; } + + /// + /// The name of the tool, fixed to 'str_replace_editor' + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TimeRangeStep.cs b/src/Vapi.Net/Types/TimeRangeStep.cs index f6a7587..cc53637 100644 --- a/src/Vapi.Net/Types/TimeRangeStep.cs +++ b/src/Vapi.Net/Types/TimeRangeStep.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TimeRangeStep { [EnumMember(Value = "minute")] diff --git a/src/Vapi.Net/Types/TogetherAiCredential.cs b/src/Vapi.Net/Types/TogetherAiCredential.cs index 63455ef..fcfc0d1 100644 --- a/src/Vapi.Net/Types/TogetherAiCredential.cs +++ b/src/Vapi.Net/Types/TogetherAiCredential.cs @@ -40,6 +40,12 @@ public record TogetherAiCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/TogetherAiModel.cs b/src/Vapi.Net/Types/TogetherAiModel.cs index baf9cf3..abd0a5e 100644 --- a/src/Vapi.Net/Types/TogetherAiModel.cs +++ b/src/Vapi.Net/Types/TogetherAiModel.cs @@ -29,6 +29,18 @@ public record TogetherAiModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + /// /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b /// @@ -41,12 +53,6 @@ public record TogetherAiModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/TokenTag.cs b/src/Vapi.Net/Types/TokenTag.cs index 1c0464a..8d6c0a6 100644 --- a/src/Vapi.Net/Types/TokenTag.cs +++ b/src/Vapi.Net/Types/TokenTag.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TokenTag { [EnumMember(Value = "private")] diff --git a/src/Vapi.Net/Types/ToolCallBlock.cs b/src/Vapi.Net/Types/ToolCallBlock.cs index 05c7991..ed7a216 100644 --- a/src/Vapi.Net/Types/ToolCallBlock.cs +++ b/src/Vapi.Net/Types/ToolCallBlock.cs @@ -17,7 +17,6 @@ public record ToolCallBlock /// This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input` /// /// These are accessible as variables: - /// /// - ({{input.propertyName}}) in context of the block execution (step) /// - ({{stepName.input.propertyName}}) in context of the workflow /// @@ -28,13 +27,11 @@ public record ToolCallBlock /// This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`). /// /// These are accessible as variables: - /// /// - ({{output.propertyName}}) in context of the block execution (step) /// - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) /// - ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2) /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/ToolCallResult.cs b/src/Vapi.Net/Types/ToolCallResult.cs index 40007e1..adf4a3f 100644 --- a/src/Vapi.Net/Types/ToolCallResult.cs +++ b/src/Vapi.Net/Types/ToolCallResult.cs @@ -11,7 +11,6 @@ public record ToolCallResult /// This is the message that will be spoken to the user. /// /// If this is not returned, assistant will speak: - /// /// 1. a `request-complete` or `request-failed` message from `tool.messages`, if it exists /// 2. a response generated by the model, if not /// @@ -34,7 +33,6 @@ public record ToolCallResult /// This is the result if the tool call was successful. This is added to the conversation history. /// /// Further, if this is returned, assistant will speak: - /// /// 1. the `message`, if it exists and is of type `request-complete` /// 2. a `request-complete` message from `tool.messages`, if it exists /// 3. a response generated by the model, if neither exist @@ -46,7 +44,6 @@ public record ToolCallResult /// This is the error if the tool call was not successful. This is added to the conversation history. /// /// Further, if this is returned, assistant will speak: - /// /// 1. the `message`, if it exists and is of type `request-failed` /// 2. a `request-failed` message from `tool.messages`, if it exists /// 3. a response generated by the model, if neither exist diff --git a/src/Vapi.Net/Types/ToolMessageComplete.cs b/src/Vapi.Net/Types/ToolMessageComplete.cs index 0ed7ac1..7c74a11 100644 --- a/src/Vapi.Net/Types/ToolMessageComplete.cs +++ b/src/Vapi.Net/Types/ToolMessageComplete.cs @@ -7,23 +7,35 @@ namespace Vapi.Net; public record ToolMessageComplete { + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + /// /// This is optional and defaults to "assistant". /// /// When role=assistant, `content` is said out loud. /// /// When role=system, `content` is passed to the model in a system message. Example: - /// system: default one - /// assistant: - /// user: - /// assistant: - /// user: - /// assistant: - /// user: - /// assistant: tool called - /// tool: your server response - /// <--- system prompt as hint - /// ---> model generates response which is spoken + /// system: default one + /// assistant: + /// user: + /// assistant: + /// user: + /// assistant: + /// user: + /// assistant: tool called + /// tool: your server response + /// <--- system prompt as hint + /// ---> model generates response which is spoken /// This is useful when you want to provide a hint to the model about what to say next. /// [JsonPropertyName("role")] @@ -43,7 +55,7 @@ public record ToolMessageComplete /// This is the content that the assistant says when this message is triggered. /// [JsonPropertyName("content")] - public required string Content { get; set; } + public string? Content { get; set; } /// /// This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. diff --git a/src/Vapi.Net/Types/ToolMessageCompleteRole.cs b/src/Vapi.Net/Types/ToolMessageCompleteRole.cs index 7ecf1a2..5602b09 100644 --- a/src/Vapi.Net/Types/ToolMessageCompleteRole.cs +++ b/src/Vapi.Net/Types/ToolMessageCompleteRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum ToolMessageCompleteRole { [EnumMember(Value = "assistant")] diff --git a/src/Vapi.Net/Types/ToolMessageDelayed.cs b/src/Vapi.Net/Types/ToolMessageDelayed.cs index 9782ec2..186badd 100644 --- a/src/Vapi.Net/Types/ToolMessageDelayed.cs +++ b/src/Vapi.Net/Types/ToolMessageDelayed.cs @@ -7,6 +7,18 @@ namespace Vapi.Net; public record ToolMessageDelayed { + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + /// /// The number of milliseconds to wait for the server response before saying this message. /// @@ -17,7 +29,7 @@ public record ToolMessageDelayed /// This is the content that the assistant says when this message is triggered. /// [JsonPropertyName("content")] - public required string Content { get; set; } + public string? Content { get; set; } /// /// This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. diff --git a/src/Vapi.Net/Types/ToolMessageFailed.cs b/src/Vapi.Net/Types/ToolMessageFailed.cs index b21c4ca..476e4e6 100644 --- a/src/Vapi.Net/Types/ToolMessageFailed.cs +++ b/src/Vapi.Net/Types/ToolMessageFailed.cs @@ -7,6 +7,18 @@ namespace Vapi.Net; public record ToolMessageFailed { + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + /// /// This is an optional boolean that if true, the call will end after the message is spoken. Default is false. /// @@ -19,7 +31,7 @@ public record ToolMessageFailed /// This is the content that the assistant says when this message is triggered. /// [JsonPropertyName("content")] - public required string Content { get; set; } + public string? Content { get; set; } /// /// This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. diff --git a/src/Vapi.Net/Types/ToolMessageStart.cs b/src/Vapi.Net/Types/ToolMessageStart.cs index 35f3aeb..60de987 100644 --- a/src/Vapi.Net/Types/ToolMessageStart.cs +++ b/src/Vapi.Net/Types/ToolMessageStart.cs @@ -7,11 +7,23 @@ namespace Vapi.Net; public record ToolMessageStart { + /// + /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. + /// + /// Usage: + /// - If your assistants are multilingual, you can provide content for each language. + /// - If you don't provide content for a language, the first item in the array will be automatically translated to the active language at that moment. + /// + /// This will override the `content` property. + /// + [JsonPropertyName("contents")] + public IEnumerable? Contents { get; set; } + /// /// This is the content that the assistant says when this message is triggered. /// [JsonPropertyName("content")] - public required string Content { get; set; } + public string? Content { get; set; } /// /// This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. diff --git a/src/Vapi.Net/Types/TranscriberCost.cs b/src/Vapi.Net/Types/TranscriberCost.cs index 2e3f89f..7c2803c 100644 --- a/src/Vapi.Net/Types/TranscriberCost.cs +++ b/src/Vapi.Net/Types/TranscriberCost.cs @@ -11,13 +11,12 @@ public record TranscriberCost /// This is the transcriber that was used during the call. /// /// This matches one of the below: - /// /// - `call.assistant.transcriber`, - /// - `call.assistantId->transcriber`, + /// - `call.assistantId->transcriber`, /// - `call.squad[n].assistant.transcriber`, - /// - `call.squad[n].assistantId->transcriber`, - /// - `call.squadId->[n].assistant.transcriber`, - /// - `call.squadId->[n].assistantId->transcriber`. + /// - `call.squad[n].assistantId->transcriber`, + /// - `call.squadId->[n].assistant.transcriber`, + /// - `call.squadId->[n].assistantId->transcriber`. /// [JsonPropertyName("transcriber")] public object Transcriber { get; set; } = new Dictionary(); diff --git a/src/Vapi.Net/Types/TranscriptPlan.cs b/src/Vapi.Net/Types/TranscriptPlan.cs index f17aa32..2b0e168 100644 --- a/src/Vapi.Net/Types/TranscriptPlan.cs +++ b/src/Vapi.Net/Types/TranscriptPlan.cs @@ -19,9 +19,7 @@ public record TranscriptPlan /// This is the name of the assistant in the transcript. Defaults to 'AI'. /// /// Usage: - /// /// - If you want to change the name of the assistant in the transcript, set this. Example, here is what the transcript would look like with `assistantName` set to 'Buyer': - /// /// ``` /// User: Hello, how are you? /// Buyer: I'm fine. @@ -38,9 +36,7 @@ public record TranscriptPlan /// This is the name of the user in the transcript. Defaults to 'User'. /// /// Usage: - /// /// - If you want to change the name of the user in the transcript, set this. Example, here is what the transcript would look like with `userName` set to 'Seller': - /// /// ``` /// Seller: Hello, how are you? /// AI: I'm fine. diff --git a/src/Vapi.Net/Types/TransferDestinationAssistant.cs b/src/Vapi.Net/Types/TransferDestinationAssistant.cs index fff38a1..926e325 100644 --- a/src/Vapi.Net/Types/TransferDestinationAssistant.cs +++ b/src/Vapi.Net/Types/TransferDestinationAssistant.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using OneOf; using Vapi.Net.Core; #nullable enable @@ -8,50 +9,83 @@ namespace Vapi.Net; public record TransferDestinationAssistant { /// - /// This is the mode to use for the transfer. Default is `rolling-history`. + /// This is spoken to the customer before connecting them to the destination. + /// + /// Usage: + /// - If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". + /// - If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. + /// + /// This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the `contents` field. + /// + [JsonPropertyName("message")] + public OneOf? Message { get; set; } + + /// + /// This is the mode to use for the transfer. Defaults to `rolling-history`. /// /// - `rolling-history`: This is the default mode. It keeps the entire conversation history and appends the new assistant's system message on transfer. /// /// Example: /// /// Pre-transfer: - /// system: assistant1 system message - /// assistant: assistant1 first message - /// user: hey, good morning - /// assistant: how can i help? - /// user: i need help with my account - /// assistant: (destination.message) + /// system: assistant1 system message + /// assistant: assistant1 first message + /// user: hey, good morning + /// assistant: how can i help? + /// user: i need help with my account + /// assistant: (destination.message) /// /// Post-transfer: - /// system: assistant1 system message - /// assistant: assistant1 first message - /// user: hey, good morning - /// assistant: how can i help? - /// user: i need help with my account - /// assistant: (destination.message) - /// system: assistant2 system message - /// assistant: assistant2 first message (or model generated if firstMessageMode is set to `assistant-speaks-first-with-model-generated-message`) + /// system: assistant1 system message + /// assistant: assistant1 first message + /// user: hey, good morning + /// assistant: how can i help? + /// user: i need help with my account + /// assistant: (destination.message) + /// system: assistant2 system message + /// assistant: assistant2 first message (or model generated if firstMessageMode is set to `assistant-speaks-first-with-model-generated-message`) /// /// - `swap-system-message-in-history`: This replaces the original system message with the new assistant's system message on transfer. /// /// Example: /// /// Pre-transfer: - /// system: assistant1 system message - /// assistant: assistant1 first message - /// user: hey, good morning - /// assistant: how can i help? - /// user: i need help with my account - /// assistant: (destination.message) + /// system: assistant1 system message + /// assistant: assistant1 first message + /// user: hey, good morning + /// assistant: how can i help? + /// user: i need help with my account + /// assistant: (destination.message) + /// + /// Post-transfer: + /// system: assistant2 system message + /// assistant: assistant1 first message + /// user: hey, good morning + /// assistant: how can i help? + /// user: i need help with my account + /// assistant: (destination.message) + /// assistant: assistant2 first message (or model generated if firstMessageMode is set to `assistant-speaks-first-with-model-generated-message`) + /// + /// - `delete-history`: This deletes the entire conversation history on transfer. + /// + /// Example: + /// + /// Pre-transfer: + /// system: assistant1 system message + /// assistant: assistant1 first message + /// user: hey, good morning + /// assistant: how can i help? + /// user: i need help with my account + /// assistant: (destination.message) /// /// Post-transfer: - /// system: assistant2 system message - /// assistant: assistant1 first message - /// user: hey, good morning - /// assistant: how can i help? - /// user: i need help with my account - /// assistant: (destination.message) - /// assistant: assistant2 first message (or model generated if firstMessageMode is set to `assistant-speaks-first-with-model-generated-message`) + /// system: assistant2 system message + /// assistant: assistant2 first message + /// user: Yes, please + /// assistant: how can i help? + /// user: i need help with my account + /// + /// @default 'rolling-history' /// [JsonPropertyName("transferMode")] public TransferMode? TransferMode { get; set; } @@ -62,16 +96,6 @@ public record TransferDestinationAssistant [JsonPropertyName("assistantName")] public required string AssistantName { get; set; } - /// - /// This is the message to say before transferring the call to the destination. - /// - /// If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". - /// - /// If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. - /// - [JsonPropertyName("message")] - public string? Message { get; set; } - /// /// This is the description of the destination, used by the AI to choose when and how to transfer the call. /// diff --git a/src/Vapi.Net/Types/TransferDestinationNumber.cs b/src/Vapi.Net/Types/TransferDestinationNumber.cs index 2320f51..2ba7246 100644 --- a/src/Vapi.Net/Types/TransferDestinationNumber.cs +++ b/src/Vapi.Net/Types/TransferDestinationNumber.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using OneOf; using Vapi.Net.Core; #nullable enable @@ -7,11 +8,22 @@ namespace Vapi.Net; public record TransferDestinationNumber { + /// + /// This is spoken to the customer before connecting them to the destination. + /// + /// Usage: + /// - If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". + /// - If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. + /// + /// This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the `contents` field. + /// + [JsonPropertyName("message")] + public OneOf? Message { get; set; } + /// /// This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it. /// /// Use cases: - /// /// - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks. /// - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls. /// @@ -38,7 +50,6 @@ public record TransferDestinationNumber /// This is the caller ID to use when transferring the call to the `number`. /// /// Usage: - /// /// - If not provided, the caller ID will be the number the call is coming from. Example, +14151111111 calls in to and the assistant transfers out to +16470000000. +16470000000 will see +14151111111 as the caller. /// - To change this behavior, provide a `callerId`. /// - Set to '{{customer.number}}' to always use the customer's number as the caller ID. @@ -51,14 +62,12 @@ public record TransferDestinationNumber public string? CallerId { get; set; } /// - /// This is the message to say before transferring the call to the destination. + /// This configures how transfer is executed and the experience of the destination party receiving the call. Defaults to `blind-transfer`. /// - /// If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". - /// - /// If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. + /// @default `transferPlan.mode='blind-transfer'` /// - [JsonPropertyName("message")] - public string? Message { get; set; } + [JsonPropertyName("transferPlan")] + public TransferPlan? TransferPlan { get; set; } /// /// This is the description of the destination, used by the AI to choose when and how to transfer the call. diff --git a/src/Vapi.Net/Types/TransferDestinationSip.cs b/src/Vapi.Net/Types/TransferDestinationSip.cs index dc41a32..4e4e3a5 100644 --- a/src/Vapi.Net/Types/TransferDestinationSip.cs +++ b/src/Vapi.Net/Types/TransferDestinationSip.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using OneOf; using Vapi.Net.Core; #nullable enable @@ -7,6 +8,18 @@ namespace Vapi.Net; public record TransferDestinationSip { + /// + /// This is spoken to the customer before connecting them to the destination. + /// + /// Usage: + /// - If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". + /// - If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. + /// + /// This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the `contents` field. + /// + [JsonPropertyName("message")] + public OneOf? Message { get; set; } + /// /// This is the SIP URI to transfer the call to. /// @@ -14,14 +27,18 @@ public record TransferDestinationSip public required string SipUri { get; set; } /// - /// This is the message to say before transferring the call to the destination. + /// This configures how transfer is executed and the experience of the destination party receiving the call. Defaults to `blind-transfer`. /// - /// If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". - /// - /// If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. + /// @default `transferPlan.mode='blind-transfer'` /// - [JsonPropertyName("message")] - public string? Message { get; set; } + [JsonPropertyName("transferPlan")] + public TransferPlan? TransferPlan { get; set; } + + /// + /// These are custom headers to be added to SIP refer during transfer call. + /// + [JsonPropertyName("sipHeaders")] + public object? SipHeaders { get; set; } /// /// This is the description of the destination, used by the AI to choose when and how to transfer the call. diff --git a/src/Vapi.Net/Types/TransferDestinationStep.cs b/src/Vapi.Net/Types/TransferDestinationStep.cs index 8cf5cbb..930b4fb 100644 --- a/src/Vapi.Net/Types/TransferDestinationStep.cs +++ b/src/Vapi.Net/Types/TransferDestinationStep.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using OneOf; using Vapi.Net.Core; #nullable enable @@ -8,20 +9,22 @@ namespace Vapi.Net; public record TransferDestinationStep { /// - /// This is the step to transfer to. - /// - [JsonPropertyName("stepName")] - public required string StepName { get; set; } - - /// - /// This is the message to say before transferring the call to the destination. + /// This is spoken to the customer before connecting them to the destination. /// - /// If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". + /// Usage: + /// - If this is not provided and transfer tool messages is not provided, default is "Transferring the call now". + /// - If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. /// - /// If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. + /// This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the `contents` field. /// [JsonPropertyName("message")] - public string? Message { get; set; } + public OneOf? Message { get; set; } + + /// + /// This is the step to transfer to. + /// + [JsonPropertyName("stepName")] + public required string StepName { get; set; } /// /// This is the description of the destination, used by the AI to choose when and how to transfer the call. diff --git a/src/Vapi.Net/Types/TransferMode.cs b/src/Vapi.Net/Types/TransferMode.cs index 6cdde8d..64423c3 100644 --- a/src/Vapi.Net/Types/TransferMode.cs +++ b/src/Vapi.Net/Types/TransferMode.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TransferMode { [EnumMember(Value = "rolling-history")] diff --git a/src/Vapi.Net/Types/TransferPlan.cs b/src/Vapi.Net/Types/TransferPlan.cs new file mode 100644 index 0000000..d7fef6b --- /dev/null +++ b/src/Vapi.Net/Types/TransferPlan.cs @@ -0,0 +1,49 @@ +using System.Text.Json.Serialization; +using OneOf; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TransferPlan +{ + /// + /// This configures how transfer is executed and the experience of the destination party receiving the call. + /// + /// Usage: + /// - `blind-transfer`: The assistant forwards the call to the destination without any message or summary. + /// - `blind-transfer-add-summary-to-sip-header`: The assistant forwards the call to the destination and adds a SIP header X-Transfer-Summary to the call to include the summary. + /// - `warm-transfer-say-message`: The assistant dials the destination, delivers the `message` to the destination party, connects the customer, and leaves the call. + /// - `warm-transfer-say-summary`: The assistant dials the destination, provides a summary of the call to the destination party, connects the customer, and leaves the call. + /// - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`: The assistant dials the destination, waits for the operator to speak, delivers the `message` to the destination party, and then connects the customer. + /// - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The assistant dials the destination, waits for the operator to speak, provides a summary of the call to the destination party, and then connects the customer. + /// + /// @default 'blind-transfer' + /// + [JsonPropertyName("mode")] + public required TransferPlanMode Mode { get; set; } + + /// + /// This is the message the assistant will deliver to the destination party before connecting the customer. + /// + /// Usage: + /// - Used only when `mode` is `warm-transfer-say-message` or `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. + /// + [JsonPropertyName("message")] + public OneOf? Message { get; set; } + + /// + /// This is the plan for generating a summary of the call to present to the destination party. + /// + /// Usage: + /// - Used only when `mode` is `warm-transfer-say-summary` or `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`. + /// + [JsonPropertyName("summaryPlan")] + public SummaryPlan? SummaryPlan { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TransferPlanMode.cs b/src/Vapi.Net/Types/TransferPlanMode.cs new file mode 100644 index 0000000..fc4f3ce --- /dev/null +++ b/src/Vapi.Net/Types/TransferPlanMode.cs @@ -0,0 +1,29 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum TransferPlanMode +{ + [EnumMember(Value = "blind-transfer")] + BlindTransfer, + + [EnumMember(Value = "blind-transfer-add-summary-to-sip-header")] + BlindTransferAddSummaryToSipHeader, + + [EnumMember(Value = "warm-transfer-say-message")] + WarmTransferSayMessage, + + [EnumMember(Value = "warm-transfer-say-summary")] + WarmTransferSaySummary, + + [EnumMember(Value = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message")] + WarmTransferWaitForOperatorToSpeakFirstAndThenSayMessage, + + [EnumMember(Value = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary")] + WarmTransferWaitForOperatorToSpeakFirstAndThenSaySummary, +} diff --git a/src/Vapi.Net/Types/Transport.cs b/src/Vapi.Net/Types/Transport.cs new file mode 100644 index 0000000..08ec1f9 --- /dev/null +++ b/src/Vapi.Net/Types/Transport.cs @@ -0,0 +1,28 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record Transport +{ + /// + /// This is the provider used for the call. + /// + [JsonPropertyName("provider")] + public TransportProvider? Provider { get; set; } + + /// + /// This is determines whether the assistant will have video enabled. + /// + /// Only relevant for `webCall` type. + /// + [JsonPropertyName("assistantVideoEnabled")] + public bool? AssistantVideoEnabled { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TransportConfigurationTwilioRecordingChannels.cs b/src/Vapi.Net/Types/TransportConfigurationTwilioRecordingChannels.cs index 91036bc..9515efc 100644 --- a/src/Vapi.Net/Types/TransportConfigurationTwilioRecordingChannels.cs +++ b/src/Vapi.Net/Types/TransportConfigurationTwilioRecordingChannels.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TransportConfigurationTwilioRecordingChannels { [EnumMember(Value = "mono")] diff --git a/src/Vapi.Net/Types/TransportCost.cs b/src/Vapi.Net/Types/TransportCost.cs index 2b9c986..3509bc0 100644 --- a/src/Vapi.Net/Types/TransportCost.cs +++ b/src/Vapi.Net/Types/TransportCost.cs @@ -7,6 +7,9 @@ namespace Vapi.Net; public record TransportCost { + [JsonPropertyName("provider")] + public TransportCostProvider? Provider { get; set; } + /// /// This is the minutes of `transport` usage. This should match `call.endedAt` - `call.startedAt`. /// diff --git a/src/Vapi.Net/Types/TransportCostProvider.cs b/src/Vapi.Net/Types/TransportCostProvider.cs new file mode 100644 index 0000000..6b061e1 --- /dev/null +++ b/src/Vapi.Net/Types/TransportCostProvider.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum TransportCostProvider +{ + [EnumMember(Value = "twilio")] + Twilio, + + [EnumMember(Value = "vonage")] + Vonage, + + [EnumMember(Value = "vapi")] + Vapi, +} diff --git a/src/Vapi.Net/Types/TransportProvider.cs b/src/Vapi.Net/Types/TransportProvider.cs new file mode 100644 index 0000000..e1c5146 --- /dev/null +++ b/src/Vapi.Net/Types/TransportProvider.cs @@ -0,0 +1,23 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum TransportProvider +{ + [EnumMember(Value = "twilio")] + Twilio, + + [EnumMember(Value = "vonage")] + Vonage, + + [EnumMember(Value = "vapi")] + Vapi, + + [EnumMember(Value = "daily")] + Daily, +} diff --git a/src/Vapi.Net/Types/TrieveKnowledgeBase.cs b/src/Vapi.Net/Types/TrieveKnowledgeBase.cs new file mode 100644 index 0000000..25eb01c --- /dev/null +++ b/src/Vapi.Net/Types/TrieveKnowledgeBase.cs @@ -0,0 +1,54 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TrieveKnowledgeBase +{ + /// + /// This is the name of the knowledge base. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// This is the plan on how to search the vector store while a call is going on. + /// + [JsonPropertyName("vectorStoreSearchPlan")] + public required TrieveKnowledgeBaseVectorStoreSearchPlan VectorStoreSearchPlan { get; set; } + + /// + /// This is the plan if you want us to create a new vector store on your behalf. To use an existing vector store from your account, use `vectoreStoreProviderId` + /// + [JsonPropertyName("vectorStoreCreatePlan")] + public TrieveKnowledgeBaseVectorStoreCreatePlan? VectorStoreCreatePlan { get; set; } + + /// + /// This is an vector store that you already have on your account with the provider. To create a new vector store, use vectorStoreCreatePlan. + /// + /// Usage: + /// - To bring your own vector store from Trieve, go to https://trieve.ai + /// - Create a dataset, and use the datasetId here. + /// + [JsonPropertyName("vectorStoreProviderId")] + public string? VectorStoreProviderId { get; set; } + + /// + /// This is the id of the knowledge base. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the org id of the knowledge base. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreCreatePlan.cs b/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreCreatePlan.cs new file mode 100644 index 0000000..a6010d7 --- /dev/null +++ b/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreCreatePlan.cs @@ -0,0 +1,38 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TrieveKnowledgeBaseVectorStoreCreatePlan +{ + /// + /// These are the file ids that will be used to create the vector store. To upload files, use the `POST /files` endpoint. + /// + [JsonPropertyName("fileIds")] + public IEnumerable FileIds { get; set; } = new List(); + + /// + /// This is an optional field which allows you to specify the number of splits you want per chunk. If not specified, the default 20 is used. However, you may want to use a different number. + /// + [JsonPropertyName("targetSplitsPerChunk")] + public double? TargetSplitsPerChunk { get; set; } + + /// + /// This is an optional field which allows you to specify the delimiters to use when splitting the file before chunking the text. If not specified, the default [.!?\n] are used to split into sentences. However, you may want to use spaces or other delimiters. + /// + [JsonPropertyName("splitDelimiters")] + public IEnumerable? SplitDelimiters { get; set; } + + /// + /// This is an optional field which allows you to specify whether or not to rebalance the chunks created from the file. If not specified, the default true is used. If true, Trieve will evenly distribute remainder splits across chunks such that 66 splits with a target_splits_per_chunk of 20 will result in 3 chunks with 22 splits each. + /// + [JsonPropertyName("rebalanceChunks")] + public bool? RebalanceChunks { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreSearchPlan.cs b/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreSearchPlan.cs new file mode 100644 index 0000000..d8c01ac --- /dev/null +++ b/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreSearchPlan.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record TrieveKnowledgeBaseVectorStoreSearchPlan +{ + /// + /// If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed. This will preserve queries that are entirely stop words. + /// + [JsonPropertyName("removeStopWords")] + public bool? RemoveStopWords { get; set; } + + /// + /// This is the score threshold to filter out chunks with a score below the threshold for cosine distance metric. For Manhattan Distance, Euclidean Distance, and Dot Product, it will filter out scores above the threshold distance. This threshold applies before weight and bias modifications. If not specified, this defaults to no threshold. A threshold of 0 will default to no threshold. + /// + [JsonPropertyName("scoreThreshold")] + public double? ScoreThreshold { get; set; } + + /// + /// This is the search method used when searching for relevant chunks from the vector store. + /// + [JsonPropertyName("searchType")] + public required TrieveKnowledgeBaseVectorStoreSearchPlanSearchType SearchType { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreSearchPlanSearchType.cs b/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreSearchPlanSearchType.cs new file mode 100644 index 0000000..63af0fe --- /dev/null +++ b/src/Vapi.Net/Types/TrieveKnowledgeBaseVectorStoreSearchPlanSearchType.cs @@ -0,0 +1,23 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum TrieveKnowledgeBaseVectorStoreSearchPlanSearchType +{ + [EnumMember(Value = "fulltext")] + Fulltext, + + [EnumMember(Value = "semantic")] + Semantic, + + [EnumMember(Value = "hybrid")] + Hybrid, + + [EnumMember(Value = "bm25")] + Bm25, +} diff --git a/src/Vapi.Net/Types/TwilioCredential.cs b/src/Vapi.Net/Types/TwilioCredential.cs index 61ee83f..6e57dac 100644 --- a/src/Vapi.Net/Types/TwilioCredential.cs +++ b/src/Vapi.Net/Types/TwilioCredential.cs @@ -40,6 +40,12 @@ public record TwilioCredential [JsonPropertyName("updatedAt")] public required DateTime UpdatedAt { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + [JsonPropertyName("accountSid")] public required string AccountSid { get; set; } diff --git a/src/Vapi.Net/Types/TwilioPhoneNumber.cs b/src/Vapi.Net/Types/TwilioPhoneNumber.cs index 674ed67..87555b0 100644 --- a/src/Vapi.Net/Types/TwilioPhoneNumber.cs +++ b/src/Vapi.Net/Types/TwilioPhoneNumber.cs @@ -9,7 +9,6 @@ public record TwilioPhoneNumber { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -70,7 +69,7 @@ public record TwilioPhoneNumber /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/TwilioVoicemailDetection.cs b/src/Vapi.Net/Types/TwilioVoicemailDetection.cs index 3b9dc1f..f1af525 100644 --- a/src/Vapi.Net/Types/TwilioVoicemailDetection.cs +++ b/src/Vapi.Net/Types/TwilioVoicemailDetection.cs @@ -61,7 +61,6 @@ public record TwilioVoicemailDetection /// The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Default is 1200 milliseconds. /// /// Increasing this value will typically be used to better address the short voicemail greeting scenarios. For short voicemails, there is typically 1000-2000ms of audio followed by 1200-2400ms of silence and then additional audio before the beep. Increasing the MachineDetectionSpeechEndThreshold to ~2500ms will treat the 1200-2400ms of silence as a gap in the greeting but not the end of the greeting and will result in a machine detection. The downsides of such a change include: - /// /// - Increasing the delay for human detection by the amount you increase this parameter, e.g., a change of 1200ms to 2500ms increases human detection delay by 1300ms. /// - Cases where a human has two utterances separated by a period of silence (e.g. a "Hello", then 2000ms of silence, and another "Hello") may be interpreted as a machine. /// diff --git a/src/Vapi.Net/Types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.cs b/src/Vapi.Net/Types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.cs index 863abbf..ba6750f 100644 --- a/src/Vapi.Net/Types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.cs +++ b/src/Vapi.Net/Types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum TwilioVoicemailDetectionVoicemailDetectionTypesItem { [EnumMember(Value = "machine_start")] diff --git a/src/Vapi.Net/Types/UpdateAnthropicCredentialDto.cs b/src/Vapi.Net/Types/UpdateAnthropicCredentialDto.cs index 93b7d1f..4abc2a2 100644 --- a/src/Vapi.Net/Types/UpdateAnthropicCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateAnthropicCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateAnthropicCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateAnyscaleCredentialDto.cs b/src/Vapi.Net/Types/UpdateAnyscaleCredentialDto.cs index 759753d..82c65fd 100644 --- a/src/Vapi.Net/Types/UpdateAnyscaleCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateAnyscaleCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateAnyscaleCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateAssemblyAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateAssemblyAiCredentialDto.cs new file mode 100644 index 0000000..3fdb27c --- /dev/null +++ b/src/Vapi.Net/Types/UpdateAssemblyAiCredentialDto.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateAssemblyAiCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/UpdateAzureCredentialDto.cs b/src/Vapi.Net/Types/UpdateAzureCredentialDto.cs new file mode 100644 index 0000000..4272adc --- /dev/null +++ b/src/Vapi.Net/Types/UpdateAzureCredentialDto.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateAzureCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is the service being used in Azure. + /// + [JsonPropertyName("service")] + public required string Service { get; set; } + + /// + /// This is the region of the Azure resource. + /// + [JsonPropertyName("region")] + public UpdateAzureCredentialDtoRegion? Region { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public string? ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/UpdateAzureCredentialDtoRegion.cs b/src/Vapi.Net/Types/UpdateAzureCredentialDtoRegion.cs new file mode 100644 index 0000000..c7d6602 --- /dev/null +++ b/src/Vapi.Net/Types/UpdateAzureCredentialDtoRegion.cs @@ -0,0 +1,59 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum UpdateAzureCredentialDtoRegion +{ + [EnumMember(Value = "australia")] + Australia, + + [EnumMember(Value = "canada")] + Canada, + + [EnumMember(Value = "eastus2")] + Eastus2, + + [EnumMember(Value = "eastus")] + Eastus, + + [EnumMember(Value = "france")] + France, + + [EnumMember(Value = "india")] + India, + + [EnumMember(Value = "japan")] + Japan, + + [EnumMember(Value = "uaenorth")] + Uaenorth, + + [EnumMember(Value = "northcentralus")] + Northcentralus, + + [EnumMember(Value = "norway")] + Norway, + + [EnumMember(Value = "southcentralus")] + Southcentralus, + + [EnumMember(Value = "sweden")] + Sweden, + + [EnumMember(Value = "switzerland")] + Switzerland, + + [EnumMember(Value = "uk")] + Uk, + + [EnumMember(Value = "westus")] + Westus, + + [EnumMember(Value = "westus3")] + Westus3, +} diff --git a/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDto.cs index af5fe7c..8b71eb3 100644 --- a/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDto.cs @@ -26,6 +26,12 @@ public record UpdateAzureOpenAiCredentialDto [JsonPropertyName("openAIEndpoint")] public required string OpenAiEndpoint { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoModelsItem.cs b/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoModelsItem.cs index 663f0fa..3cb3fd7 100644 --- a/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoModelsItem.cs +++ b/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoModelsItem.cs @@ -6,9 +6,12 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateAzureOpenAiCredentialDtoModelsItem { + [EnumMember(Value = "gpt-4o-2024-08-06")] + Gpt4O20240806, + [EnumMember(Value = "gpt-4o-mini-2024-07-18")] Gpt4OMini20240718, diff --git a/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoRegion.cs b/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoRegion.cs index fed057c..e4b9672 100644 --- a/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoRegion.cs +++ b/src/Vapi.Net/Types/UpdateAzureOpenAiCredentialDtoRegion.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateAzureOpenAiCredentialDtoRegion { [EnumMember(Value = "australia")] @@ -30,6 +30,9 @@ public enum UpdateAzureOpenAiCredentialDtoRegion [EnumMember(Value = "japan")] Japan, + [EnumMember(Value = "uaenorth")] + Uaenorth, + [EnumMember(Value = "northcentralus")] Northcentralus, diff --git a/src/Vapi.Net/Types/UpdateByoSipTrunkCredentialDto.cs b/src/Vapi.Net/Types/UpdateByoSipTrunkCredentialDto.cs index 2914cc4..0e8fb37 100644 --- a/src/Vapi.Net/Types/UpdateByoSipTrunkCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateByoSipTrunkCredentialDto.cs @@ -19,12 +19,6 @@ public record UpdateByoSipTrunkCredentialDto [JsonPropertyName("gateways")] public IEnumerable Gateways { get; set; } = new List(); - /// - /// This is the name of the SIP trunk. This is just for your reference. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - /// /// This can be used to configure the outbound authentication if required by the SIP trunk. /// @@ -35,7 +29,6 @@ public record UpdateByoSipTrunkCredentialDto /// This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. /// /// Usage: - /// /// - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. /// /// @default false @@ -43,12 +36,30 @@ public record UpdateByoSipTrunkCredentialDto [JsonPropertyName("outboundLeadingPlusEnabled")] public bool? OutboundLeadingPlusEnabled { get; set; } + /// + /// This can be used to configure the tech prefix on outbound calls. This is an advanced property. + /// + [JsonPropertyName("techPrefix")] + public string? TechPrefix { get; set; } + + /// + /// This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property. + /// + [JsonPropertyName("sipDiversionHeader")] + public string? SipDiversionHeader { get; set; } + /// /// This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC provided by Vapi. /// [JsonPropertyName("sbcConfiguration")] public SbcConfiguration? SbcConfiguration { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateCartesiaCredentialDto.cs b/src/Vapi.Net/Types/UpdateCartesiaCredentialDto.cs index 4aa2071..fe26bee 100644 --- a/src/Vapi.Net/Types/UpdateCartesiaCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateCartesiaCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateCartesiaCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateCustomLlmCredentialDto.cs b/src/Vapi.Net/Types/UpdateCustomLlmCredentialDto.cs index 5d8e92e..354b8d7 100644 --- a/src/Vapi.Net/Types/UpdateCustomLlmCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateCustomLlmCredentialDto.cs @@ -16,6 +16,18 @@ public record UpdateCustomLlmCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the authentication plan. Currently supports OAuth2 RFC 6749. To use Bearer authentication, use apiKey + /// + [JsonPropertyName("authenticationPlan")] + public OAuth2AuthenticationPlan? AuthenticationPlan { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateDeepInfraCredentialDto.cs b/src/Vapi.Net/Types/UpdateDeepInfraCredentialDto.cs index 0d9c5ed..f0df8f4 100644 --- a/src/Vapi.Net/Types/UpdateDeepInfraCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateDeepInfraCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateDeepInfraCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateDeepgramCredentialDto.cs b/src/Vapi.Net/Types/UpdateDeepgramCredentialDto.cs index 84b8107..465382f 100644 --- a/src/Vapi.Net/Types/UpdateDeepgramCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateDeepgramCredentialDto.cs @@ -22,6 +22,12 @@ public record UpdateDeepgramCredentialDto [JsonPropertyName("apiUrl")] public string? ApiUrl { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateElevenLabsCredentialDto.cs b/src/Vapi.Net/Types/UpdateElevenLabsCredentialDto.cs index 7818910..d43905f 100644 --- a/src/Vapi.Net/Types/UpdateElevenLabsCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateElevenLabsCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateElevenLabsCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateGcpCredentialDto.cs b/src/Vapi.Net/Types/UpdateGcpCredentialDto.cs index 6c55559..4b92f10 100644 --- a/src/Vapi.Net/Types/UpdateGcpCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateGcpCredentialDto.cs @@ -11,13 +11,7 @@ public record UpdateGcpCredentialDto public required string Provider { get; set; } /// - /// This is the name of the GCP credential. This is just for your reference. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details//keys. + /// This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. /// /// The schema is identical to the JSON that GCP outputs. /// @@ -30,6 +24,12 @@ public record UpdateGcpCredentialDto [JsonPropertyName("bucketPlan")] public BucketPlan? BucketPlan { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateGladiaCredentialDto.cs b/src/Vapi.Net/Types/UpdateGladiaCredentialDto.cs index eda0962..790a431 100644 --- a/src/Vapi.Net/Types/UpdateGladiaCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateGladiaCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateGladiaCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateGoHighLevelCredentialDto.cs b/src/Vapi.Net/Types/UpdateGoHighLevelCredentialDto.cs index 61d94d0..ce97d18 100644 --- a/src/Vapi.Net/Types/UpdateGoHighLevelCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateGoHighLevelCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateGoHighLevelCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateGoogleCredentialDto.cs b/src/Vapi.Net/Types/UpdateGoogleCredentialDto.cs new file mode 100644 index 0000000..ff55f93 --- /dev/null +++ b/src/Vapi.Net/Types/UpdateGoogleCredentialDto.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateGoogleCredentialDto +{ + /// + /// This is the key for Gemini in Google AI Studio. Get it from here: https://aistudio.google.com/app/apikey + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/UpdateGroqCredentialDto.cs b/src/Vapi.Net/Types/UpdateGroqCredentialDto.cs index 1e40640..bd4f22b 100644 --- a/src/Vapi.Net/Types/UpdateGroqCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateGroqCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateGroqCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateInflectionAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateInflectionAiCredentialDto.cs new file mode 100644 index 0000000..69939a1 --- /dev/null +++ b/src/Vapi.Net/Types/UpdateInflectionAiCredentialDto.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateInflectionAiCredentialDto +{ + /// + /// This is the api key for Pi in InflectionAI's console. Get it from here: https://developers.inflection.ai/keys, billing will need to be setup + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/UpdateLangfuseCredentialDto.cs b/src/Vapi.Net/Types/UpdateLangfuseCredentialDto.cs new file mode 100644 index 0000000..76880f5 --- /dev/null +++ b/src/Vapi.Net/Types/UpdateLangfuseCredentialDto.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateLangfuseCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// The public key for Langfuse project. Eg: pk-lf-... + /// + [JsonPropertyName("publicKey")] + public required string PublicKey { get; set; } + + /// + /// The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// The host URL for Langfuse project. Eg: https://cloud.langfuse.com + /// + [JsonPropertyName("apiUrl")] + public required string ApiUrl { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/UpdateLmntCredentialDto.cs b/src/Vapi.Net/Types/UpdateLmntCredentialDto.cs index d41844d..1660a69 100644 --- a/src/Vapi.Net/Types/UpdateLmntCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateLmntCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateLmntCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateMakeCredentialDto.cs b/src/Vapi.Net/Types/UpdateMakeCredentialDto.cs index 95c0abe..8ea5a05 100644 --- a/src/Vapi.Net/Types/UpdateMakeCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateMakeCredentialDto.cs @@ -28,6 +28,12 @@ public record UpdateMakeCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateOpenAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateOpenAiCredentialDto.cs index 2a7c09f..61143b6 100644 --- a/src/Vapi.Net/Types/UpdateOpenAiCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateOpenAiCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateOpenAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateOpenRouterCredentialDto.cs b/src/Vapi.Net/Types/UpdateOpenRouterCredentialDto.cs index 1b18188..205b749 100644 --- a/src/Vapi.Net/Types/UpdateOpenRouterCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateOpenRouterCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateOpenRouterCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateOrgDto.cs b/src/Vapi.Net/Types/UpdateOrgDto.cs index 33b5b8a..654147e 100644 --- a/src/Vapi.Net/Types/UpdateOrgDto.cs +++ b/src/Vapi.Net/Types/UpdateOrgDto.cs @@ -15,12 +15,24 @@ public record UpdateOrgDto [JsonPropertyName("hipaaEnabled")] public bool? HipaaEnabled { get; set; } + /// + /// This is the ID of the subscription the org belongs to. + /// + [JsonPropertyName("subscriptionId")] + public string? SubscriptionId { get; set; } + /// /// This is the name of the org. This is just for your own reference. /// [JsonPropertyName("name")] public string? Name { get; set; } + /// + /// This is the channel of the org. There is the cluster the API traffic for the org will be directed. + /// + [JsonPropertyName("channel")] + public UpdateOrgDtoChannel? Channel { get; set; } + /// /// This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. /// diff --git a/src/Vapi.Net/Types/UpdateOrgDtoChannel.cs b/src/Vapi.Net/Types/UpdateOrgDtoChannel.cs new file mode 100644 index 0000000..4927b3e --- /dev/null +++ b/src/Vapi.Net/Types/UpdateOrgDtoChannel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum UpdateOrgDtoChannel +{ + [EnumMember(Value = "default")] + Default, + + [EnumMember(Value = "weekly")] + Weekly, +} diff --git a/src/Vapi.Net/Types/UpdatePerplexityAiCredentialDto.cs b/src/Vapi.Net/Types/UpdatePerplexityAiCredentialDto.cs index 7986c8a..33b6a4e 100644 --- a/src/Vapi.Net/Types/UpdatePerplexityAiCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdatePerplexityAiCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdatePerplexityAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdatePlayHtCredentialDto.cs b/src/Vapi.Net/Types/UpdatePlayHtCredentialDto.cs index 78e06f9..c085ffb 100644 --- a/src/Vapi.Net/Types/UpdatePlayHtCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdatePlayHtCredentialDto.cs @@ -19,6 +19,12 @@ public record UpdatePlayHtCredentialDto [JsonPropertyName("userId")] public required string UserId { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateRimeAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateRimeAiCredentialDto.cs index 014d20a..af781a0 100644 --- a/src/Vapi.Net/Types/UpdateRimeAiCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateRimeAiCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateRimeAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateRunpodCredentialDto.cs b/src/Vapi.Net/Types/UpdateRunpodCredentialDto.cs index 54c3f99..fc7064c 100644 --- a/src/Vapi.Net/Types/UpdateRunpodCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateRunpodCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateRunpodCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateS3CredentialDto.cs b/src/Vapi.Net/Types/UpdateS3CredentialDto.cs index b28921f..e62684c 100644 --- a/src/Vapi.Net/Types/UpdateS3CredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateS3CredentialDto.cs @@ -43,6 +43,12 @@ public record UpdateS3CredentialDto [JsonPropertyName("s3PathPrefix")] public required string S3PathPrefix { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateTavusCredentialDto.cs b/src/Vapi.Net/Types/UpdateTavusCredentialDto.cs new file mode 100644 index 0000000..3a8947f --- /dev/null +++ b/src/Vapi.Net/Types/UpdateTavusCredentialDto.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateTavusCredentialDto +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/UpdateTogetherAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateTogetherAiCredentialDto.cs index f28abc9..108e396 100644 --- a/src/Vapi.Net/Types/UpdateTogetherAiCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateTogetherAiCredentialDto.cs @@ -16,6 +16,12 @@ public record UpdateTogetherAiCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateToolTemplateDtoProvider.cs b/src/Vapi.Net/Types/UpdateToolTemplateDtoProvider.cs index 48ce1cd..0cc1147 100644 --- a/src/Vapi.Net/Types/UpdateToolTemplateDtoProvider.cs +++ b/src/Vapi.Net/Types/UpdateToolTemplateDtoProvider.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateToolTemplateDtoProvider { [EnumMember(Value = "make")] diff --git a/src/Vapi.Net/Types/UpdateToolTemplateDtoVisibility.cs b/src/Vapi.Net/Types/UpdateToolTemplateDtoVisibility.cs index 74b0f4b..7e6b9d2 100644 --- a/src/Vapi.Net/Types/UpdateToolTemplateDtoVisibility.cs +++ b/src/Vapi.Net/Types/UpdateToolTemplateDtoVisibility.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateToolTemplateDtoVisibility { [EnumMember(Value = "public")] diff --git a/src/Vapi.Net/Types/UpdateTwilioCredentialDto.cs b/src/Vapi.Net/Types/UpdateTwilioCredentialDto.cs index b2c6b9b..23c1512 100644 --- a/src/Vapi.Net/Types/UpdateTwilioCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateTwilioCredentialDto.cs @@ -19,6 +19,12 @@ public record UpdateTwilioCredentialDto [JsonPropertyName("accountSid")] public required string AccountSid { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateUserRoleDtoRole.cs b/src/Vapi.Net/Types/UpdateUserRoleDtoRole.cs index 6e72123..e550bdd 100644 --- a/src/Vapi.Net/Types/UpdateUserRoleDtoRole.cs +++ b/src/Vapi.Net/Types/UpdateUserRoleDtoRole.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum UpdateUserRoleDtoRole { [EnumMember(Value = "admin")] diff --git a/src/Vapi.Net/Types/UpdateVonageCredentialDto.cs b/src/Vapi.Net/Types/UpdateVonageCredentialDto.cs index d71e809..eff7378 100644 --- a/src/Vapi.Net/Types/UpdateVonageCredentialDto.cs +++ b/src/Vapi.Net/Types/UpdateVonageCredentialDto.cs @@ -19,6 +19,12 @@ public record UpdateVonageCredentialDto [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/UpdateXAiCredentialDto.cs b/src/Vapi.Net/Types/UpdateXAiCredentialDto.cs new file mode 100644 index 0000000..a1f5c75 --- /dev/null +++ b/src/Vapi.Net/Types/UpdateXAiCredentialDto.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record UpdateXAiCredentialDto +{ + /// + /// This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/VapiCost.cs b/src/Vapi.Net/Types/VapiCost.cs index 8243791..4aeb621 100644 --- a/src/Vapi.Net/Types/VapiCost.cs +++ b/src/Vapi.Net/Types/VapiCost.cs @@ -7,6 +7,12 @@ namespace Vapi.Net; public record VapiCost { + /// + /// This is the sub type of the cost. + /// + [JsonPropertyName("subType")] + public required VapiCostSubType SubType { get; set; } + /// /// This is the minutes of Vapi usage. This should match `call.endedAt` - `call.startedAt`. /// diff --git a/src/Vapi.Net/Types/VapiCostSubType.cs b/src/Vapi.Net/Types/VapiCostSubType.cs new file mode 100644 index 0000000..06b5e46 --- /dev/null +++ b/src/Vapi.Net/Types/VapiCostSubType.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +[JsonConverter(typeof(EnumSerializer))] +public enum VapiCostSubType +{ + [EnumMember(Value = "normal")] + Normal, + + [EnumMember(Value = "overage")] + Overage, +} diff --git a/src/Vapi.Net/Types/VapiModel.cs b/src/Vapi.Net/Types/VapiModel.cs index 6c9875f..bfc87d3 100644 --- a/src/Vapi.Net/Types/VapiModel.cs +++ b/src/Vapi.Net/Types/VapiModel.cs @@ -29,6 +29,18 @@ public record VapiModel [JsonPropertyName("toolIds")] public IEnumerable? ToolIds { get; set; } + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + [JsonPropertyName("steps")] public IEnumerable? Steps { get; set; } @@ -44,12 +56,6 @@ public record VapiModel [JsonPropertyName("temperature")] public double? Temperature { get; set; } - /// - /// These are the options for the knowledge base. - /// - [JsonPropertyName("knowledgeBase")] - public KnowledgeBase? KnowledgeBase { get; set; } - /// /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. /// diff --git a/src/Vapi.Net/Types/VapiPhoneNumber.cs b/src/Vapi.Net/Types/VapiPhoneNumber.cs index bc96ddb..64ac3d1 100644 --- a/src/Vapi.Net/Types/VapiPhoneNumber.cs +++ b/src/Vapi.Net/Types/VapiPhoneNumber.cs @@ -9,7 +9,6 @@ public record VapiPhoneNumber { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -70,7 +69,7 @@ public record VapiPhoneNumber /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } @@ -91,6 +90,14 @@ public record VapiPhoneNumber [JsonPropertyName("sipUri")] public required string SipUri { get; set; } + /// + /// This enables authentication for incoming SIP INVITE requests to the `sipUri`. + /// + /// If not set, any username/password to the 401 challenge of the SIP INVITE will be accepted. + /// + [JsonPropertyName("authentication")] + public SipAuthentication? Authentication { get; set; } + public override string ToString() { return JsonUtils.Serialize(this); diff --git a/src/Vapi.Net/Types/VoiceCost.cs b/src/Vapi.Net/Types/VoiceCost.cs index 535a20b..adf0889 100644 --- a/src/Vapi.Net/Types/VoiceCost.cs +++ b/src/Vapi.Net/Types/VoiceCost.cs @@ -11,13 +11,12 @@ public record VoiceCost /// This is the voice that was used during the call. /// /// This matches one of the following: - /// /// - `call.assistant.voice`, - /// - `call.assistantId->voice`, + /// - `call.assistantId->voice`, /// - `call.squad[n].assistant.voice`, - /// - `call.squad[n].assistantId->voice`, - /// - `call.squadId->[n].assistant.voice`, - /// - `call.squadId->[n].assistantId->voice`. + /// - `call.squad[n].assistantId->voice`, + /// - `call.squadId->[n].assistant.voice`, + /// - `call.squadId->[n].assistantId->voice`. /// [JsonPropertyName("voice")] public object Voice { get; set; } = new Dictionary(); diff --git a/src/Vapi.Net/Types/VoiceLibraryGender.cs b/src/Vapi.Net/Types/VoiceLibraryGender.cs index 342a324..fab7e98 100644 --- a/src/Vapi.Net/Types/VoiceLibraryGender.cs +++ b/src/Vapi.Net/Types/VoiceLibraryGender.cs @@ -6,7 +6,7 @@ namespace Vapi.Net; -[JsonConverter(typeof(StringEnumSerializer))] +[JsonConverter(typeof(EnumSerializer))] public enum VoiceLibraryGender { [EnumMember(Value = "male")] diff --git a/src/Vapi.Net/Types/VonageCredential.cs b/src/Vapi.Net/Types/VonageCredential.cs index 194fbed..20610eb 100644 --- a/src/Vapi.Net/Types/VonageCredential.cs +++ b/src/Vapi.Net/Types/VonageCredential.cs @@ -54,6 +54,12 @@ public record VonageCredential [JsonPropertyName("vonageApplicationId")] public required string VonageApplicationId { get; set; } + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } diff --git a/src/Vapi.Net/Types/VonagePhoneNumber.cs b/src/Vapi.Net/Types/VonagePhoneNumber.cs index 6b3d45a..6426c4c 100644 --- a/src/Vapi.Net/Types/VonagePhoneNumber.cs +++ b/src/Vapi.Net/Types/VonagePhoneNumber.cs @@ -9,7 +9,6 @@ public record VonagePhoneNumber { /// /// This is the fallback destination an inbound call will be transferred to if: - /// /// 1. `assistantId` is not set /// 2. `squadId` is not set /// 3. and, `assistant-request` message to the `serverUrl` fails @@ -70,7 +69,7 @@ public record VonagePhoneNumber /// /// You can see the shape of the messages sent in `ServerMessage`. /// - /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. + /// This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. /// [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } diff --git a/src/Vapi.Net/Types/WebhookCredential.cs b/src/Vapi.Net/Types/WebhookCredential.cs new file mode 100644 index 0000000..91818dc --- /dev/null +++ b/src/Vapi.Net/Types/WebhookCredential.cs @@ -0,0 +1,59 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record WebhookCredential +{ + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is the authentication plan. Currently supports OAuth2 RFC 6749. + /// + [JsonPropertyName("authenticationPlan")] + public required OAuth2AuthenticationPlan AuthenticationPlan { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the authentication session for the credential. Available for credentials that have an authentication plan. + /// + [JsonPropertyName("authenticationSession")] + public required Oauth2AuthenticationSession AuthenticationSession { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/WorkflowBlock.cs b/src/Vapi.Net/Types/WorkflowBlock.cs index bb3c37a..b519efa 100644 --- a/src/Vapi.Net/Types/WorkflowBlock.cs +++ b/src/Vapi.Net/Types/WorkflowBlock.cs @@ -17,7 +17,6 @@ public record WorkflowBlock /// This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input` /// /// These are accessible as variables: - /// /// - ({{input.propertyName}}) in context of the block execution (step) /// - ({{stepName.input.propertyName}}) in context of the workflow /// @@ -28,13 +27,11 @@ public record WorkflowBlock /// This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`). /// /// These are accessible as variables: - /// /// - ({{output.propertyName}}) in context of the block execution (step) /// - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) /// - ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2) /// /// Caveats: - /// /// 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. /// 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps. /// diff --git a/src/Vapi.Net/Types/XAiCredential.cs b/src/Vapi.Net/Types/XAiCredential.cs new file mode 100644 index 0000000..8a8eb32 --- /dev/null +++ b/src/Vapi.Net/Types/XAiCredential.cs @@ -0,0 +1,56 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record XAiCredential +{ + /// + /// This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai + /// + [JsonPropertyName("provider")] + public required string Provider { get; set; } + + /// + /// This is not returned in the API. + /// + [JsonPropertyName("apiKey")] + public required string ApiKey { get; set; } + + /// + /// This is the unique identifier for the credential. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// This is the unique identifier for the org that this credential belongs to. + /// + [JsonPropertyName("orgId")] + public required string OrgId { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the credential was created. + /// + [JsonPropertyName("createdAt")] + public required DateTime CreatedAt { get; set; } + + /// + /// This is the ISO 8601 date-time string of when the assistant was last updated. + /// + [JsonPropertyName("updatedAt")] + public required DateTime UpdatedAt { get; set; } + + /// + /// This is the name of credential. This is just for your reference. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Types/XaiModel.cs b/src/Vapi.Net/Types/XaiModel.cs new file mode 100644 index 0000000..872f2dd --- /dev/null +++ b/src/Vapi.Net/Types/XaiModel.cs @@ -0,0 +1,86 @@ +using System.Text.Json.Serialization; +using Vapi.Net.Core; + +#nullable enable + +namespace Vapi.Net; + +public record XaiModel +{ + /// + /// This is the starting state for the conversation. + /// + [JsonPropertyName("messages")] + public IEnumerable? Messages { get; set; } + + /// + /// These are the tools that the assistant can use during the call. To use existing tools, use `toolIds`. + /// + /// Both `tools` and `toolIds` can be used together. + /// + [JsonPropertyName("tools")] + public IEnumerable? Tools { get; set; } + + /// + /// These are the tools that the assistant can use during the call. To use transient tools, use `tools`. + /// + /// Both `tools` and `toolIds` can be used together. + /// + [JsonPropertyName("toolIds")] + public IEnumerable? ToolIds { get; set; } + + /// + /// These are the options for the knowledge base. + /// + [JsonPropertyName("knowledgeBase")] + public CreateCustomKnowledgeBaseDto? KnowledgeBase { get; set; } + + /// + /// This is the ID of the knowledge base the model will use. + /// + [JsonPropertyName("knowledgeBaseId")] + public string? KnowledgeBaseId { get; set; } + + /// + /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + /// + [JsonPropertyName("model")] + public required string Model { get; set; } + + /// + /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// + [JsonPropertyName("temperature")] + public double? Temperature { get; set; } + + /// + /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + /// + [JsonPropertyName("maxTokens")] + public double? MaxTokens { get; set; } + + /// + /// This determines whether we detect user's emotion while they speak and send it as an additional info to model. + /// + /// Default `false` because the model is usually are good at understanding the user's emotion from text. + /// + /// @default false + /// + [JsonPropertyName("emotionRecognitionEnabled")] + public bool? EmotionRecognitionEnabled { get; set; } + + /// + /// This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + /// + /// Default is 0. + /// + /// @default 0 + /// + [JsonPropertyName("numFastTurns")] + public double? NumFastTurns { get; set; } + + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Vapi.Net/Vapi.Net.Custom.props b/src/Vapi.Net/Vapi.Net.Custom.props new file mode 100644 index 0000000..70df284 --- /dev/null +++ b/src/Vapi.Net/Vapi.Net.Custom.props @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/src/Vapi.Net/Vapi.Net.csproj b/src/Vapi.Net/Vapi.Net.csproj index b8ec0dc..29d7c71 100644 --- a/src/Vapi.Net/Vapi.Net.csproj +++ b/src/Vapi.Net/Vapi.Net.csproj @@ -1,40 +1,33 @@ - + net462;net8.0;net7.0;net6.0;netstandard2.0 enable - false 12 enable - 0.1.0 + 0.2.0 + $(Version) + $(Version) README.md https://github.com/VapiAI/server-sdk-csharp - - - true - + - - - - - + - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - - + + + + + @@ -47,4 +40,5 @@ + diff --git a/src/Vapi.Net/VapiClient.cs b/src/Vapi.Net/VapiClient.cs index 516dd9a..9d8d923 100644 --- a/src/Vapi.Net/VapiClient.cs +++ b/src/Vapi.Net/VapiClient.cs @@ -8,16 +8,15 @@ public partial class VapiClient { private RawClient _client; - public VapiClient(string? token = null, ClientOptions? clientOptions = null) + public VapiClient(string token, ClientOptions? clientOptions = null) { var defaultHeaders = new Headers( new Dictionary() { - { "Authorization", $"Bearer {token}" }, { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "Vapi.Net" }, { "X-Fern-SDK-Version", Version.Current }, - { "User-Agent", "Vapi.Net/0.1.0" }, + { "User-Agent", "Vapi.Net/0.2.0" }, } ); clientOptions ??= new ClientOptions(); @@ -33,6 +32,7 @@ public VapiClient(string? token = null, ClientOptions? clientOptions = null) Assistants = new AssistantsClient(_client); PhoneNumbers = new PhoneNumbersClient(_client); Squads = new SquadsClient(_client); + KnowledgeBases = new KnowledgeBasesClient(_client); Blocks = new BlocksClient(_client); Tools = new ToolsClient(_client); Files = new FilesClient(_client); @@ -48,6 +48,8 @@ public VapiClient(string? token = null, ClientOptions? clientOptions = null) public SquadsClient Squads { get; init; } + public KnowledgeBasesClient KnowledgeBases { get; init; } + public BlocksClient Blocks { get; init; } public ToolsClient Tools { get; init; }