Skip to content

Commit fca28c2

Browse files
authored
libs: Add source_id to ingest resources (#1897)
Due to an oversight, this was not generated in the original `openapi.json`, fixed in svix/svix-webhooks-private#3874 I am not worried that this broke anyone, because ingest resource were unusable, so no one used them ;)
2 parents 4a3f5e5 + 61195ef commit fca28c2

File tree

10 files changed

+609
-225
lines changed

10 files changed

+609
-225
lines changed

csharp/Svix/IngestEndpoint.cs

Lines changed: 87 additions & 17 deletions
Large diffs are not rendered by default.

go/ingest_endpoint.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ type IngestEndpointRotateSecretOptions struct {
3939
// List ingest endpoints.
4040
func (ingestEndpoint *IngestEndpoint) List(
4141
ctx context.Context,
42+
sourceId string,
4243
o *IngestEndpointListOptions,
4344
) (*models.ListResponseIngestEndpointOut, error) {
45+
pathMap := map[string]string{
46+
"source_id": sourceId,
47+
}
4448
queryMap := map[string]string{}
4549
var err error
4650
if o != nil {
@@ -56,7 +60,7 @@ func (ingestEndpoint *IngestEndpoint) List(
5660
ingestEndpoint.client,
5761
"GET",
5862
"/ingest/api/v1/source/{source_id}/endpoint",
59-
nil,
63+
pathMap,
6064
queryMap,
6165
nil,
6266
nil,
@@ -66,9 +70,13 @@ func (ingestEndpoint *IngestEndpoint) List(
6670
// Create an ingest endpoint.
6771
func (ingestEndpoint *IngestEndpoint) Create(
6872
ctx context.Context,
73+
sourceId string,
6974
ingestEndpointIn models.IngestEndpointIn,
7075
o *IngestEndpointCreateOptions,
7176
) (*models.IngestEndpointOut, error) {
77+
pathMap := map[string]string{
78+
"source_id": sourceId,
79+
}
7280
headerMap := map[string]string{}
7381
var err error
7482
if o != nil {
@@ -82,7 +90,7 @@ func (ingestEndpoint *IngestEndpoint) Create(
8290
ingestEndpoint.client,
8391
"POST",
8492
"/ingest/api/v1/source/{source_id}/endpoint",
85-
nil,
93+
pathMap,
8694
nil,
8795
headerMap,
8896
&ingestEndpointIn,
@@ -92,9 +100,11 @@ func (ingestEndpoint *IngestEndpoint) Create(
92100
// Get an ingest endpoint.
93101
func (ingestEndpoint *IngestEndpoint) Get(
94102
ctx context.Context,
103+
sourceId string,
95104
endpointId string,
96105
) (*models.IngestEndpointOut, error) {
97106
pathMap := map[string]string{
107+
"source_id": sourceId,
98108
"endpoint_id": endpointId,
99109
}
100110
return internal.ExecuteRequest[any, models.IngestEndpointOut](
@@ -112,10 +122,12 @@ func (ingestEndpoint *IngestEndpoint) Get(
112122
// Update an ingest endpoint.
113123
func (ingestEndpoint *IngestEndpoint) Update(
114124
ctx context.Context,
125+
sourceId string,
115126
endpointId string,
116127
ingestEndpointUpdate models.IngestEndpointUpdate,
117128
) (*models.IngestEndpointOut, error) {
118129
pathMap := map[string]string{
130+
"source_id": sourceId,
119131
"endpoint_id": endpointId,
120132
}
121133
return internal.ExecuteRequest[models.IngestEndpointUpdate, models.IngestEndpointOut](
@@ -133,9 +145,11 @@ func (ingestEndpoint *IngestEndpoint) Update(
133145
// Delete an ingest endpoint.
134146
func (ingestEndpoint *IngestEndpoint) Delete(
135147
ctx context.Context,
148+
sourceId string,
136149
endpointId string,
137150
) error {
138151
pathMap := map[string]string{
152+
"source_id": sourceId,
139153
"endpoint_id": endpointId,
140154
}
141155
_, err := internal.ExecuteRequest[any, any](
@@ -154,9 +168,11 @@ func (ingestEndpoint *IngestEndpoint) Delete(
154168
// Get the additional headers to be sent with the ingest.
155169
func (ingestEndpoint *IngestEndpoint) GetHeaders(
156170
ctx context.Context,
171+
sourceId string,
157172
endpointId string,
158173
) (*models.IngestEndpointHeadersOut, error) {
159174
pathMap := map[string]string{
175+
"source_id": sourceId,
160176
"endpoint_id": endpointId,
161177
}
162178
return internal.ExecuteRequest[any, models.IngestEndpointHeadersOut](
@@ -174,10 +190,12 @@ func (ingestEndpoint *IngestEndpoint) GetHeaders(
174190
// Set the additional headers to be sent to the endpoint.
175191
func (ingestEndpoint *IngestEndpoint) UpdateHeaders(
176192
ctx context.Context,
193+
sourceId string,
177194
endpointId string,
178195
ingestEndpointHeadersIn models.IngestEndpointHeadersIn,
179196
) error {
180197
pathMap := map[string]string{
198+
"source_id": sourceId,
181199
"endpoint_id": endpointId,
182200
}
183201
_, err := internal.ExecuteRequest[models.IngestEndpointHeadersIn, any](
@@ -199,9 +217,11 @@ func (ingestEndpoint *IngestEndpoint) UpdateHeaders(
199217
// For more information please refer to [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/).
200218
func (ingestEndpoint *IngestEndpoint) GetSecret(
201219
ctx context.Context,
220+
sourceId string,
202221
endpointId string,
203222
) (*models.IngestEndpointSecretOut, error) {
204223
pathMap := map[string]string{
224+
"source_id": sourceId,
205225
"endpoint_id": endpointId,
206226
}
207227
return internal.ExecuteRequest[any, models.IngestEndpointSecretOut](
@@ -221,11 +241,13 @@ func (ingestEndpoint *IngestEndpoint) GetSecret(
221241
// The previous secret will remain valid for the next 24 hours.
222242
func (ingestEndpoint *IngestEndpoint) RotateSecret(
223243
ctx context.Context,
244+
sourceId string,
224245
endpointId string,
225246
ingestEndpointSecretIn models.IngestEndpointSecretIn,
226247
o *IngestEndpointRotateSecretOptions,
227248
) error {
228249
pathMap := map[string]string{
250+
"source_id": sourceId,
229251
"endpoint_id": endpointId,
230252
}
231253
headerMap := map[string]string{}

java/lib/src/main/java/com/svix/api/IngestEndpoint.java

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ public IngestEndpoint(SvixHttpClient client) {
2828
}
2929

3030
/** List ingest endpoints. */
31-
public ListResponseIngestEndpointOut list() throws IOException, ApiException {
32-
33-
return this.list(new IngestEndpointListOptions());
31+
public ListResponseIngestEndpointOut list(final String sourceId)
32+
throws IOException, ApiException {
33+
return this.list(sourceId, new IngestEndpointListOptions());
3434
}
3535

3636
/** List ingest endpoints. */
37-
public ListResponseIngestEndpointOut list(final IngestEndpointListOptions options)
37+
public ListResponseIngestEndpointOut list(
38+
final String sourceId, final IngestEndpointListOptions options)
3839
throws IOException, ApiException {
3940
HttpUrl.Builder url =
4041
this.client
4142
.newUrlBuilder()
42-
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint");
43+
.encodedPath(String.format("/ingest/api/v1/source/%s/endpoint", sourceId));
4344
if (options.limit != null) {
4445
url.addQueryParameter("limit", Utils.serializeQueryParam(options.limit));
4546
}
@@ -54,19 +55,21 @@ public ListResponseIngestEndpointOut list(final IngestEndpointListOptions option
5455
}
5556

5657
/** Create an ingest endpoint. */
57-
public IngestEndpointOut create(final IngestEndpointIn ingestEndpointIn)
58+
public IngestEndpointOut create(final String sourceId, final IngestEndpointIn ingestEndpointIn)
5859
throws IOException, ApiException {
59-
return this.create(ingestEndpointIn, new IngestEndpointCreateOptions());
60+
return this.create(sourceId, ingestEndpointIn, new IngestEndpointCreateOptions());
6061
}
6162

6263
/** Create an ingest endpoint. */
6364
public IngestEndpointOut create(
64-
final IngestEndpointIn ingestEndpointIn, final IngestEndpointCreateOptions options)
65+
final String sourceId,
66+
final IngestEndpointIn ingestEndpointIn,
67+
final IngestEndpointCreateOptions options)
6568
throws IOException, ApiException {
6669
HttpUrl.Builder url =
6770
this.client
6871
.newUrlBuilder()
69-
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint");
72+
.encodedPath(String.format("/ingest/api/v1/source/%s/endpoint", sourceId));
7073
Map<String, String> headers = new HashMap<>();
7174
if (options.idempotencyKey != null) {
7275
headers.put("idempotency-key", options.idempotencyKey);
@@ -80,69 +83,75 @@ public IngestEndpointOut create(
8083
}
8184

8285
/** Get an ingest endpoint. */
83-
public IngestEndpointOut get(final String endpointId) throws IOException, ApiException {
86+
public IngestEndpointOut get(final String sourceId, final String endpointId)
87+
throws IOException, ApiException {
8488
HttpUrl.Builder url =
8589
this.client
8690
.newUrlBuilder()
8791
.encodedPath(
8892
String.format(
89-
"/ingest/api/v1/source/{source_id}/endpoint/%s",
90-
endpointId));
93+
"/ingest/api/v1/source/%s/endpoint/%s",
94+
sourceId, endpointId));
9195
return this.client.executeRequest("GET", url.build(), null, null, IngestEndpointOut.class);
9296
}
9397

9498
/** Update an ingest endpoint. */
9599
public IngestEndpointOut update(
96-
final String endpointId, final IngestEndpointUpdate ingestEndpointUpdate)
100+
final String sourceId,
101+
final String endpointId,
102+
final IngestEndpointUpdate ingestEndpointUpdate)
97103
throws IOException, ApiException {
98104
HttpUrl.Builder url =
99105
this.client
100106
.newUrlBuilder()
101107
.encodedPath(
102108
String.format(
103-
"/ingest/api/v1/source/{source_id}/endpoint/%s",
104-
endpointId));
109+
"/ingest/api/v1/source/%s/endpoint/%s",
110+
sourceId, endpointId));
105111
return this.client.executeRequest(
106112
"PUT", url.build(), null, ingestEndpointUpdate, IngestEndpointOut.class);
107113
}
108114

109115
/** Delete an ingest endpoint. */
110-
public void delete(final String endpointId) throws IOException, ApiException {
116+
public void delete(final String sourceId, final String endpointId)
117+
throws IOException, ApiException {
111118
HttpUrl.Builder url =
112119
this.client
113120
.newUrlBuilder()
114121
.encodedPath(
115122
String.format(
116-
"/ingest/api/v1/source/{source_id}/endpoint/%s",
117-
endpointId));
123+
"/ingest/api/v1/source/%s/endpoint/%s",
124+
sourceId, endpointId));
118125
this.client.executeRequest("DELETE", url.build(), null, null, null);
119126
}
120127

121128
/** Get the additional headers to be sent with the ingest. */
122-
public IngestEndpointHeadersOut getHeaders(final String endpointId)
129+
public IngestEndpointHeadersOut getHeaders(final String sourceId, final String endpointId)
123130
throws IOException, ApiException {
124131
HttpUrl.Builder url =
125132
this.client
126133
.newUrlBuilder()
127134
.encodedPath(
128135
String.format(
129-
"/ingest/api/v1/source/{source_id}/endpoint/%s/headers",
130-
endpointId));
136+
"/ingest/api/v1/source/%s/endpoint/%s/headers",
137+
sourceId, endpointId));
131138
return this.client.executeRequest(
132139
"GET", url.build(), null, null, IngestEndpointHeadersOut.class);
133140
}
134141

135142
/** Set the additional headers to be sent to the endpoint. */
136143
public void updateHeaders(
137-
final String endpointId, final IngestEndpointHeadersIn ingestEndpointHeadersIn)
144+
final String sourceId,
145+
final String endpointId,
146+
final IngestEndpointHeadersIn ingestEndpointHeadersIn)
138147
throws IOException, ApiException {
139148
HttpUrl.Builder url =
140149
this.client
141150
.newUrlBuilder()
142151
.encodedPath(
143152
String.format(
144-
"/ingest/api/v1/source/{source_id}/endpoint/%s/headers",
145-
endpointId));
153+
"/ingest/api/v1/source/%s/endpoint/%s/headers",
154+
sourceId, endpointId));
146155
this.client.executeRequest("PUT", url.build(), null, ingestEndpointHeadersIn, null);
147156
}
148157

@@ -152,15 +161,15 @@ public void updateHeaders(
152161
* <p>This is used to verify the authenticity of the webhook. For more information please refer
153162
* to [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/).
154163
*/
155-
public IngestEndpointSecretOut getSecret(final String endpointId)
164+
public IngestEndpointSecretOut getSecret(final String sourceId, final String endpointId)
156165
throws IOException, ApiException {
157166
HttpUrl.Builder url =
158167
this.client
159168
.newUrlBuilder()
160169
.encodedPath(
161170
String.format(
162-
"/ingest/api/v1/source/{source_id}/endpoint/%s/secret",
163-
endpointId));
171+
"/ingest/api/v1/source/%s/endpoint/%s/secret",
172+
sourceId, endpointId));
164173
return this.client.executeRequest(
165174
"GET", url.build(), null, null, IngestEndpointSecretOut.class);
166175
}
@@ -171,10 +180,15 @@ public IngestEndpointSecretOut getSecret(final String endpointId)
171180
* <p>The previous secret will remain valid for the next 24 hours.
172181
*/
173182
public void rotateSecret(
174-
final String endpointId, final IngestEndpointSecretIn ingestEndpointSecretIn)
183+
final String sourceId,
184+
final String endpointId,
185+
final IngestEndpointSecretIn ingestEndpointSecretIn)
175186
throws IOException, ApiException {
176187
this.rotateSecret(
177-
endpointId, ingestEndpointSecretIn, new IngestEndpointRotateSecretOptions());
188+
sourceId,
189+
endpointId,
190+
ingestEndpointSecretIn,
191+
new IngestEndpointRotateSecretOptions());
178192
}
179193

180194
/**
@@ -183,6 +197,7 @@ public void rotateSecret(
183197
* <p>The previous secret will remain valid for the next 24 hours.
184198
*/
185199
public void rotateSecret(
200+
final String sourceId,
186201
final String endpointId,
187202
final IngestEndpointSecretIn ingestEndpointSecretIn,
188203
final IngestEndpointRotateSecretOptions options)
@@ -192,8 +207,8 @@ public void rotateSecret(
192207
.newUrlBuilder()
193208
.encodedPath(
194209
String.format(
195-
"/ingest/api/v1/source/{source_id}/endpoint/%s/secret/rotate",
196-
endpointId));
210+
"/ingest/api/v1/source/%s/endpoint/%s/secret/rotate",
211+
sourceId, endpointId));
197212
Map<String, String> headers = new HashMap<>();
198213
if (options.idempotencyKey != null) {
199214
headers.put("idempotency-key", options.idempotencyKey);

0 commit comments

Comments
 (0)