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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Stripe.V2
namespace Stripe.V2.Core
{
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -96,13 +96,13 @@ public static EventNotification FromJson(string payload, StripeClient client)
}

protected internal T FetchEvent<T>()
where T : V2.Event
where T : V2.Core.Event
{
return this.FetchEventAsync<T>().ConfigureAwait(false).GetAwaiter().GetResult();
}

protected async Task<T> FetchEventAsync<T>(CancellationToken cancellationToken = default)
where T : V2.Event
where T : V2.Core.Event
{
if (this.Client == null)
{
Expand Down Expand Up @@ -147,4 +147,4 @@ protected virtual async Task<T> FetchRelatedObjectAsync<T>(EventNotificationRela
return this.Client.Deserialize<T>(res.Content);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down Expand Up @@ -28,4 +28,4 @@ public class EventNotificationReason
#endif
public EventNotificationReasonRequest Request { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down Expand Up @@ -28,4 +28,4 @@ public class EventNotificationReasonRequest
#endif
public string IdempotencyKey { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#nullable disable

namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand All @@ -27,4 +27,4 @@ public class EventNotificationRelatedObject
#endif
public string Url { get; internal set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using System;
using Newtonsoft.Json;
Expand All @@ -8,7 +8,7 @@ namespace Stripe.V2
#endif

/// <summary>
/// Code generated portion of Thin Event.
/// Code generated portion of V2 Event resource.
/// </summary>
public partial class Event : StripeEntity<Event>, IHasId, IHasObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Stripe.V2
namespace Stripe.V2.Core
{
using System;
using System.Net.Http;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File generated from our OpenAPI spec
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Stripe.V2
namespace Stripe.V2.Core
{
using Newtonsoft.Json;
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
namespace Stripe.V2
namespace Stripe.Events
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Stripe.V2.Core;
#if NET6_0_OR_GREATER
using STJS = System.Text.Json.Serialization;
#endif

/// <summary>
/// Represents an EventNotification that is valid, but that the SDK doesn't have types for. May have a RelatedObject and can be used to fetch the corresponding full event.
/// </summary>
public class UnknownEventNotification : EventNotification
public class UnknownEventNotification : V2.Core.EventNotification
{
#nullable enable
/// <summary>
Expand All @@ -24,14 +25,14 @@ public class UnknownEventNotification : EventNotification
#endif
public EventNotificationRelatedObject? RelatedObject { get; internal set; }

public V2.Event FetchEvent()
public V2.Core.Event FetchEvent()
{
return this.FetchEvent<V2.Event>();
return this.FetchEvent<V2.Core.Event>();
}

public Task<V2.Event> FetchEventAsync(CancellationToken cancellationToken = default)
public Task<V2.Core.Event> FetchEventAsync(CancellationToken cancellationToken = default)
{
return this.FetchEventAsync<V2.Event>(cancellationToken);
return this.FetchEventAsync<V2.Core.Event>(cancellationToken);
}

public StripeEntity FetchRelatedObject()
Expand All @@ -54,4 +55,4 @@ public Task<StripeEntity> FetchRelatedObjectAsync()
return this.FetchRelatedObjectAsync<StripeEntity>(this.RelatedObject);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Stripe.Events
/// <summary>
/// Occurs when a Meter has invalid async usage events.
/// </summary>
public class V1BillingMeterErrorReportTriggeredEvent : V2.Event
public class V1BillingMeterErrorReportTriggeredEvent : V2.Core.Event
{
/// <summary>
/// Data for the v1.billing.meter.error_report_triggered event.
Expand All @@ -30,7 +30,7 @@ public class V1BillingMeterErrorReportTriggeredEvent : V2.Event
[STJS.JsonPropertyName("related_object")]
#endif

public V2.EventRelatedObject RelatedObject { get; set; }
public V2.Core.EventRelatedObject RelatedObject { get; set; }

/// <summary>
/// Asynchronously retrieves the related object from the API. Make an API request on every
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Stripe.Events
/// <summary>
/// Occurs when a Meter has invalid async usage events.
/// </summary>
public class V1BillingMeterErrorReportTriggeredEventNotification : V2.EventNotification
public class V1BillingMeterErrorReportTriggeredEventNotification : V2.Core.EventNotification
{
/// <summary>
/// Object containing the reference to API resource relevant to the event.
Expand All @@ -21,7 +21,7 @@ public class V1BillingMeterErrorReportTriggeredEventNotification : V2.EventNotif
[STJS.JsonPropertyName("related_object")]
#endif

public V2.EventNotificationRelatedObject RelatedObject { get; set; }
public V2.Core.EventNotificationRelatedObject RelatedObject { get; set; }

/// <summary>
/// Asynchronously retrieves the related object from the API. Make an API request on every
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Events/V1BillingMeterNoMeterFoundEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Stripe.Events
/// <summary>
/// Occurs when a Meter's id is missing or invalid in async usage events.
/// </summary>
public class V1BillingMeterNoMeterFoundEvent : V2.Event
public class V1BillingMeterNoMeterFoundEvent : V2.Core.Event
{
/// <summary>
/// Data for the v1.billing.meter.no_meter_found event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Stripe.Events
/// <summary>
/// Occurs when a Meter's id is missing or invalid in async usage events.
/// </summary>
public class V1BillingMeterNoMeterFoundEventNotification : V2.EventNotification
public class V1BillingMeterNoMeterFoundEventNotification : V2.Core.EventNotification
{
public V1BillingMeterNoMeterFoundEvent FetchEvent()
{
Expand Down
12 changes: 6 additions & 6 deletions src/Stripe.net/Events/V2CoreEventDestinationPingEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Stripe.Events
/// <summary>
/// A ping event used to test the connection to an EventDestination.
/// </summary>
public class V2CoreEventDestinationPingEvent : V2.Event
public class V2CoreEventDestinationPingEvent : V2.Core.Event
{
/// <summary>
/// Object containing the reference to API resource relevant to the event.
Expand All @@ -20,23 +20,23 @@ public class V2CoreEventDestinationPingEvent : V2.Event
[STJS.JsonPropertyName("related_object")]
#endif

public V2.EventRelatedObject RelatedObject { get; set; }
public V2.Core.EventRelatedObject RelatedObject { get; set; }

/// <summary>
/// Asynchronously retrieves the related object from the API. Make an API request on every
/// call.
/// </summary>
public Task<V2.EventDestination> FetchRelatedObjectAsync()
public Task<V2.Core.EventDestination> FetchRelatedObjectAsync()
{
return this.FetchRelatedObjectAsync<V2.EventDestination>(this.RelatedObject);
return this.FetchRelatedObjectAsync<V2.Core.EventDestination>(this.RelatedObject);
}

/// <summary>
/// Retrieves the related object from the API. Make an API request on every call.
/// </summary>
public V2.EventDestination FetchRelatedObject()
public V2.Core.EventDestination FetchRelatedObject()
{
return this.FetchRelatedObject<V2.EventDestination>(this.RelatedObject);
return this.FetchRelatedObject<V2.Core.EventDestination>(this.RelatedObject);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Stripe.Events
/// <summary>
/// A ping event used to test the connection to an EventDestination.
/// </summary>
public class V2CoreEventDestinationPingEventNotification : V2.EventNotification
public class V2CoreEventDestinationPingEventNotification : V2.Core.EventNotification
{
/// <summary>
/// Object containing the reference to API resource relevant to the event.
Expand All @@ -21,23 +21,23 @@ public class V2CoreEventDestinationPingEventNotification : V2.EventNotification
[STJS.JsonPropertyName("related_object")]
#endif

public V2.EventNotificationRelatedObject RelatedObject { get; set; }
public V2.Core.EventNotificationRelatedObject RelatedObject { get; set; }

/// <summary>
/// Asynchronously retrieves the related object from the API. Make an API request on every
/// call.
/// </summary>
public Task<V2.EventDestination> FetchRelatedObjectAsync()
public Task<V2.Core.EventDestination> FetchRelatedObjectAsync()
{
return this.FetchRelatedObjectAsync<V2.EventDestination>(this.RelatedObject);
return this.FetchRelatedObjectAsync<V2.Core.EventDestination>(this.RelatedObject);
}

/// <summary>
/// Retrieves the related object from the API. Make an API request on every call.
/// </summary>
public V2.EventDestination FetchRelatedObject()
public V2.Core.EventDestination FetchRelatedObject()
{
return this.FetchRelatedObject<V2.EventDestination>(this.RelatedObject);
return this.FetchRelatedObject<V2.Core.EventDestination>(this.RelatedObject);
}

public V2CoreEventDestinationPingEvent FetchEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override bool CanConvert(Type objectType)
{
var typeInfo = objectType.GetTypeInfo();
return (typeInfo.IsInterface && typeInfo.FullName.StartsWith("Stripe")) ||
typeInfo.FullName.Equals("Stripe.V2.Event");
typeInfo.FullName.Equals("Stripe.V2.Core.Event");
}

public override JsonConverter CreateConverter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace Stripe.Infrastructure
using static Stripe.Infrastructure.SerializablePropertyCache;

/// <summary>
/// Converts a <see cref="V2.Event"/> to JSON, including any fields
/// Converts a <see cref="V2.Core.Event"/> to JSON, including any fields
/// in derived classes.
/// </summary>
internal class STJV2EventConverter : STJDefaultConverter<V2.Event>
internal class STJV2EventConverter : STJDefaultConverter<V2.Core.Event>
{
/// <summary>
/// Reads the JSON representation of the object.
Expand All @@ -20,7 +20,7 @@ internal class STJV2EventConverter : STJDefaultConverter<V2.Event>
/// <param name="typeToConvert">Type of the object.</param>
/// <param name="options">The calling serializer's options.</param>
/// <returns>The object value.</returns>
public override V2.Event Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
public override V2.Core.Event Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotSupportedException("STJV2EventConverter should only be used while serializing.");
}
Expand All @@ -34,7 +34,7 @@ public override V2.Event Read(ref Utf8JsonReader reader, Type typeToConvert, Jso
/// </returns>
public override bool CanConvert(Type objectType)
{
return typeof(Stripe.V2.Event).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
return typeof(Stripe.V2.Core.Event).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace Stripe.Infrastructure
using static Stripe.Infrastructure.SerializablePropertyCache;

/// <summary>
/// Converts a <see cref="V2.Event"/> to JSON, including any fields
/// Converts a <see cref="V2.Core.Event"/> to JSON, including any fields
/// in derived classes.
/// </summary>
internal class STJV2EventNotificationConverter : STJDefaultConverter<V2.EventNotification>
internal class STJV2EventNotificationConverter : STJDefaultConverter<V2.Core.EventNotification>
{
/// <summary>
/// Reads the JSON representation of the object.
Expand All @@ -20,7 +20,7 @@ internal class STJV2EventNotificationConverter : STJDefaultConverter<V2.EventNot
/// <param name="typeToConvert">Type of the object.</param>
/// <param name="options">The calling serializer's options.</param>
/// <returns>The object value.</returns>
public override V2.EventNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
public override V2.Core.EventNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotSupportedException("STJV2EventConverter should only be used while serializing.");
}
Expand All @@ -34,7 +34,7 @@ public override V2.EventNotification Read(ref Utf8JsonReader reader, Type typeTo
/// </returns>
public override bool CanConvert(Type objectType)
{
return typeof(Stripe.V2.EventNotification).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
return typeof(Stripe.V2.Core.EventNotification).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
}
}
Expand Down
Loading
Loading