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
Expand Up @@ -71,76 +71,5 @@ public partial interface ISightengineClient
string? callbackUrl = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);

/// <summary>
/// Check Video (Asynchronous)<br/>
/// Start asynchronous video or live stream moderation.<br/>
/// Results are delivered via the callback URL.<br/>
/// Supports videos longer than 60 seconds and live streams<br/>
/// (HLS, RTMP, RTMPS, RTSP, RTP, MPEG-DASH).
/// </summary>
/// <param name="media">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="medianame">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="streamUrl">
/// Public URL of the video or live stream.
/// </param>
/// <param name="callbackUrl">
/// Webhook URL to receive moderation results.
/// </param>
/// <param name="models">
/// Comma-separated list of detection models.<br/>
/// Available: nudity-2.1, gore-2.0, weapon, drugs, violence,<br/>
/// alcohol, offensive, self-harm, scam.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Sightengine.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Sightengine.VideoCheckAsyncResponse> CheckVideoAsyncAsync(
string models,
global::System.IO.Stream? media = default,
string? medianame = default,
string? streamUrl = default,
string? callbackUrl = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Check Video (Asynchronous)<br/>
/// Start asynchronous video or live stream moderation.<br/>
/// Results are delivered via the callback URL.<br/>
/// Supports videos longer than 60 seconds and live streams<br/>
/// (HLS, RTMP, RTMPS, RTSP, RTP, MPEG-DASH).
/// </summary>
/// <param name="media">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="medianame">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="streamUrl">
/// Public URL of the video or live stream.
/// </param>
/// <param name="callbackUrl">
/// Webhook URL to receive moderation results.
/// </param>
/// <param name="models">
/// Comma-separated list of detection models.<br/>
/// Available: nudity-2.1, gore-2.0, weapon, drugs, violence,<br/>
/// alcohol, offensive, self-harm, scam.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Sightengine.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Sightengine.AutoSDKHttpResponse<global::Sightengine.VideoCheckAsyncResponse>> CheckVideoAsyncAsResponseAsync(
string models,
global::System.IO.Stream? media = default,
string? medianame = default,
string? streamUrl = default,
string? callbackUrl = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,64 +61,5 @@ public partial interface ISightengineClient
string? streamUrl = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);

/// <summary>
/// Check Video (Synchronous)<br/>
/// Moderate a video synchronously (must be under 60 seconds).<br/>
/// Submit either a raw video file or a public URL.
/// </summary>
/// <param name="media">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="medianame">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="streamUrl">
/// Public URL of the video (use this OR media).
/// </param>
/// <param name="models">
/// Comma-separated list of detection models.<br/>
/// Available: nudity-2.1, gore-2.0, weapon, drugs, violence,<br/>
/// alcohol, offensive, self-harm, scam.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Sightengine.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Sightengine.VideoCheckSyncResponse> CheckVideoSyncAsync(
string models,
global::System.IO.Stream? media = default,
string? medianame = default,
string? streamUrl = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Check Video (Synchronous)<br/>
/// Moderate a video synchronously (must be under 60 seconds).<br/>
/// Submit either a raw video file or a public URL.
/// </summary>
/// <param name="media">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="medianame">
/// The video file to analyze (use this OR stream_url).
/// </param>
/// <param name="streamUrl">
/// Public URL of the video (use this OR media).
/// </param>
/// <param name="models">
/// Comma-separated list of detection models.<br/>
/// Available: nudity-2.1, gore-2.0, weapon, drugs, violence,<br/>
/// alcohol, offensive, self-harm, scam.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Sightengine.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Sightengine.AutoSDKHttpResponse<global::Sightengine.VideoCheckSyncResponse>> CheckVideoSyncAsResponseAsync(
string models,
global::System.IO.Stream? media = default,
string? medianame = default,
string? streamUrl = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,74 +68,5 @@ public partial interface ISightengineClient
string? medianame = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);

