Skip to content

Commit d18354c

Browse files
committed
Bump OpenAPI spec and regenerate libs / CLI
1 parent e7733ee commit d18354c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8578
-1639
lines changed

Diff for: csharp/Svix/Message.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public class Message(SvixClient client)
8282
{
8383
readonly SvixClient _client = client;
8484

85+
public MessagePoller Poller
86+
{
87+
get => new MessagePoller(_client);
88+
}
89+
8590
/// <summary>Creates a [MessageIn] with a raw string payload.
8691
/// <para>
8792
/// The payload is not normalized on the server. Normally, payloads are
@@ -214,7 +219,7 @@ public ListResponseMessageOut List(string appId, MessageListOptions? options = n
214219
/// The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types.
215220
/// Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema.
216221
///
217-
/// The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to ~350kb, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
222+
/// The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to 1MiB, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
218223
/// </summary>
219224
public async Task<MessageOut> CreateAsync(
220225
string appId,
@@ -254,7 +259,7 @@ public async Task<MessageOut> CreateAsync(
254259
/// The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types.
255260
/// Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema.
256261
///
257-
/// The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to ~350kb, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
262+
/// The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to 1MiB, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
258263
/// </summary>
259264
public MessageOut Create(
260265
string appId,

Diff for: csharp/Svix/MessagePoller.cs

+287
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
// this file is @generated
2+
#nullable enable
3+
using Microsoft.Extensions.Logging;
4+
using Svix.Models;
5+
6+
namespace Svix
7+
{
8+
public class MessagePollerPollOptions : SvixOptionsBase
9+
{
10+
public ulong? Limit { get; set; }
11+
public string? Iterator { get; set; }
12+
public string? EventType { get; set; }
13+
public string? Channel { get; set; }
14+
public DateTime? After { get; set; }
15+
16+
public new Dictionary<string, string> QueryParams()
17+
{
18+
return SerializeParams(
19+
new Dictionary<string, object?>
20+
{
21+
{ "limit", Limit },
22+
{ "iterator", Iterator },
23+
{ "event_type", EventType },
24+
{ "channel", Channel },
25+
{ "after", After },
26+
}
27+
);
28+
}
29+
}
30+
31+
public class MessagePollerConsumerPollOptions : SvixOptionsBase
32+
{
33+
public ulong? Limit { get; set; }
34+
public string? Iterator { get; set; }
35+
public string? EventType { get; set; }
36+
public string? Channel { get; set; }
37+
38+
public new Dictionary<string, string> QueryParams()
39+
{
40+
return SerializeParams(
41+
new Dictionary<string, object?>
42+
{
43+
{ "limit", Limit },
44+
{ "iterator", Iterator },
45+
{ "event_type", EventType },
46+
{ "channel", Channel },
47+
}
48+
);
49+
}
50+
}
51+
52+
public class MessagePollerConsumerSeekOptions : SvixOptionsBase
53+
{
54+
public string? IdempotencyKey { get; set; }
55+
56+
public new Dictionary<string, string> HeaderParams()
57+
{
58+
return SerializeParams(
59+
new Dictionary<string, object?> { { "idempotency-key", IdempotencyKey } }
60+
);
61+
}
62+
}
63+
64+
public class MessagePoller(SvixClient client)
65+
{
66+
readonly SvixClient _client = client;
67+
68+
/// <summary>
69+
/// Reads the stream of created messages for an application, filtered on the Sink's event types and Channels.
70+
/// </summary>
71+
public async Task<PollingEndpointOut> PollAsync(
72+
string appId,
73+
string sinkId,
74+
MessagePollerPollOptions? options = null,
75+
CancellationToken cancellationToken = default
76+
)
77+
{
78+
try
79+
{
80+
var response = await _client.SvixHttpClient.SendRequestAsync<PollingEndpointOut>(
81+
method: HttpMethod.Get,
82+
path: "/api/v1/app/{app_id}/poller/{sink_id}",
83+
pathParams: new Dictionary<string, string>
84+
{
85+
{ "app_id", appId },
86+
{ "sink_id", sinkId },
87+
},
88+
queryParams: options?.QueryParams(),
89+
headerParams: options?.HeaderParams(),
90+
cancellationToken: cancellationToken
91+
);
92+
return response.Data;
93+
}
94+
catch (ApiException e)
95+
{
96+
_client.Logger?.LogError(e, $"{nameof(PollAsync)} failed");
97+
98+
throw;
99+
}
100+
}
101+
102+
/// <summary>
103+
/// Reads the stream of created messages for an application, filtered on the Sink's event types and Channels.
104+
/// </summary>
105+
public PollingEndpointOut Poll(
106+
string appId,
107+
string sinkId,
108+
MessagePollerPollOptions? options = null
109+
)
110+
{
111+
try
112+
{
113+
var response = _client.SvixHttpClient.SendRequest<PollingEndpointOut>(
114+
method: HttpMethod.Get,
115+
path: "/api/v1/app/{app_id}/poller/{sink_id}",
116+
pathParams: new Dictionary<string, string>
117+
{
118+
{ "app_id", appId },
119+
{ "sink_id", sinkId },
120+
},
121+
queryParams: options?.QueryParams(),
122+
headerParams: options?.HeaderParams()
123+
);
124+
return response.Data;
125+
}
126+
catch (ApiException e)
127+
{
128+
_client.Logger?.LogError(e, $"{nameof(Poll)} failed");
129+
130+
throw;
131+
}
132+
}
133+
134+
/// <summary>
135+
/// Reads the stream of created messages for an application, filtered on the Sink's event types and
136+
/// Channels, using server-managed iterator tracking.
137+
/// </summary>
138+
public async Task<PollingEndpointOut> ConsumerPollAsync(
139+
string appId,
140+
string sinkId,
141+
string consumerId,
142+
MessagePollerConsumerPollOptions? options = null,
143+
CancellationToken cancellationToken = default
144+
)
145+
{
146+
try
147+
{
148+
var response = await _client.SvixHttpClient.SendRequestAsync<PollingEndpointOut>(
149+
method: HttpMethod.Get,
150+
path: "/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}",
151+
pathParams: new Dictionary<string, string>
152+
{
153+
{ "app_id", appId },
154+
{ "sink_id", sinkId },
155+
{ "consumer_id", consumerId },
156+
},
157+
queryParams: options?.QueryParams(),
158+
headerParams: options?.HeaderParams(),
159+
cancellationToken: cancellationToken
160+
);
161+
return response.Data;
162+
}
163+
catch (ApiException e)
164+
{
165+
_client.Logger?.LogError(e, $"{nameof(ConsumerPollAsync)} failed");
166+
167+
throw;
168+
}
169+
}
170+
171+
/// <summary>
172+
/// Reads the stream of created messages for an application, filtered on the Sink's event types and
173+
/// Channels, using server-managed iterator tracking.
174+
/// </summary>
175+
public PollingEndpointOut ConsumerPoll(
176+
string appId,
177+
string sinkId,
178+
string consumerId,
179+
MessagePollerConsumerPollOptions? options = null
180+
)
181+
{
182+
try
183+
{
184+
var response = _client.SvixHttpClient.SendRequest<PollingEndpointOut>(
185+
method: HttpMethod.Get,
186+
path: "/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}",
187+
pathParams: new Dictionary<string, string>
188+
{
189+
{ "app_id", appId },
190+
{ "sink_id", sinkId },
191+
{ "consumer_id", consumerId },
192+
},
193+
queryParams: options?.QueryParams(),
194+
headerParams: options?.HeaderParams()
195+
);
196+
return response.Data;
197+
}
198+
catch (ApiException e)
199+
{
200+
_client.Logger?.LogError(e, $"{nameof(ConsumerPoll)} failed");
201+
202+
throw;
203+
}
204+
}
205+
206+
/// <summary>
207+
/// Sets the starting offset for the consumer of a polling endpoint.
208+
/// </summary>
209+
public async Task<PollingEndpointConsumerSeekOut> ConsumerSeekAsync(
210+
string appId,
211+
string sinkId,
212+
string consumerId,
213+
PollingEndpointConsumerSeekIn pollingEndpointConsumerSeekIn,
214+
MessagePollerConsumerSeekOptions? options = null,
215+
CancellationToken cancellationToken = default
216+
)
217+
{
218+
pollingEndpointConsumerSeekIn =
219+
pollingEndpointConsumerSeekIn
220+
?? throw new ArgumentNullException(nameof(pollingEndpointConsumerSeekIn));
221+
try
222+
{
223+
var response =
224+
await _client.SvixHttpClient.SendRequestAsync<PollingEndpointConsumerSeekOut>(
225+
method: HttpMethod.Post,
226+
path: "/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}/seek",
227+
pathParams: new Dictionary<string, string>
228+
{
229+
{ "app_id", appId },
230+
{ "sink_id", sinkId },
231+
{ "consumer_id", consumerId },
232+
},
233+
queryParams: options?.QueryParams(),
234+
headerParams: options?.HeaderParams(),
235+
content: pollingEndpointConsumerSeekIn,
236+
cancellationToken: cancellationToken
237+
);
238+
return response.Data;
239+
}
240+
catch (ApiException e)
241+
{
242+
_client.Logger?.LogError(e, $"{nameof(ConsumerSeekAsync)} failed");
243+
244+
throw;
245+
}
246+
}
247+
248+
/// <summary>
249+
/// Sets the starting offset for the consumer of a polling endpoint.
250+
/// </summary>
251+
public PollingEndpointConsumerSeekOut ConsumerSeek(
252+
string appId,
253+
string sinkId,
254+
string consumerId,
255+
PollingEndpointConsumerSeekIn pollingEndpointConsumerSeekIn,
256+
MessagePollerConsumerSeekOptions? options = null
257+
)
258+
{
259+
pollingEndpointConsumerSeekIn =
260+
pollingEndpointConsumerSeekIn
261+
?? throw new ArgumentNullException(nameof(pollingEndpointConsumerSeekIn));
262+
try
263+
{
264+
var response = _client.SvixHttpClient.SendRequest<PollingEndpointConsumerSeekOut>(
265+
method: HttpMethod.Post,
266+
path: "/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}/seek",
267+
pathParams: new Dictionary<string, string>
268+
{
269+
{ "app_id", appId },
270+
{ "sink_id", sinkId },
271+
{ "consumer_id", consumerId },
272+
},
273+
queryParams: options?.QueryParams(),
274+
headerParams: options?.HeaderParams(),
275+
content: pollingEndpointConsumerSeekIn
276+
);
277+
return response.Data;
278+
}
279+
catch (ApiException e)
280+
{
281+
_client.Logger?.LogError(e, $"{nameof(ConsumerSeek)} failed");
282+
283+
throw;
284+
}
285+
}
286+
}
287+
}

Diff for: go/message.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import (
1010

1111
type Message struct {
1212
client *SvixHttpClient
13+
Poller *MessagePoller
1314
}
1415

1516
func newMessage(client *SvixHttpClient) *Message {
1617
return &Message{
1718
client: client,
19+
Poller: newMessagePoller(client),
1820
}
1921
}
2022

@@ -104,7 +106,7 @@ func (message *Message) List(
104106
// The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types.
105107
// Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema.
106108
//
107-
// The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to ~350kb, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
109+
// The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to 1MiB, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
108110
func (message *Message) Create(
109111
ctx context.Context,
110112
appId string,

0 commit comments

Comments
 (0)