Skip to content

Commit ae26762

Browse files
committed
Release 0.0.15
1 parent a2d7ef8 commit ae26762

File tree

7 files changed

+288
-12
lines changed

7 files changed

+288
-12
lines changed

src/Vapi.Client.sln

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Client", "Vapi.Client\Vapi.Client.csproj", "{A67C1380-DA1C-4EF2-9F93-A810D7FC3BC7}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Client", "Vapi.Client\Vapi.Client.csproj", "{F3C997C2-7C62-486F-9DEA-E94E9A1E1A87}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Client.Test", "Vapi.Client.Test\Vapi.Client.Test.csproj", "{C5D0B6C8-2EAE-43AC-B1D5-0BC582331A09}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vapi.Client.Test", "Vapi.Client.Test\Vapi.Client.Test.csproj", "{B046139E-2FF2-4B10-A65A-87EB985E37B6}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,13 +16,13 @@ Global
1616
HideSolutionNode = FALSE
1717
EndGlobalSection
1818
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19-
{A67C1380-DA1C-4EF2-9F93-A810D7FC3BC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20-
{A67C1380-DA1C-4EF2-9F93-A810D7FC3BC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
21-
{A67C1380-DA1C-4EF2-9F93-A810D7FC3BC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
22-
{A67C1380-DA1C-4EF2-9F93-A810D7FC3BC7}.Release|Any CPU.Build.0 = Release|Any CPU
23-
{C5D0B6C8-2EAE-43AC-B1D5-0BC582331A09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24-
{C5D0B6C8-2EAE-43AC-B1D5-0BC582331A09}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{C5D0B6C8-2EAE-43AC-B1D5-0BC582331A09}.Release|Any CPU.ActiveCfg = Release|Any CPU
26-
{C5D0B6C8-2EAE-43AC-B1D5-0BC582331A09}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{F3C997C2-7C62-486F-9DEA-E94E9A1E1A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{F3C997C2-7C62-486F-9DEA-E94E9A1E1A87}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{F3C997C2-7C62-486F-9DEA-E94E9A1E1A87}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{F3C997C2-7C62-486F-9DEA-E94E9A1E1A87}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{B046139E-2FF2-4B10-A65A-87EB985E37B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{B046139E-2FF2-4B10-A65A-87EB985E37B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{B046139E-2FF2-4B10-A65A-87EB985E37B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{B046139E-2FF2-4B10-A65A-87EB985E37B6}.Release|Any CPU.Build.0 = Release|Any CPU
2727
EndGlobalSection
2828
EndGlobal

src/Vapi.Client/Core/Public/Version.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ namespace Vapi.Client;
22

33
internal class Version
44
{
5-
public const string Current = "0.0.14";
5+
public const string Current = "0.0.15";
66
}

src/Vapi.Client/Logs/LogsClient.cs

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
using System.Net.Http;
2+
using System.Text.Json;
3+
using System.Threading;
4+
using Vapi.Client.Core;
5+
6+
#nullable enable
7+
8+
namespace Vapi.Client;
9+
10+
public partial class LogsClient
11+
{
12+
private RawClient _client;
13+
14+
internal LogsClient(RawClient client)
15+
{
16+
_client = client;
17+
}
18+
19+
/// <example>
20+
/// <code>
21+
/// await client.Logs.GetAsync(new LogsGetRequest());
22+
/// </code>
23+
/// </example>
24+
public async Task<LogsPaginatedResponse> GetAsync(
25+
LogsGetRequest request,
26+
RequestOptions? options = null,
27+
CancellationToken cancellationToken = default
28+
)
29+
{
30+
var _query = new Dictionary<string, object>();
31+
if (request.OrgId != null)
32+
{
33+
_query["orgId"] = request.OrgId;
34+
}
35+
if (request.Type != null)
36+
{
37+
_query["type"] = request.Type.Value.Stringify();
38+
}
39+
if (request.AssistantId != null)
40+
{
41+
_query["assistantId"] = request.AssistantId;
42+
}
43+
if (request.PhoneNumberId != null)
44+
{
45+
_query["phoneNumberId"] = request.PhoneNumberId;
46+
}
47+
if (request.CustomerId != null)
48+
{
49+
_query["customerId"] = request.CustomerId;
50+
}
51+
if (request.SquadId != null)
52+
{
53+
_query["squadId"] = request.SquadId;
54+
}
55+
if (request.CallId != null)
56+
{
57+
_query["callId"] = request.CallId;
58+
}
59+
if (request.Page != null)
60+
{
61+
_query["page"] = request.Page.ToString();
62+
}
63+
if (request.SortOrder != null)
64+
{
65+
_query["sortOrder"] = request.SortOrder.Value.Stringify();
66+
}
67+
if (request.Limit != null)
68+
{
69+
_query["limit"] = request.Limit.ToString();
70+
}
71+
if (request.CreatedAtGt != null)
72+
{
73+
_query["createdAtGt"] = request.CreatedAtGt.Value.ToString(Constants.DateTimeFormat);
74+
}
75+
if (request.CreatedAtLt != null)
76+
{
77+
_query["createdAtLt"] = request.CreatedAtLt.Value.ToString(Constants.DateTimeFormat);
78+
}
79+
if (request.CreatedAtGe != null)
80+
{
81+
_query["createdAtGe"] = request.CreatedAtGe.Value.ToString(Constants.DateTimeFormat);
82+
}
83+
if (request.CreatedAtLe != null)
84+
{
85+
_query["createdAtLe"] = request.CreatedAtLe.Value.ToString(Constants.DateTimeFormat);
86+
}
87+
if (request.UpdatedAtGt != null)
88+
{
89+
_query["updatedAtGt"] = request.UpdatedAtGt.Value.ToString(Constants.DateTimeFormat);
90+
}
91+
if (request.UpdatedAtLt != null)
92+
{
93+
_query["updatedAtLt"] = request.UpdatedAtLt.Value.ToString(Constants.DateTimeFormat);
94+
}
95+
if (request.UpdatedAtGe != null)
96+
{
97+
_query["updatedAtGe"] = request.UpdatedAtGe.Value.ToString(Constants.DateTimeFormat);
98+
}
99+
if (request.UpdatedAtLe != null)
100+
{
101+
_query["updatedAtLe"] = request.UpdatedAtLe.Value.ToString(Constants.DateTimeFormat);
102+
}
103+
var response = await _client.MakeRequestAsync(
104+
new RawClient.JsonApiRequest
105+
{
106+
BaseUrl = _client.Options.BaseUrl,
107+
Method = HttpMethod.Get,
108+
Path = "logs",
109+
Query = _query,
110+
Options = options,
111+
},
112+
cancellationToken
113+
);
114+
var responseBody = await response.Raw.Content.ReadAsStringAsync();
115+
if (response.StatusCode is >= 200 and < 400)
116+
{
117+
try
118+
{
119+
return JsonUtils.Deserialize<LogsPaginatedResponse>(responseBody)!;
120+
}
121+
catch (JsonException e)
122+
{
123+
throw new VapiException("Failed to deserialize response", e);
124+
}
125+
}
126+
127+
throw new VapiApiException(
128+
$"Error with status code {response.StatusCode}",
129+
response.StatusCode,
130+
responseBody
131+
);
132+
}
133+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using Vapi.Client.Core;
2+
3+
#nullable enable
4+
5+
namespace Vapi.Client;
6+
7+
public record LogsGetRequest
8+
{
9+
/// <summary>
10+
/// This is the unique identifier for the org that this log belongs to.
11+
/// </summary>
12+
public string? OrgId { get; set; }
13+
14+
/// <summary>
15+
/// This is the type of the log.
16+
/// </summary>
17+
public LogsGetRequestType? Type { get; set; }
18+
19+
/// <summary>
20+
/// This is the ID of the assistant.
21+
/// </summary>
22+
public string? AssistantId { get; set; }
23+
24+
/// <summary>
25+
/// This is the ID of the phone number.
26+
/// </summary>
27+
public string? PhoneNumberId { get; set; }
28+
29+
/// <summary>
30+
/// This is the ID of the customer.
31+
/// </summary>
32+
public string? CustomerId { get; set; }
33+
34+
/// <summary>
35+
/// This is the ID of the squad.
36+
/// </summary>
37+
public string? SquadId { get; set; }
38+
39+
/// <summary>
40+
/// This is the ID of the call.
41+
/// </summary>
42+
public string? CallId { get; set; }
43+
44+
/// <summary>
45+
/// This is the page number to return. Defaults to 1.
46+
/// </summary>
47+
public double? Page { get; set; }
48+
49+
/// <summary>
50+
/// This is the sort order for pagination. Defaults to 'ASC'.
51+
/// </summary>
52+
public LogsGetRequestSortOrder? SortOrder { get; set; }
53+
54+
/// <summary>
55+
/// This is the maximum number of items to return. Defaults to 100.
56+
/// </summary>
57+
public double? Limit { get; set; }
58+
59+
/// <summary>
60+
/// This will return items where the createdAt is greater than the specified value.
61+
/// </summary>
62+
public DateTime? CreatedAtGt { get; set; }
63+
64+
/// <summary>
65+
/// This will return items where the createdAt is less than the specified value.
66+
/// </summary>
67+
public DateTime? CreatedAtLt { get; set; }
68+
69+
/// <summary>
70+
/// This will return items where the createdAt is greater than or equal to the specified value.
71+
/// </summary>
72+
public DateTime? CreatedAtGe { get; set; }
73+
74+
/// <summary>
75+
/// This will return items where the createdAt is less than or equal to the specified value.
76+
/// </summary>
77+
public DateTime? CreatedAtLe { get; set; }
78+
79+
/// <summary>
80+
/// This will return items where the updatedAt is greater than the specified value.
81+
/// </summary>
82+
public DateTime? UpdatedAtGt { get; set; }
83+
84+
/// <summary>
85+
/// This will return items where the updatedAt is less than the specified value.
86+
/// </summary>
87+
public DateTime? UpdatedAtLt { get; set; }
88+
89+
/// <summary>
90+
/// This will return items where the updatedAt is greater than or equal to the specified value.
91+
/// </summary>
92+
public DateTime? UpdatedAtGe { get; set; }
93+
94+
/// <summary>
95+
/// This will return items where the updatedAt is less than or equal to the specified value.
96+
/// </summary>
97+
public DateTime? UpdatedAtLe { get; set; }
98+
99+
public override string ToString()
100+
{
101+
return JsonUtils.Serialize(this);
102+
}
103+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Runtime.Serialization;
2+
using System.Text.Json.Serialization;
3+
using Vapi.Client.Core;
4+
5+
#nullable enable
6+
7+
namespace Vapi.Client;
8+
9+
[JsonConverter(typeof(StringEnumSerializer<LogsGetRequestSortOrder>))]
10+
public enum LogsGetRequestSortOrder
11+
{
12+
[EnumMember(Value = "ASC")]
13+
Asc,
14+
15+
[EnumMember(Value = "DESC")]
16+
Desc,
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Runtime.Serialization;
2+
using System.Text.Json.Serialization;
3+
using Vapi.Client.Core;
4+
5+
#nullable enable
6+
7+
namespace Vapi.Client;
8+
9+
[JsonConverter(typeof(StringEnumSerializer<LogsGetRequestType>))]
10+
public enum LogsGetRequestType
11+
{
12+
[EnumMember(Value = "API")]
13+
Api,
14+
15+
[EnumMember(Value = "Webhook")]
16+
Webhook,
17+
18+
[EnumMember(Value = "Call")]
19+
Call,
20+
21+
[EnumMember(Value = "Provider")]
22+
Provider,
23+
}

src/Vapi.Client/Vapi.Client.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<NuGetAudit>false</NuGetAudit>
88
<LangVersion>12</LangVersion>
99
<Nullable>enable</Nullable>
10-
<Version>0.0.14</Version>
10+
<Version>0.0.15</Version>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<PackageProjectUrl>https://github.com/fern-demo/vapi-csharp-sdk</PackageProjectUrl>
1313
</PropertyGroup>

0 commit comments

Comments
 (0)