Skip to content

codegen: Pull in changes from a WIP PR #1896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 87 additions & 17 deletions csharp/Svix/IngestEndpoint.cs

Large diffs are not rendered by default.

26 changes: 24 additions & 2 deletions go/ingest_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ type IngestEndpointRotateSecretOptions struct {
// List ingest endpoints.
func (ingestEndpoint *IngestEndpoint) List(
ctx context.Context,
sourceId string,
o *IngestEndpointListOptions,
) (*models.ListResponseIngestEndpointOut, error) {
pathMap := map[string]string{
"source_id": sourceId,
}
queryMap := map[string]string{}
var err error
if o != nil {
Expand All @@ -56,7 +60,7 @@ func (ingestEndpoint *IngestEndpoint) List(
ingestEndpoint.client,
"GET",
"/ingest/api/v1/source/{source_id}/endpoint",
nil,
pathMap,
queryMap,
nil,
nil,
Expand All @@ -66,9 +70,13 @@ func (ingestEndpoint *IngestEndpoint) List(
// Create an ingest endpoint.
func (ingestEndpoint *IngestEndpoint) Create(
ctx context.Context,
sourceId string,
ingestEndpointIn models.IngestEndpointIn,
o *IngestEndpointCreateOptions,
) (*models.IngestEndpointOut, error) {
pathMap := map[string]string{
"source_id": sourceId,
}
headerMap := map[string]string{}
var err error
if o != nil {
Expand All @@ -82,7 +90,7 @@ func (ingestEndpoint *IngestEndpoint) Create(
ingestEndpoint.client,
"POST",
"/ingest/api/v1/source/{source_id}/endpoint",
nil,
pathMap,
nil,
headerMap,
&ingestEndpointIn,
Expand All @@ -92,9 +100,11 @@ func (ingestEndpoint *IngestEndpoint) Create(
// Get an ingest endpoint.
func (ingestEndpoint *IngestEndpoint) Get(
ctx context.Context,
sourceId string,
endpointId string,
) (*models.IngestEndpointOut, error) {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
return internal.ExecuteRequest[any, models.IngestEndpointOut](
Expand All @@ -112,10 +122,12 @@ func (ingestEndpoint *IngestEndpoint) Get(
// Update an ingest endpoint.
func (ingestEndpoint *IngestEndpoint) Update(
ctx context.Context,
sourceId string,
endpointId string,
ingestEndpointUpdate models.IngestEndpointUpdate,
) (*models.IngestEndpointOut, error) {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
return internal.ExecuteRequest[models.IngestEndpointUpdate, models.IngestEndpointOut](
Expand All @@ -133,9 +145,11 @@ func (ingestEndpoint *IngestEndpoint) Update(
// Delete an ingest endpoint.
func (ingestEndpoint *IngestEndpoint) Delete(
ctx context.Context,
sourceId string,
endpointId string,
) error {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
_, err := internal.ExecuteRequest[any, any](
Expand All @@ -154,9 +168,11 @@ func (ingestEndpoint *IngestEndpoint) Delete(
// Get the additional headers to be sent with the ingest.
func (ingestEndpoint *IngestEndpoint) GetHeaders(
ctx context.Context,
sourceId string,
endpointId string,
) (*models.IngestEndpointHeadersOut, error) {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
return internal.ExecuteRequest[any, models.IngestEndpointHeadersOut](
Expand All @@ -174,10 +190,12 @@ func (ingestEndpoint *IngestEndpoint) GetHeaders(
// Set the additional headers to be sent to the endpoint.
func (ingestEndpoint *IngestEndpoint) UpdateHeaders(
ctx context.Context,
sourceId string,
endpointId string,
ingestEndpointHeadersIn models.IngestEndpointHeadersIn,
) error {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
_, err := internal.ExecuteRequest[models.IngestEndpointHeadersIn, any](
Expand All @@ -199,9 +217,11 @@ func (ingestEndpoint *IngestEndpoint) UpdateHeaders(
// For more information please refer to [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/).
func (ingestEndpoint *IngestEndpoint) GetSecret(
ctx context.Context,
sourceId string,
endpointId string,
) (*models.IngestEndpointSecretOut, error) {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
return internal.ExecuteRequest[any, models.IngestEndpointSecretOut](
Expand All @@ -221,11 +241,13 @@ func (ingestEndpoint *IngestEndpoint) GetSecret(
// The previous secret will remain valid for the next 24 hours.
func (ingestEndpoint *IngestEndpoint) RotateSecret(
ctx context.Context,
sourceId string,
endpointId string,
ingestEndpointSecretIn models.IngestEndpointSecretIn,
o *IngestEndpointRotateSecretOptions,
) error {
pathMap := map[string]string{
"source_id": sourceId,
"endpoint_id": endpointId,
}
headerMap := map[string]string{}
Expand Down
77 changes: 46 additions & 31 deletions java/lib/src/main/java/com/svix/api/IngestEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ public IngestEndpoint(SvixHttpClient client) {
}

/** List ingest endpoints. */
public ListResponseIngestEndpointOut list() throws IOException, ApiException {

return this.list(new IngestEndpointListOptions());
public ListResponseIngestEndpointOut list(final String sourceId)
throws IOException, ApiException {
return this.list(sourceId, new IngestEndpointListOptions());
}

/** List ingest endpoints. */
public ListResponseIngestEndpointOut list(final IngestEndpointListOptions options)
public ListResponseIngestEndpointOut list(
final String sourceId, final IngestEndpointListOptions options)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint");
.encodedPath(String.format("/ingest/api/v1/source/%s/endpoint", sourceId));
if (options.limit != null) {
url.addQueryParameter("limit", Utils.serializeQueryParam(options.limit));
}
Expand All @@ -54,19 +55,21 @@ public ListResponseIngestEndpointOut list(final IngestEndpointListOptions option
}

/** Create an ingest endpoint. */
public IngestEndpointOut create(final IngestEndpointIn ingestEndpointIn)
public IngestEndpointOut create(final String sourceId, final IngestEndpointIn ingestEndpointIn)
throws IOException, ApiException {
return this.create(ingestEndpointIn, new IngestEndpointCreateOptions());
return this.create(sourceId, ingestEndpointIn, new IngestEndpointCreateOptions());
}

/** Create an ingest endpoint. */
public IngestEndpointOut create(
final IngestEndpointIn ingestEndpointIn, final IngestEndpointCreateOptions options)
final String sourceId,
final IngestEndpointIn ingestEndpointIn,
final IngestEndpointCreateOptions options)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint");
.encodedPath(String.format("/ingest/api/v1/source/%s/endpoint", sourceId));
Map<String, String> headers = new HashMap<>();
if (options.idempotencyKey != null) {
headers.put("idempotency-key", options.idempotencyKey);
Expand All @@ -80,69 +83,75 @@ public IngestEndpointOut create(
}

/** Get an ingest endpoint. */
public IngestEndpointOut get(final String endpointId) throws IOException, ApiException {
public IngestEndpointOut get(final String sourceId, final String endpointId)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s",
sourceId, endpointId));
return this.client.executeRequest("GET", url.build(), null, null, IngestEndpointOut.class);
}

/** Update an ingest endpoint. */
public IngestEndpointOut update(
final String endpointId, final IngestEndpointUpdate ingestEndpointUpdate)
final String sourceId,
final String endpointId,
final IngestEndpointUpdate ingestEndpointUpdate)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s",
sourceId, endpointId));
return this.client.executeRequest(
"PUT", url.build(), null, ingestEndpointUpdate, IngestEndpointOut.class);
}

/** Delete an ingest endpoint. */
public void delete(final String endpointId) throws IOException, ApiException {
public void delete(final String sourceId, final String endpointId)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s",
sourceId, endpointId));
this.client.executeRequest("DELETE", url.build(), null, null, null);
}

/** Get the additional headers to be sent with the ingest. */
public IngestEndpointHeadersOut getHeaders(final String endpointId)
public IngestEndpointHeadersOut getHeaders(final String sourceId, final String endpointId)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s/headers",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s/headers",
sourceId, endpointId));
return this.client.executeRequest(
"GET", url.build(), null, null, IngestEndpointHeadersOut.class);
}

/** Set the additional headers to be sent to the endpoint. */
public void updateHeaders(
final String endpointId, final IngestEndpointHeadersIn ingestEndpointHeadersIn)
final String sourceId,
final String endpointId,
final IngestEndpointHeadersIn ingestEndpointHeadersIn)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s/headers",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s/headers",
sourceId, endpointId));
this.client.executeRequest("PUT", url.build(), null, ingestEndpointHeadersIn, null);
}

Expand All @@ -152,15 +161,15 @@ public void updateHeaders(
* <p>This is used to verify the authenticity of the webhook. For more information please refer
* to [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/).
*/
public IngestEndpointSecretOut getSecret(final String endpointId)
public IngestEndpointSecretOut getSecret(final String sourceId, final String endpointId)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s/secret",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s/secret",
sourceId, endpointId));
return this.client.executeRequest(
"GET", url.build(), null, null, IngestEndpointSecretOut.class);
}
Expand All @@ -171,10 +180,15 @@ public IngestEndpointSecretOut getSecret(final String endpointId)
* <p>The previous secret will remain valid for the next 24 hours.
*/
public void rotateSecret(
final String endpointId, final IngestEndpointSecretIn ingestEndpointSecretIn)
final String sourceId,
final String endpointId,
final IngestEndpointSecretIn ingestEndpointSecretIn)
throws IOException, ApiException {
this.rotateSecret(
endpointId, ingestEndpointSecretIn, new IngestEndpointRotateSecretOptions());
sourceId,
endpointId,
ingestEndpointSecretIn,
new IngestEndpointRotateSecretOptions());
}

/**
Expand All @@ -183,6 +197,7 @@ public void rotateSecret(
* <p>The previous secret will remain valid for the next 24 hours.
*/
public void rotateSecret(
final String sourceId,
final String endpointId,
final IngestEndpointSecretIn ingestEndpointSecretIn,
final IngestEndpointRotateSecretOptions options)
Expand All @@ -192,8 +207,8 @@ public void rotateSecret(
.newUrlBuilder()
.encodedPath(
String.format(
"/ingest/api/v1/source/{source_id}/endpoint/%s/secret/rotate",
endpointId));
"/ingest/api/v1/source/%s/endpoint/%s/secret/rotate",
sourceId, endpointId));
Map<String, String> headers = new HashMap<>();
if (options.idempotencyKey != null) {
headers.put("idempotency-key", options.idempotencyKey);
Expand Down
Loading