/// <summary>
/// Submit Feedback<br/>
/// Submit moderation feedback to improve model accuracy.<br/>
/// Feedback submissions are free and do not count as operations.<br/>
/// The image is used to continuously improve the specified model.
/// </summary>
/// <param name="url">
/// Public URL to the image (use this OR media).
/// </param>
/// <param name="media">
/// The image file (use this OR url).
/// </param>
/// <param name="medianame">
/// The image file (use this OR url).
/// </param>
/// <param name="model">
/// The model that classified the image.<br/>
/// Available: nudity, gore, weapon, drugs, violence,<br/>
/// alcohol, offensive, self-harm, scam, genai.
/// </param>
/// <param name="class">
/// The expected/correct classification result.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Sightengine.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Sightengine.FeedbackResponse> SubmitFeedbackAsync(
string model,
string @class,
string? url = default,
global::System.IO.Stream? media = default,
string? medianame = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Submit Feedback<br/>
/// Submit moderation feedback to improve model accuracy.<br/>
/// Feedback submissions are free and do not count as operations.<br/>
/// The image is used to continuously improve the specified model.
/// </summary>
/// <param name="url">
/// Public URL to the image (use this OR media).
/// </param>
/// <param name="media">
/// The image file (use this OR url).
/// </param>
/// <param name="medianame">
/// The image file (use this OR url).
/// </param>
/// <param name="model">
/// The model that classified the image.<br/>
/// Available: nudity, gore, weapon, drugs, violence,<br/>
/// alcohol, offensive, self-harm, scam, genai.
/// </param>
/// <param name="class">
/// The expected/correct classification result.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Sightengine.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Sightengine.AutoSDKHttpResponse<global::Sightengine.FeedbackResponse>> SubmitFeedbackAsResponseAsync(
string model,
string @class,
string? url = default,
global::System.IO.Stream? media = default,
string? medianame = default,
global::Sightengine.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
81 changes: 81 additions & 0 deletions src/libs/Sightengine/Generated/Sightengine.OptionsSupport.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,84 @@ public interface IAutoSDKAuthorizationProvider
global::Sightengine.AutoSDKHookContext context);
}

/// <summary>
/// Marker keys stamped onto outgoing <see cref="global::System.Net.Http.HttpRequestMessage"/>
/// instances so consumer <see cref="global::System.Net.Http.DelegatingHandler"/>s — and any
/// other transport-layer code that runs after AutoSDK's send pipeline — can observe whether
/// the resolved Authorization is call-scoped and opt out of overwriting it with a
/// rotation-aware account-level credential.
/// </summary>
public static class AutoSDKHttpRequestOptions
{
/// <summary>
/// Key under which <see cref="StampAuthorizationOverride"/> records the marker. Exposed
/// for handlers that target frameworks older than .NET 5 and need to read the value
/// through the legacy <c>HttpRequestMessage.Properties</c> bag.
/// </summary>
public const string AuthorizationOverrideKey = "AutoSDK.AuthorizationOverride";

#if NET5_0_OR_GREATER
/// <summary>
/// Strongly-typed <see cref="global::System.Net.Http.HttpRequestOptionsKey{TValue}"/> for
/// the call-scoped Authorization marker on .NET 5+ targets. Consumers should prefer this
/// over the legacy <c>HttpRequestMessage.Properties</c> bag where available.
/// </summary>
public static readonly global::System.Net.Http.HttpRequestOptionsKey<bool> AuthorizationOverride =
new global::System.Net.Http.HttpRequestOptionsKey<bool>(AuthorizationOverrideKey);
#endif

/// <summary>
/// Stamps the call-scoped Authorization marker on <paramref name="request"/>. AutoSDK's
/// built-in <see cref="AutoSDKAuthorizationProviderHook"/> calls this whenever the
/// resolved auth came from a per-request override or a client-level
/// <see cref="IAutoSDKAuthorizationProvider"/>. Hand-written SDK extensions that set a
/// non-default <c>Authorization</c> header (e.g. a session-scoped bearer returned by an
/// upstream poll) should call this too so downstream rotation handlers know to skip the
/// overwrite.
/// </summary>
/// <param name="request"></param>
public static void StampAuthorizationOverride(
global::System.Net.Http.HttpRequestMessage? request)
{
if (request is null)
{
return;
}

#if NET5_0_OR_GREATER
request.Options.Set(AuthorizationOverride, true);
#else
#pragma warning disable CS0618 // HttpRequestMessage.Properties is obsolete in NET5+, but the only option below it.
request.Properties[AuthorizationOverrideKey] = true;
#pragma warning restore CS0618
#endif
}

/// <summary>
/// Returns true when <see cref="StampAuthorizationOverride"/> previously marked the
/// request as carrying a call-scoped Authorization.
/// </summary>
/// <param name="request"></param>
public static bool HasAuthorizationOverride(
global::System.Net.Http.HttpRequestMessage? request)
{
if (request is null)
{
return false;
}

#if NET5_0_OR_GREATER
return request.Options.TryGetValue(AuthorizationOverride, out var value) && value;
#else
#pragma warning disable CS0618
return request.Properties.TryGetValue(AuthorizationOverrideKey, out var raw) &&
raw is bool flag &&
flag;
#pragma warning restore CS0618
#endif
}
}

/// <summary>
/// Built-in <see cref="IAutoSDKHook"/> that consults
/// <see cref="AutoSDKClientOptions.AuthorizationProvider"/> before every outgoing
Expand All @@ -176,6 +254,7 @@ public sealed class AutoSDKAuthorizationProviderHook : global::Sightengine.AutoS
ApplyAuthorization(context.Request, perRequest[index]);
}

global::Sightengine.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request);
return;
}

Expand All @@ -195,6 +274,8 @@ public sealed class AutoSDKAuthorizationProviderHook : global::Sightengine.AutoS
{
ApplyAuthorization(context.Request, resolved[index]);
}

global::Sightengine.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request);
}

private static void ApplyAuthorization(
Expand Down
Loading