Skip to content

Commit 8ae0043

Browse files
⚠️ Build SDK w/ V2 OpenAPI spec (#3167)
* generate w/ v2 openapi spec * move deleted object path
1 parent ffe133d commit 8ae0043

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// File generated from our OpenAPI spec
2+
namespace Stripe.V2
3+
{
4+
using Newtonsoft.Json;
5+
#if NET6_0_OR_GREATER
6+
using STJS = System.Text.Json.Serialization;
7+
#endif
8+
9+
public class DeletedObject : StripeEntity<DeletedObject>, IHasId, IHasObject
10+
{
11+
/// <summary>
12+
/// The ID of the object that's being deleted.
13+
/// </summary>
14+
[JsonProperty("id")]
15+
#if NET6_0_OR_GREATER
16+
[STJS.JsonPropertyName("id")]
17+
#endif
18+
public string Id { get; set; }
19+
20+
/// <summary>
21+
/// String representing the type of the object that has been deleted. Objects of the same
22+
/// type share the same value of the object field.
23+
/// </summary>
24+
[JsonProperty("object")]
25+
#if NET6_0_OR_GREATER
26+
[STJS.JsonPropertyName("object")]
27+
#endif
28+
public string Object { get; set; }
29+
}
30+
}

src/Stripe.net/Services/V2/Core/EventDestinations/EventDestinationService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ public virtual V2.EventDestination Create(EventDestinationCreateOptions options,
3939
/// <summary>
4040
/// Delete an event destination.
4141
/// </summary>
42-
public virtual V2.EventDestination Delete(string id, EventDestinationDeleteOptions options = null, RequestOptions requestOptions = null)
42+
public virtual V2.DeletedObject Delete(string id, EventDestinationDeleteOptions options = null, RequestOptions requestOptions = null)
4343
{
44-
return this.Request<V2.EventDestination>(BaseAddress.Api, HttpMethod.Delete, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions);
44+
return this.Request<V2.DeletedObject>(BaseAddress.Api, HttpMethod.Delete, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions);
4545
}
4646

4747
/// <summary>
4848
/// Delete an event destination.
4949
/// </summary>
50-
public virtual Task<V2.EventDestination> DeleteAsync(string id, EventDestinationDeleteOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
50+
public virtual Task<V2.DeletedObject> DeleteAsync(string id, EventDestinationDeleteOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
5151
{
52-
return this.RequestAsync<V2.EventDestination>(BaseAddress.Api, HttpMethod.Delete, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken);
52+
return this.RequestAsync<V2.DeletedObject>(BaseAddress.Api, HttpMethod.Delete, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken);
5353
}
5454

5555
/// <summary>

src/StripeTests/Services/GeneratedExamplesTest.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6256,7 +6256,7 @@ public void TestV2CoreEventGet()
62566256
HttpMethod.Get,
62576257
"/v2/core/events",
62586258
(HttpStatusCode)200,
6259-
"{\"data\":[{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"context\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"reason\":null,\"type\":\"type\"}],\"next_page_url\":null,\"previous_page_url\":null}",
6259+
"{\"data\":[{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"type\":\"type\"}],\"next_page_url\":null,\"previous_page_url\":null}",
62606260
"object_id=object_id");
62616261
var options = new Stripe.V2.Core.EventListOptions
62626262
{
@@ -6279,7 +6279,7 @@ public void TestV2CoreEventGet2()
62796279
HttpMethod.Get,
62806280
"/v2/core/events/id_123",
62816281
(HttpStatusCode)200,
6282-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"context\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"reason\":null,\"type\":\"type\"}");
6282+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"type\":\"type\"}");
62836283
var client = new StripeClient(this.Requestor);
62846284
var service = client.V2.Core.Events;
62856285
Stripe.V2.Event result = service.Get("id_123");
@@ -6293,7 +6293,7 @@ public void TestV2CoreEventDestinationGet()
62936293
HttpMethod.Get,
62946294
"/v2/core/event_destinations",
62956295
(HttpStatusCode)200,
6296-
"{\"data\":[{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}],\"next_page_url\":null,\"previous_page_url\":null}");
6296+
"{\"data\":[{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}],\"next_page_url\":null,\"previous_page_url\":null}");
62976297
var client = new StripeClient(this.Requestor);
62986298
var service = client.V2.Core.EventDestinations;
62996299
Stripe.V2.StripeList<Stripe.V2.EventDestination> eventDestinations = service
@@ -6308,7 +6308,7 @@ public void TestV2CoreEventDestinationPost()
63086308
HttpMethod.Post,
63096309
"/v2/core/event_destinations",
63106310
(HttpStatusCode)200,
6311-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}");
6311+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}");
63126312
var options = new Stripe.V2.Core.EventDestinationCreateOptions
63136313
{
63146314
EnabledEvents = new List<string> { "enabled_events" },
@@ -6330,10 +6330,10 @@ public void TestV2CoreEventDestinationDelete()
63306330
HttpMethod.Delete,
63316331
"/v2/core/event_destinations/id_123",
63326332
(HttpStatusCode)200,
6333-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}");
6333+
"{\"id\":\"abc_123\",\"object\":\"some.object.tag\"}");
63346334
var client = new StripeClient(this.Requestor);
63356335
var service = client.V2.Core.EventDestinations;
6336-
Stripe.V2.EventDestination deleted = service.Delete("id_123");
6336+
Stripe.V2.DeletedObject deleted = service.Delete("id_123");
63376337
this.AssertRequest(
63386338
HttpMethod.Delete,
63396339
"/v2/core/event_destinations/id_123");
@@ -6346,7 +6346,7 @@ public void TestV2CoreEventDestinationGet2()
63466346
HttpMethod.Get,
63476347
"/v2/core/event_destinations/id_123",
63486348
(HttpStatusCode)200,
6349-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}");
6349+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}");
63506350
var client = new StripeClient(this.Requestor);
63516351
var service = client.V2.Core.EventDestinations;
63526352
Stripe.V2.EventDestination eventDestination = service.Get("id_123");
@@ -6362,7 +6362,7 @@ public void TestV2CoreEventDestinationPost2()
63626362
HttpMethod.Post,
63636363
"/v2/core/event_destinations/id_123",
63646364
(HttpStatusCode)200,
6365-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}");
6365+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}");
63666366
var options = new Stripe.V2.Core.EventDestinationUpdateOptions();
63676367
var client = new StripeClient(this.Requestor);
63686368
var service = client.V2.Core.EventDestinations;
@@ -6381,7 +6381,7 @@ public void TestV2CoreEventDestinationPost3()
63816381
HttpMethod.Post,
63826382
"/v2/core/event_destinations/id_123/disable",
63836383
(HttpStatusCode)200,
6384-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}");
6384+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}");
63856385
var client = new StripeClient(this.Requestor);
63866386
var service = client.V2.Core.EventDestinations;
63876387
Stripe.V2.EventDestination eventDestination = service.Disable(
@@ -6398,7 +6398,7 @@ public void TestV2CoreEventDestinationPost4()
63986398
HttpMethod.Post,
63996399
"/v2/core/event_destinations/id_123/enable",
64006400
(HttpStatusCode)200,
6401-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"amazon_eventbridge\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"events_from\":null,\"livemode\":true,\"metadata\":null,\"name\":\"name\",\"snapshot_api_version\":null,\"status\":\"disabled\",\"status_details\":null,\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\",\"webhook_endpoint\":null}");
6401+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}");
64026402
var client = new StripeClient(this.Requestor);
64036403
var service = client.V2.Core.EventDestinations;
64046404
Stripe.V2.EventDestination eventDestination = service.Enable(
@@ -6415,7 +6415,7 @@ public void TestV2CoreEventDestinationPost5()
64156415
HttpMethod.Post,
64166416
"/v2/core/event_destinations/id_123/ping",
64176417
(HttpStatusCode)200,
6418-
"{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"context\":null,\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"reason\":null,\"type\":\"type\"}");
6418+
"{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"type\":\"type\"}");
64196419
var client = new StripeClient(this.Requestor);
64206420
var service = client.V2.Core.EventDestinations;
64216421
Stripe.V2.Event result = service.Ping("id_123");

0 commit comments

Comments
 (0)