Skip to content
Merged
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
25 changes: 24 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ item from that page on, and `pages()` every page, fetching the next ones on dema
the response body as received. The async client's pages have `nextPage()`, `forEach(...)`,
`forEachPage(...)` and `toList()`, returning `CompletableFuture`s.

[Add ons](#add-ons) · [Add ons entitlements](#add-ons-entitlements) · [Batch jobs](#batch-jobs) · [Checkout sessions](#checkout-sessions) · [Connect](#connect) · [Coupons](#coupons) · [Credit notes](#credit-notes) · [Custom properties](#custom-properties) · [Customers](#customers) · [Entitlements](#entitlements) · [Events](#events) · [Features](#features) · [Invoices](#invoices) · [Metrics](#metrics) · [Oauth](#oauth) · [Oauth apps](#oauth-apps) · [Plans](#plans) · [Plans versions](#plans-versions) · [Product families](#product-families) · [Products](#products) · [Products entitlements](#products-entitlements) · [Subscriptions](#subscriptions) · [Usage](#usage)
[Add ons](#add-ons) · [Add ons entitlements](#add-ons-entitlements) · [Batch jobs](#batch-jobs) · [Checkout sessions](#checkout-sessions) · [Connect](#connect) · [Coupons](#coupons) · [Credit notes](#credit-notes) · [Custom properties](#custom-properties) · [Customers](#customers) · [Entitlements](#entitlements) · [Events](#events) · [Features](#features) · [Invoices](#invoices) · [Metrics](#metrics) · [Oauth](#oauth) · [Oauth apps](#oauth-apps) · [Plans](#plans) · [Plans versions](#plans-versions) · [Product families](#product-families) · [Products](#products) · [Products entitlements](#products-entitlements) · [Subscriptions](#subscriptions) · [Usage](#usage) · [Webhook endpoints](#webhook-endpoints) · [Webhook endpoints endpoints](#webhook-endpoints-endpoints)

## Add ons

Expand Down Expand Up @@ -287,3 +287,26 @@ the response body as received. The async client's pages have `nextPage()`, `forE
| `UsageResponse client.usage().retrieveCustomer(String customerId, LocalDate startDate, LocalDate endDate, [UsageRetrieveCustomerOptions options])` | `GET /api/v1/usage/customer/{customer_id}` | [`UsageResponse`](src/main/java/com/meteroid/models/UsageResponse.java) |
| `UsageResponse client.usage().retrieveSubscription(String subscriptionId, [UsageRetrieveSubscriptionOptions options])` | `GET /api/v1/usage/subscription/{subscription_id}` | [`UsageResponse`](src/main/java/com/meteroid/models/UsageResponse.java) |
| `UsageResponse client.usage().retrieveSummary(LocalDate startDate, LocalDate endDate, [UsageRetrieveSummaryOptions options])` | `GET /api/v1/usage/summary` | [`UsageResponse`](src/main/java/com/meteroid/models/UsageResponse.java) |

## Webhook endpoints

[`client.webhookEndpoints()`](src/main/java/com/meteroid/api/WebhookEndpoints.java)

| Method | Request | Returns |
| --- | --- | --- |
| `WebhookDelivery client.webhookEndpoints().resendWebhookDelivery(String deliveryId)` | `POST /api/v1/webhooks/deliveries/{delivery_id}/resend` | [`WebhookDelivery`](src/main/java/com/meteroid/models/WebhookDelivery.java) |

### Webhook endpoints endpoints

[`client.webhookEndpoints().endpoints()`](src/main/java/com/meteroid/api/WebhookEndpointsEndpoints.java)

| Method | Request | Returns |
| --- | --- | --- |
| `WebhookEndpointListResponse client.webhookEndpoints().endpoints().list()` | `GET /api/v1/webhooks/endpoints` | [`WebhookEndpointListResponse`](src/main/java/com/meteroid/models/WebhookEndpointListResponse.java) |
| `CreatedWebhookEndpoint client.webhookEndpoints().endpoints().create(CreateWebhookEndpointRequest createWebhookEndpointRequest)` | `POST /api/v1/webhooks/endpoints` | [`CreatedWebhookEndpoint`](src/main/java/com/meteroid/models/CreatedWebhookEndpoint.java) |
| `WebhookEndpoint client.webhookEndpoints().endpoints().retrieve(String endpointId)` | `GET /api/v1/webhooks/endpoints/{endpoint_id}` | [`WebhookEndpoint`](src/main/java/com/meteroid/models/WebhookEndpoint.java) |
| `void client.webhookEndpoints().endpoints().delete(String endpointId)` | `DELETE /api/v1/webhooks/endpoints/{endpoint_id}` | nothing |
| `WebhookEndpoint client.webhookEndpoints().endpoints().update(String endpointId, UpdateWebhookEndpointRequest updateWebhookEndpointRequest)` | `PATCH /api/v1/webhooks/endpoints/{endpoint_id}` | [`WebhookEndpoint`](src/main/java/com/meteroid/models/WebhookEndpoint.java) |
| `WebhookEndpointsEndpointsListDeliveriesPage client.webhookEndpoints().endpoints().listDeliveries(String endpointId, [WebhookEndpointsEndpointsListDeliveriesOptions options])` | `GET /api/v1/webhooks/endpoints/{endpoint_id}/deliveries` | [page](src/main/java/com/meteroid/api/WebhookEndpointsEndpointsListDeliveriesPage.java) of [`WebhookDelivery`](src/main/java/com/meteroid/models/WebhookDelivery.java), with the properties of [`WebhookDeliveryListResponse`](src/main/java/com/meteroid/models/WebhookDeliveryListResponse.java) |
| `WebhookEndpointSecret client.webhookEndpoints().endpoints().rotateSecret(String endpointId)` | `POST /api/v1/webhooks/endpoints/{endpoint_id}/rotate-secret` | [`WebhookEndpointSecret`](src/main/java/com/meteroid/models/WebhookEndpointSecret.java) |
| `WebhookEndpointSecret client.webhookEndpoints().endpoints().retrieveSecret(String endpointId)` | `GET /api/v1/webhooks/endpoints/{endpoint_id}/secret` | [`WebhookEndpointSecret`](src/main/java/com/meteroid/models/WebhookEndpointSecret.java) |
21 changes: 21 additions & 0 deletions src/main/java/com/meteroid/Meteroid.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.meteroid.api.Products;
import com.meteroid.api.Subscriptions;
import com.meteroid.api.Usage;
import com.meteroid.api.WebhookEndpoints;
import com.meteroid.internal.MeteroidAuth;
import com.meteroid.internal.MeteroidHttpClient;

Expand Down Expand Up @@ -75,6 +76,7 @@ public final class Meteroid implements AutoCloseable {
private final Products products;
private final Subscriptions subscriptions;
private final Usage usage;
private final WebhookEndpoints webhookEndpoints;

/**
* A client with the default options, its API key and base URL read from the environment.
Expand Down Expand Up @@ -147,6 +149,7 @@ public Meteroid(MeteroidOptions options) {
this.products = new Products(httpClient);
this.subscriptions = new Subscriptions(httpClient);
this.usage = new Usage(httpClient);
this.webhookEndpoints = new WebhookEndpoints(httpClient);
this.withRawResponse = new WithRawResponse();
this.async = new MeteroidAsync(this);
}
Expand Down Expand Up @@ -372,6 +375,15 @@ public Usage usage() {
return usage;
}

/**
* The {@code webhook_endpoints} operations.
*
* @return the operations
*/
public WebhookEndpoints webhookEndpoints() {
return webhookEndpoints;
}

/** The operations, returning the status and headers along with the body. */
public final class WithRawResponse {
private WithRawResponse() {}
Expand Down Expand Up @@ -555,5 +567,14 @@ public Subscriptions.WithRawResponse subscriptions() {
public Usage.WithRawResponse usage() {
return usage.withRawResponse();
}

/**
* The {@code webhook_endpoints} operations.
*
* @return the operations
*/
public WebhookEndpoints.WithRawResponse webhookEndpoints() {
return webhookEndpoints.withRawResponse();
}
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/meteroid/MeteroidAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.meteroid.api.ProductsAsync;
import com.meteroid.api.SubscriptionsAsync;
import com.meteroid.api.UsageAsync;
import com.meteroid.api.WebhookEndpointsAsync;

/**
* The Meteroid client without blocking: every method returns a {@link
Expand Down Expand Up @@ -50,6 +51,7 @@ public final class MeteroidAsync implements AutoCloseable {
private final ProductsAsync products;
private final SubscriptionsAsync subscriptions;
private final UsageAsync usage;
private final WebhookEndpointsAsync webhookEndpoints;

MeteroidAsync(Meteroid sync) {
this.sync = sync;
Expand All @@ -73,6 +75,7 @@ public final class MeteroidAsync implements AutoCloseable {
this.products = new ProductsAsync(sync.products());
this.subscriptions = new SubscriptionsAsync(sync.subscriptions());
this.usage = new UsageAsync(sync.usage());
this.webhookEndpoints = new WebhookEndpointsAsync(sync.webhookEndpoints());
this.withRawResponse = new WithRawResponse();
}

Expand Down Expand Up @@ -274,6 +277,15 @@ public UsageAsync usage() {
return usage;
}

/**
* The {@code webhook_endpoints} operations.
*
* @return the operations
*/
public WebhookEndpointsAsync webhookEndpoints() {
return webhookEndpoints;
}

/** Closes the client shared with {@link #sync()}. */
@Override
public void close() {
Expand Down Expand Up @@ -463,5 +475,14 @@ public SubscriptionsAsync.WithRawResponse subscriptions() {
public UsageAsync.WithRawResponse usage() {
return usage.withRawResponse();
}

/**
* The {@code webhook_endpoints} operations.
*
* @return the operations
*/
public WebhookEndpointsAsync.WithRawResponse webhookEndpoints() {
return webhookEndpoints.withRawResponse();
}
}
}
136 changes: 136 additions & 0 deletions src/main/java/com/meteroid/api/WebhookEndpoints.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// this file is @generated
package com.meteroid.api;

import com.meteroid.ApiResponse;
import com.meteroid.RequestOptions;
import com.meteroid.internal.MeteroidHttpClient;
import com.meteroid.internal.Utils;
import com.meteroid.models.WebhookDelivery;

import okhttp3.HttpUrl;

import java.util.Objects;

/**
* The {@code webhook_endpoints} operations, blocking. {@link #withRawResponse()} has the same
* methods returning the status and headers along with the body.
*/
public final class WebhookEndpoints {
private final MeteroidHttpClient client;
private final WithRawResponse withRawResponse;

private final WebhookEndpointsEndpoints endpoints;

/**
* The operations, sending through {@code client}.
*
* @param client the HTTP client of the SDK
*/
public WebhookEndpoints(MeteroidHttpClient client) {
this.client = client;
this.withRawResponse = new WithRawResponse();

this.endpoints = new WebhookEndpointsEndpoints(client);
}

/**
* The same operations, returning the status and headers along with the body.
*
* @return the operations
*/
public WithRawResponse withRawResponse() {
return withRawResponse;
}

/**
* The {@code endpoints} operations.
*
* @return the operations
*/
public WebhookEndpointsEndpoints endpoints() {
return endpoints;
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @return the response body
*/
public WebhookDelivery resendWebhookDelivery(final String deliveryId) {
return resendWebhookDelivery(deliveryId, RequestOptions.none());
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @param requestOptions headers, timeout and retries of this call
* @return the response body
*/
public WebhookDelivery resendWebhookDelivery(
final String deliveryId, final RequestOptions requestOptions) {
return exchangeResendWebhookDelivery(deliveryId, requestOptions).send();
}

MeteroidHttpClient.Exchange<WebhookDelivery> exchangeResendWebhookDelivery(
final String deliveryId, final RequestOptions requestOptions) {
Objects.requireNonNull(deliveryId, "delivery_id");
HttpUrl url =
client.newUrlBuilder()
.addPathSegments("api/v1/webhooks/deliveries")
.addPathSegment(Utils.pathSegment("delivery_id", deliveryId))
.addPathSegments("resend")
.build();
return client.call("POST", url)
.errors(com.meteroid.models.RestErrorResponse.class, "400", "401", "404", "429")
.options(requestOptions)
.returning(WebhookDelivery.class);
}

/** The operations, returning the status and headers along with the body. */
public final class WithRawResponse {
private WithRawResponse() {}

/**
* The {@code endpoints} operations.
*
* @return the operations
*/
public WebhookEndpointsEndpoints.WithRawResponse endpoints() {
return WebhookEndpoints.this.endpoints.withRawResponse();
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @return the status, headers and body
*/
public ApiResponse<WebhookDelivery> resendWebhookDelivery(final String deliveryId) {
return resendWebhookDelivery(deliveryId, RequestOptions.none());
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @param requestOptions headers, timeout and retries of this call
* @return the status, headers and body
*/
public ApiResponse<WebhookDelivery> resendWebhookDelivery(
final String deliveryId, final RequestOptions requestOptions) {
return WebhookEndpoints.this
.exchangeResendWebhookDelivery(deliveryId, requestOptions)
.sendRaw();
}
}
}
116 changes: 116 additions & 0 deletions src/main/java/com/meteroid/api/WebhookEndpointsAsync.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// this file is @generated
package com.meteroid.api;

import com.meteroid.ApiResponse;
import com.meteroid.RequestOptions;
import com.meteroid.models.WebhookDelivery;

import java.util.concurrent.CompletableFuture;

/**
* The {@code webhook_endpoints} operations, without blocking: each method returns a {@link
* CompletableFuture}. Obtained from {@code client.async()}.
*/
public final class WebhookEndpointsAsync {
private final WebhookEndpoints sync;
private final WithRawResponse withRawResponse;

private final WebhookEndpointsEndpointsAsync endpoints;

/**
* The operations, sending through {@code sync}.
*
* @param sync the blocking operations
*/
public WebhookEndpointsAsync(WebhookEndpoints sync) {
this.sync = sync;
this.withRawResponse = new WithRawResponse();

this.endpoints = new WebhookEndpointsEndpointsAsync(sync.endpoints());
}

/**
* The same operations, returning the status and headers along with the body.
*
* @return the operations
*/
public WithRawResponse withRawResponse() {
return withRawResponse;
}

/**
* The {@code endpoints} operations.
*
* @return the operations
*/
public WebhookEndpointsEndpointsAsync endpoints() {
return endpoints;
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @return the response body, once received
*/
public CompletableFuture<WebhookDelivery> resendWebhookDelivery(final String deliveryId) {
return resendWebhookDelivery(deliveryId, RequestOptions.none());
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @param requestOptions headers, timeout and retries of this call
* @return the response body, once received
*/
public CompletableFuture<WebhookDelivery> resendWebhookDelivery(
final String deliveryId, final RequestOptions requestOptions) {
return sync.exchangeResendWebhookDelivery(deliveryId, requestOptions).sendAsync();
}

/** The operations, returning the status and headers along with the body. */
public final class WithRawResponse {
private WithRawResponse() {}

/**
* The {@code endpoints} operations.
*
* @return the operations
*/
public WebhookEndpointsEndpointsAsync.WithRawResponse endpoints() {
return WebhookEndpointsAsync.this.endpoints.withRawResponse();
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @return the status, headers and body, once received
*/
public CompletableFuture<ApiResponse<WebhookDelivery>> resendWebhookDelivery(
final String deliveryId) {
return resendWebhookDelivery(deliveryId, RequestOptions.none());
}

/**
* Resend a webhook delivery
*
* <p>Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.
*
* @param deliveryId the {@code delivery_id} path parameter
* @param requestOptions headers, timeout and retries of this call
* @return the status, headers and body, once received
*/
public CompletableFuture<ApiResponse<WebhookDelivery>> resendWebhookDelivery(
final String deliveryId, final RequestOptions requestOptions) {
return sync.exchangeResendWebhookDelivery(deliveryId, requestOptions).sendRawAsync();
}
}
}
Loading
Loading