From da0242f1285c5a6ee7c043ca1d1cce988ff97a14 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 13:14:29 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Writesonic.AutoSDKHttpResponse.g.cs | 121 +++++++++ ...sonic.IWritesonicClient.AidaFramework.g.cs | 19 ++ ...sonicClient.AmazonProductDescriptions.g.cs | 19 ++ ...nic.IWritesonicClient.ArticleWriterV3.g.cs | 19 ++ ...ritesonic.IWritesonicClient.BlogIdeas.g.cs | 19 ++ ...itesonic.IWritesonicClient.BlogIntros.g.cs | 19 ++ ...esonic.IWritesonicClient.BlogOutlines.g.cs | 19 ++ ...ritesonic.IWritesonicClient.ChatSonic.g.cs | 20 ++ ...itesonic.IWritesonicClient.ColdEmails.g.cs | 19 ++ ...nic.IWritesonicClient.ContentRephrase.g.cs | 19 ++ ...onic.IWritesonicClient.ContentShorten.g.cs | 19 ++ ...c.IWritesonicClient.EmailSubjectLines.g.cs | 19 ++ ...tesonic.IWritesonicClient.FacebookAds.g.cs | 19 ++ ...sonic.IWritesonicClient.GenerateImage.g.cs | 13 + ...ritesonic.IWritesonicClient.GoogleAds.g.cs | 19 ++ ...c.IWritesonicClient.InstagramCaptions.g.cs | 19 ++ ...tesonic.IWritesonicClient.LinkedInAds.g.cs | 19 ++ ...WritesonicClient.PassiveToActiveVoice.g.cs | 19 ++ ...IWritesonicClient.ProductDescriptions.g.cs | 19 ++ ...esonic.IWritesonicClient.ProductNames.g.cs | 19 ++ ....IWritesonicClient.QuestionGeneration.g.cs | 19 ++ ...IWritesonicClient.SeoMetaTagsBlogPost.g.cs | 19 ++ ...IWritesonicClient.SeoMetaTagsHomepage.g.cs | 19 ++ ...itesonicClient.SeoMetaTagsProductPage.g.cs | 19 ++ ...sonic.IWritesonicClient.TikTokScripts.g.cs | 19 ++ ...tesonic.IWritesonicClient.ToneChanger.g.cs | 19 ++ .../Writesonic.IWritesonicClient.Tweets.g.cs | 19 ++ .../Generated/Writesonic.OptionsSupport.g.cs | 231 +++++++++++++++++- ...esonic.WritesonicClient.AidaFramework.g.cs | 79 +++++- ...sonicClient.AmazonProductDescriptions.g.cs | 79 +++++- ...onic.WritesonicClient.ArticleWriterV3.g.cs | 79 +++++- ...Writesonic.WritesonicClient.BlogIdeas.g.cs | 79 +++++- ...ritesonic.WritesonicClient.BlogIntros.g.cs | 79 +++++- ...tesonic.WritesonicClient.BlogOutlines.g.cs | 79 +++++- ...Writesonic.WritesonicClient.ChatSonic.g.cs | 80 +++++- ...ritesonic.WritesonicClient.ColdEmails.g.cs | 79 +++++- ...onic.WritesonicClient.ContentRephrase.g.cs | 79 +++++- ...sonic.WritesonicClient.ContentShorten.g.cs | 79 +++++- ...ic.WritesonicClient.EmailSubjectLines.g.cs | 79 +++++- ...itesonic.WritesonicClient.FacebookAds.g.cs | 79 +++++- ...esonic.WritesonicClient.GenerateImage.g.cs | 66 ++++- ...Writesonic.WritesonicClient.GoogleAds.g.cs | 79 +++++- ...ic.WritesonicClient.InstagramCaptions.g.cs | 79 +++++- ...itesonic.WritesonicClient.LinkedInAds.g.cs | 79 +++++- ...WritesonicClient.PassiveToActiveVoice.g.cs | 79 +++++- ....WritesonicClient.ProductDescriptions.g.cs | 79 +++++- ...tesonic.WritesonicClient.ProductNames.g.cs | 79 +++++- ...c.WritesonicClient.QuestionGeneration.g.cs | 79 +++++- ....WritesonicClient.SeoMetaTagsBlogPost.g.cs | 79 +++++- ....WritesonicClient.SeoMetaTagsHomepage.g.cs | 79 +++++- ...itesonicClient.SeoMetaTagsProductPage.g.cs | 79 +++++- ...esonic.WritesonicClient.TikTokScripts.g.cs | 79 +++++- ...itesonic.WritesonicClient.ToneChanger.g.cs | 79 +++++- .../Writesonic.WritesonicClient.Tweets.g.cs | 79 +++++- .../Writesonic.WritesonicClient.g.cs | 8 +- 55 files changed, 2623 insertions(+), 268 deletions(-) create mode 100644 src/libs/Writesonic/Generated/Writesonic.AutoSDKHttpResponse.g.cs diff --git a/src/libs/Writesonic/Generated/Writesonic.AutoSDKHttpResponse.g.cs b/src/libs/Writesonic/Generated/Writesonic.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..69f0a6c --- /dev/null +++ b/src/libs/Writesonic/Generated/Writesonic.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace Writesonic +{ + /// + /// Represents a successful HTTP response with status code and headers. + /// + public partial class AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri) + { + StatusCode = statusCode; + Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers)); + RequestUri = requestUri; + } + + /// + /// Gets the HTTP status code. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// Gets the response headers. + /// + public global::System.Collections.Generic.Dictionary> Headers { get; } + /// + /// Gets the final request URI associated with the response. + /// + public global::System.Uri? RequestUri { get; } + + internal static global::System.Collections.Generic.Dictionary> CreateHeaders( + global::System.Net.Http.HttpResponseMessage response) + { + response = response ?? throw new global::System.ArgumentNullException(nameof(response)); + + var headers = global::System.Linq.Enumerable.ToDictionary( + response.Headers, + static header => header.Key, + static header => (global::System.Collections.Generic.IEnumerable)global::System.Linq.Enumerable.ToArray(header.Value), + global::System.StringComparer.OrdinalIgnoreCase); + + if (response.Content?.Headers == null) + { + return headers; + } + + foreach (var header in response.Content.Headers) + { + if (headers.TryGetValue(header.Key, out var existingValues)) + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Concat(existingValues, header.Value)); + } + else + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value); + } + } + + return headers; + } + } + + /// + /// Represents a successful HTTP response with status code, headers, and body. + /// + public partial class AutoSDKHttpResponse : AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + T body) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null, + body: body) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri, + T body) + : base(statusCode, headers, requestUri) + { + Body = body; + } + + /// + /// Gets the response body. + /// + public T Body { get; } + } +} \ No newline at end of file diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AidaFramework.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AidaFramework.g.cs index a040c81..4cdd898 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AidaFramework.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AidaFramework.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> AidaFrameworkAsResponseAsync( + global::Writesonic.AidaFrameworkEngine engine, + global::Writesonic.AidaFrameworkLanguage language, + int numCopies, + + global::Writesonic.AidaRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// AIDA Framework
+ /// Generate marketing copy using the AIDA (Attention, Interest, Desire, Action) framework. + ///
+ /// + /// + /// /// /// Name of the product or service. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AmazonProductDescriptions.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AmazonProductDescriptions.g.cs index a62a6cd..d4ff1c1 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AmazonProductDescriptions.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.AmazonProductDescriptions.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> AmazonProductDescriptionsAsResponseAsync( + global::Writesonic.AmazonProductDescriptionsEngine engine, + global::Writesonic.AmazonProductDescriptionsLanguage language, + int numCopies, + + global::Writesonic.AmazonProductDescriptionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Amazon Product Descriptions
+ /// Generate optimized Amazon product descriptions. + ///
+ /// + /// + /// /// /// Name of the Amazon product. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ArticleWriterV3.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ArticleWriterV3.g.cs index 70a18cf..c5b5e91 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ArticleWriterV3.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ArticleWriterV3.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ArticleWriterV3AsResponseAsync( + global::Writesonic.ArticleWriterV3Engine engine, + global::Writesonic.ArticleWriterV3Language language, + int numCopies, + + global::Writesonic.ArticleWriterV3Request request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// AI Article Writer 3.0
+ /// Generate a full-length SEO-optimized article (~1500 words) from a title, intro, and section titles. + ///
+ /// + /// + /// /// /// Title of the article to generate. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIdeas.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIdeas.g.cs index f407606..6a85643 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIdeas.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIdeas.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> BlogIdeasAsResponseAsync( + global::Writesonic.BlogIdeasEngine engine, + global::Writesonic.BlogIdeasLanguage language, + int numCopies, + + global::Writesonic.BlogIdeasRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// AI Article Ideas
+ /// Generate creative blog article ideas for a given topic. + ///
+ /// + /// + /// /// /// Topic to generate blog article ideas for. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIntros.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIntros.g.cs index 4c717a7..a1de68d 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIntros.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogIntros.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> BlogIntrosAsResponseAsync( + global::Writesonic.BlogIntrosEngine engine, + global::Writesonic.BlogIntrosLanguage language, + int numCopies, + + global::Writesonic.BlogIntrosRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// AI Article Intros
+ /// Generate compelling introductions for a blog article. + ///
+ /// + /// + /// /// /// Title of the blog article to generate an introduction for. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogOutlines.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogOutlines.g.cs index d572e93..bf484b9 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogOutlines.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.BlogOutlines.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> BlogOutlinesAsResponseAsync( + global::Writesonic.BlogOutlinesEngine engine, + global::Writesonic.BlogOutlinesLanguage language, + int numCopies, + + global::Writesonic.BlogOutlinesRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// AI Article Outlines
+ /// Generate structured outlines for a blog article. + ///
+ /// + /// + /// /// /// Title of the blog article to generate an outline for. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ChatSonic.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ChatSonic.g.cs index 0c27527..9669bf2 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ChatSonic.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ChatSonic.g.cs @@ -32,6 +32,26 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ChatSonicAsResponseAsync( + global::Writesonic.ChatSonicEngine engine, + global::Writesonic.ChatSonicLanguage language, + int numCopies, + + global::Writesonic.ChatSonicRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// ChatSonic (Like ChatGPT)
+ /// Conversational AI chatbot with real-time Google search integration,
+ /// memory functionality, and support for 24 languages. + ///
+ /// + /// + /// /// /// When enabled, ChatSonic uses Google search results to answer.
/// Default Value: true diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ColdEmails.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ColdEmails.g.cs index 68aeef3..0710f5c 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ColdEmails.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ColdEmails.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ColdEmailsAsResponseAsync( + global::Writesonic.ColdEmailsEngine engine, + global::Writesonic.ColdEmailsLanguage language, + int numCopies, + + global::Writesonic.ColdEmailsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cold Emails
+ /// Generate personalized cold email copy with sender and recipient context. + ///
+ /// + /// + /// /// /// Sender name. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentRephrase.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentRephrase.g.cs index 9bada09..d542eae 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentRephrase.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentRephrase.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ContentRephraseAsResponseAsync( + global::Writesonic.ContentRephraseEngine engine, + global::Writesonic.ContentRephraseLanguage language, + int numCopies, + + global::Writesonic.ContentRephraseRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Content Rephrase
+ /// Rephrase content while maintaining meaning, optionally with a specific tone. + ///
+ /// + /// + /// /// /// The text content to rephrase. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentShorten.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentShorten.g.cs index 42af2f5..f0c2db8 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentShorten.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ContentShorten.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ContentShortenAsResponseAsync( + global::Writesonic.ContentShortenEngine engine, + global::Writesonic.ContentShortenLanguage language, + int numCopies, + + global::Writesonic.ContentShortenRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Content Shorten
+ /// Shorten content while preserving key information. + ///
+ /// + /// + /// /// /// The text content to shorten. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.EmailSubjectLines.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.EmailSubjectLines.g.cs index 5adc996..8d73c34 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.EmailSubjectLines.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.EmailSubjectLines.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> EmailSubjectLinesAsResponseAsync( + global::Writesonic.EmailSubjectLinesEngine engine, + global::Writesonic.EmailSubjectLinesLanguage language, + int numCopies, + + global::Writesonic.SubjectLinesRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Email Subject Lines
+ /// Generate attention-grabbing email subject lines. + ///
+ /// + /// + /// /// /// Name of the product or service. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.FacebookAds.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.FacebookAds.g.cs index 38a3ef5..bce2c5d 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.FacebookAds.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.FacebookAds.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> FacebookAdsAsResponseAsync( + global::Writesonic.FacebookAdsEngine engine, + global::Writesonic.FacebookAdsLanguage language, + int numCopies, + + global::Writesonic.FacebookAdsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Facebook Ads
+ /// Generate compelling Facebook ad copy. + ///
+ /// + /// + /// /// /// Name of the product or service. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GenerateImage.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GenerateImage.g.cs index 6276ec4..9e26964 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GenerateImage.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GenerateImage.g.cs @@ -21,6 +21,19 @@ public partial interface IWritesonicClient /// Generate Image
/// Generate images from text descriptions using Photosonic AI. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GenerateImageAsResponseAsync( + + global::Writesonic.GenerateImageRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate Image
+ /// Generate images from text descriptions using Photosonic AI. + ///
/// /// Description of the image to generate. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GoogleAds.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GoogleAds.g.cs index 9bfc387..ed8719a 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GoogleAds.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.GoogleAds.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> GoogleAdsAsResponseAsync( + global::Writesonic.GoogleAdsEngine engine, + global::Writesonic.GoogleAdsLanguage language, + int numCopies, + + global::Writesonic.GoogleAdsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Google Ads
+ /// Generate Google Ads headlines and descriptions. + ///
+ /// + /// + /// /// /// Name of the product or service. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.InstagramCaptions.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.InstagramCaptions.g.cs index 327204b..8980917 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.InstagramCaptions.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.InstagramCaptions.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> InstagramCaptionsAsResponseAsync( + global::Writesonic.InstagramCaptionsEngine engine, + global::Writesonic.InstagramCaptionsLanguage language, + int numCopies, + + global::Writesonic.InstagramCaptionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Instagram Captions
+ /// Generate engaging Instagram captions for posts. + ///
+ /// + /// + /// /// /// Description of the Instagram post content. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.LinkedInAds.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.LinkedInAds.g.cs index 596426a..9cee16b 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.LinkedInAds.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.LinkedInAds.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> LinkedInAdsAsResponseAsync( + global::Writesonic.LinkedInAdsEngine engine, + global::Writesonic.LinkedInAdsLanguage language, + int numCopies, + + global::Writesonic.LinkedInAdsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// LinkedIn Ads
+ /// Generate professional LinkedIn ad copy. + ///
+ /// + /// + /// /// /// Name of the product or service. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.PassiveToActiveVoice.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.PassiveToActiveVoice.g.cs index 8c53881..97cb81b 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.PassiveToActiveVoice.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.PassiveToActiveVoice.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> PassiveToActiveVoiceAsResponseAsync( + global::Writesonic.PassiveToActiveVoiceEngine engine, + global::Writesonic.PassiveToActiveVoiceLanguage language, + int numCopies, + + global::Writesonic.ActiveVoiceRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Passive to Active Voice
+ /// Convert content from passive voice to active voice for more engaging writing. + ///
+ /// + /// + /// /// /// The text content to convert from passive to active voice. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductDescriptions.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductDescriptions.g.cs index 0896be4..fc23c0f 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductDescriptions.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductDescriptions.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ProductDescriptionsAsResponseAsync( + global::Writesonic.ProductDescriptionsEngine engine, + global::Writesonic.ProductDescriptionsLanguage language, + int numCopies, + + global::Writesonic.ProductDescriptionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Product Descriptions
+ /// Generate compelling product descriptions. + ///
+ /// + /// + /// /// /// Name of the product. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductNames.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductNames.g.cs index d714e5b..25516eb 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductNames.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ProductNames.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ProductNamesAsResponseAsync( + global::Writesonic.ProductNamesEngine engine, + global::Writesonic.ProductNamesLanguage language, + int numCopies, + + global::Writesonic.ProductNamesRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Product Names
+ /// Generate creative product names from a description and keywords. + ///
+ /// + /// + /// /// /// Description of the product to name. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.QuestionGeneration.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.QuestionGeneration.g.cs index 86a202e..ffbe34e 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.QuestionGeneration.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.QuestionGeneration.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> QuestionGenerationAsResponseAsync( + global::Writesonic.QuestionGenerationEngine engine, + global::Writesonic.QuestionGenerationLanguage language, + int numCopies, + + global::Writesonic.QuestionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Questions
+ /// Generate engaging questions and polls that increase audience participation. + ///
+ /// + /// + /// /// /// Topic for generating questions or polls. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsBlogPost.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsBlogPost.g.cs index 20258bd..1569407 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsBlogPost.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsBlogPost.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> SeoMetaTagsBlogPostAsResponseAsync( + global::Writesonic.SeoMetaTagsBlogPostEngine engine, + global::Writesonic.SeoMetaTagsBlogPostLanguage language, + int numCopies, + + global::Writesonic.SeoMetaTagsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// SEO Meta Tags (Blog Post)
+ /// Generate SEO meta title and description for a blog post. + ///
+ /// + /// + /// /// /// Title of the page for SEO meta tags. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsHomepage.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsHomepage.g.cs index 84cd6fb..39f77a3 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsHomepage.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsHomepage.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> SeoMetaTagsHomepageAsResponseAsync( + global::Writesonic.SeoMetaTagsHomepageEngine engine, + global::Writesonic.SeoMetaTagsHomepageLanguage language, + int numCopies, + + global::Writesonic.SeoMetaTagsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// SEO Meta Tags (Homepage)
+ /// Generate SEO meta title and description for a homepage. + ///
+ /// + /// + /// /// /// Title of the page for SEO meta tags. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsProductPage.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsProductPage.g.cs index b3847ae..92f5a1b 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsProductPage.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.SeoMetaTagsProductPage.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> SeoMetaTagsProductPageAsResponseAsync( + global::Writesonic.SeoMetaTagsProductPageEngine engine, + global::Writesonic.SeoMetaTagsProductPageLanguage language, + int numCopies, + + global::Writesonic.SeoMetaTagsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// SEO Meta Tags (Product Page)
+ /// Generate SEO meta title and description for a product page. + ///
+ /// + /// + /// /// /// Title of the page for SEO meta tags. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.TikTokScripts.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.TikTokScripts.g.cs index 2470a0d..0b5f1c4 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.TikTokScripts.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.TikTokScripts.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> TikTokScriptsAsResponseAsync( + global::Writesonic.TikTokScriptsEngine engine, + global::Writesonic.TikTokScriptsLanguage language, + int numCopies, + + global::Writesonic.TikTokScriptsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// TikTok Video Scripts
+ /// Generate creative TikTok video scripts for a topic. + ///
+ /// + /// + /// /// /// Topic for the TikTok video script. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ToneChanger.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ToneChanger.g.cs index 82002b6..5792583 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ToneChanger.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.ToneChanger.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> ToneChangerAsResponseAsync( + global::Writesonic.ToneChangerEngine engine, + global::Writesonic.ToneChangerLanguage language, + int numCopies, + + global::Writesonic.ToneChangerRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Tone Changer
+ /// Change the tone of content to match a desired style (professional, casual, friendly, etc.). + ///
+ /// + /// + /// /// /// The text content whose tone should be changed. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.Tweets.g.cs b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.Tweets.g.cs index cbeb4ee..156a7cd 100644 --- a/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.Tweets.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.IWritesonicClient.Tweets.g.cs @@ -30,6 +30,25 @@ public partial interface IWritesonicClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> TweetsAsResponseAsync( + global::Writesonic.TweetsEngine engine, + global::Writesonic.TweetsLanguage language, + int numCopies, + + global::Writesonic.TweetsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Tweets
+ /// Generate engaging tweets for a topic. + ///
+ /// + /// + /// /// /// Topic for the tweet. /// diff --git a/src/libs/Writesonic/Generated/Writesonic.OptionsSupport.g.cs b/src/libs/Writesonic/Generated/Writesonic.OptionsSupport.g.cs index 9e84e1e..e6ec30f 100644 --- a/src/libs/Writesonic/Generated/Writesonic.OptionsSupport.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::Writesonic.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::Writesonic.AutoSDKClientOptions clientOptions, global::Writesonic.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::Writesonic.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::Writesonic.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode( diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AidaFramework.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AidaFramework.g.cs index 0a62190..cb60f09 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AidaFramework.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AidaFramework.g.cs @@ -63,6 +63,38 @@ partial void ProcessAidaFrameworkResponseContent( global::Writesonic.AidaFrameworkLanguage language, int numCopies, + global::Writesonic.AidaRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AidaFrameworkAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// AIDA Framework
+ /// Generate marketing copy using the AIDA (Attention, Interest, Desire, Action) framework. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> AidaFrameworkAsResponseAsync( + global::Writesonic.AidaFrameworkEngine engine, + global::Writesonic.AidaFrameworkLanguage language, + int numCopies, + global::Writesonic.AidaRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessAidaFrameworkResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/aida", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessAidaFrameworkResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessAidaFrameworkResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessAidaFrameworkResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessAidaFrameworkResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessAidaFrameworkResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessAidaFrameworkResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessAidaFrameworkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessAidaFrameworkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessAidaFrameworkResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessAidaFrameworkResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AmazonProductDescriptions.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AmazonProductDescriptions.g.cs index 0679be8..0e28667 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AmazonProductDescriptions.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.AmazonProductDescriptions.g.cs @@ -63,6 +63,38 @@ partial void ProcessAmazonProductDescriptionsResponseContent( global::Writesonic.AmazonProductDescriptionsLanguage language, int numCopies, + global::Writesonic.AmazonProductDescriptionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AmazonProductDescriptionsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Amazon Product Descriptions
+ /// Generate optimized Amazon product descriptions. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> AmazonProductDescriptionsAsResponseAsync( + global::Writesonic.AmazonProductDescriptionsEngine engine, + global::Writesonic.AmazonProductDescriptionsLanguage language, + int numCopies, + global::Writesonic.AmazonProductDescriptionsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessAmazonProductDescriptionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/amazon-product-descriptions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessAmazonProductDescriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessAmazonProductDescriptionsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessAmazonProductDescriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessAmazonProductDescriptionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessAmazonProductDescriptionsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessAmazonProductDescriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessAmazonProductDescriptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessAmazonProductDescriptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessAmazonProductDescriptionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessAmazonProductDescriptionsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ArticleWriterV3.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ArticleWriterV3.g.cs index dd3be2d..b69d9a3 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ArticleWriterV3.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ArticleWriterV3.g.cs @@ -63,6 +63,38 @@ partial void ProcessArticleWriterV3ResponseContent( global::Writesonic.ArticleWriterV3Language language, int numCopies, + global::Writesonic.ArticleWriterV3Request request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ArticleWriterV3AsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// AI Article Writer 3.0
+ /// Generate a full-length SEO-optimized article (~1500 words) from a title, intro, and section titles. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ArticleWriterV3AsResponseAsync( + global::Writesonic.ArticleWriterV3Engine engine, + global::Writesonic.ArticleWriterV3Language language, + int numCopies, + global::Writesonic.ArticleWriterV3Request request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessArticleWriterV3ResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/ai-article-writer-v3", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessArticleWriterV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessArticleWriterV3ResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessArticleWriterV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessArticleWriterV3ResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessArticleWriterV3ResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessArticleWriterV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessArticleWriterV3ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessArticleWriterV3ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessArticleWriterV3ResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessArticleWriterV3ResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIdeas.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIdeas.g.cs index 3781080..7398d79 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIdeas.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIdeas.g.cs @@ -63,6 +63,38 @@ partial void ProcessBlogIdeasResponseContent( global::Writesonic.BlogIdeasLanguage language, int numCopies, + global::Writesonic.BlogIdeasRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await BlogIdeasAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// AI Article Ideas
+ /// Generate creative blog article ideas for a given topic. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> BlogIdeasAsResponseAsync( + global::Writesonic.BlogIdeasEngine engine, + global::Writesonic.BlogIdeasLanguage language, + int numCopies, + global::Writesonic.BlogIdeasRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessBlogIdeasResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/blog-ideas", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessBlogIdeasResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessBlogIdeasResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessBlogIdeasResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessBlogIdeasResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessBlogIdeasResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessBlogIdeasResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessBlogIdeasResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessBlogIdeasResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessBlogIdeasResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessBlogIdeasResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIntros.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIntros.g.cs index d656a81..f25dde1 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIntros.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogIntros.g.cs @@ -63,6 +63,38 @@ partial void ProcessBlogIntrosResponseContent( global::Writesonic.BlogIntrosLanguage language, int numCopies, + global::Writesonic.BlogIntrosRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await BlogIntrosAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// AI Article Intros
+ /// Generate compelling introductions for a blog article. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> BlogIntrosAsResponseAsync( + global::Writesonic.BlogIntrosEngine engine, + global::Writesonic.BlogIntrosLanguage language, + int numCopies, + global::Writesonic.BlogIntrosRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessBlogIntrosResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/blog-intros", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessBlogIntrosResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessBlogIntrosResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessBlogIntrosResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessBlogIntrosResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessBlogIntrosResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessBlogIntrosResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessBlogIntrosResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessBlogIntrosResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessBlogIntrosResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessBlogIntrosResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogOutlines.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogOutlines.g.cs index da69f36..c1616c4 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogOutlines.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.BlogOutlines.g.cs @@ -63,6 +63,38 @@ partial void ProcessBlogOutlinesResponseContent( global::Writesonic.BlogOutlinesLanguage language, int numCopies, + global::Writesonic.BlogOutlinesRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await BlogOutlinesAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// AI Article Outlines
+ /// Generate structured outlines for a blog article. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> BlogOutlinesAsResponseAsync( + global::Writesonic.BlogOutlinesEngine engine, + global::Writesonic.BlogOutlinesLanguage language, + int numCopies, + global::Writesonic.BlogOutlinesRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessBlogOutlinesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/blog-outlines", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessBlogOutlinesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessBlogOutlinesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessBlogOutlinesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessBlogOutlinesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessBlogOutlinesResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessBlogOutlinesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessBlogOutlinesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessBlogOutlinesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessBlogOutlinesResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessBlogOutlinesResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ChatSonic.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ChatSonic.g.cs index e1f435e..550e679 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ChatSonic.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ChatSonic.g.cs @@ -64,6 +64,39 @@ partial void ProcessChatSonicResponseContent( global::Writesonic.ChatSonicLanguage language, int numCopies, + global::Writesonic.ChatSonicRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ChatSonicAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// ChatSonic (Like ChatGPT)
+ /// Conversational AI chatbot with real-time Google search integration,
+ /// memory functionality, and support for 24 languages. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ChatSonicAsResponseAsync( + global::Writesonic.ChatSonicEngine engine, + global::Writesonic.ChatSonicLanguage language, + int numCopies, + global::Writesonic.ChatSonicRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -101,13 +134,14 @@ partial void ProcessChatSonicResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/chatsonic", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -188,6 +222,8 @@ partial void ProcessChatSonicResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -198,6 +234,11 @@ partial void ProcessChatSonicResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -215,6 +256,8 @@ partial void ProcessChatSonicResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -224,8 +267,7 @@ partial void ProcessChatSonicResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -234,6 +276,11 @@ partial void ProcessChatSonicResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -250,14 +297,15 @@ partial void ProcessChatSonicResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -297,6 +345,8 @@ partial void ProcessChatSonicResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -317,6 +367,8 @@ partial void ProcessChatSonicResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -379,9 +431,13 @@ partial void ProcessChatSonicResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Writesonic.ChatSonicResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Writesonic.ChatSonicResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -409,9 +465,13 @@ partial void ProcessChatSonicResponseContent( #endif ).ConfigureAwait(false); - return - await global::Writesonic.ChatSonicResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Writesonic.ChatSonicResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ColdEmails.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ColdEmails.g.cs index b57f65d..c6f9dd7 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ColdEmails.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ColdEmails.g.cs @@ -63,6 +63,38 @@ partial void ProcessColdEmailsResponseContent( global::Writesonic.ColdEmailsLanguage language, int numCopies, + global::Writesonic.ColdEmailsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ColdEmailsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cold Emails
+ /// Generate personalized cold email copy with sender and recipient context. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ColdEmailsAsResponseAsync( + global::Writesonic.ColdEmailsEngine engine, + global::Writesonic.ColdEmailsLanguage language, + int numCopies, + global::Writesonic.ColdEmailsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessColdEmailsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/cold-emails-v2", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessColdEmailsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessColdEmailsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessColdEmailsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessColdEmailsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessColdEmailsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessColdEmailsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessColdEmailsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessColdEmailsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessColdEmailsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessColdEmailsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentRephrase.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentRephrase.g.cs index 2698925..2459316 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentRephrase.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentRephrase.g.cs @@ -63,6 +63,38 @@ partial void ProcessContentRephraseResponseContent( global::Writesonic.ContentRephraseLanguage language, int numCopies, + global::Writesonic.ContentRephraseRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ContentRephraseAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Content Rephrase
+ /// Rephrase content while maintaining meaning, optionally with a specific tone. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ContentRephraseAsResponseAsync( + global::Writesonic.ContentRephraseEngine engine, + global::Writesonic.ContentRephraseLanguage language, + int numCopies, + global::Writesonic.ContentRephraseRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessContentRephraseResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/content-rephrase", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessContentRephraseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessContentRephraseResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessContentRephraseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessContentRephraseResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessContentRephraseResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessContentRephraseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessContentRephraseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessContentRephraseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessContentRephraseResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessContentRephraseResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentShorten.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentShorten.g.cs index 2522a75..6a0298b 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentShorten.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ContentShorten.g.cs @@ -63,6 +63,38 @@ partial void ProcessContentShortenResponseContent( global::Writesonic.ContentShortenLanguage language, int numCopies, + global::Writesonic.ContentShortenRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ContentShortenAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Content Shorten
+ /// Shorten content while preserving key information. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ContentShortenAsResponseAsync( + global::Writesonic.ContentShortenEngine engine, + global::Writesonic.ContentShortenLanguage language, + int numCopies, + global::Writesonic.ContentShortenRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessContentShortenResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/content-shorten", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessContentShortenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessContentShortenResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessContentShortenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessContentShortenResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessContentShortenResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessContentShortenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessContentShortenResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessContentShortenResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessContentShortenResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessContentShortenResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.EmailSubjectLines.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.EmailSubjectLines.g.cs index 8717ee1..951d14b 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.EmailSubjectLines.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.EmailSubjectLines.g.cs @@ -63,6 +63,38 @@ partial void ProcessEmailSubjectLinesResponseContent( global::Writesonic.EmailSubjectLinesLanguage language, int numCopies, + global::Writesonic.SubjectLinesRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await EmailSubjectLinesAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Email Subject Lines
+ /// Generate attention-grabbing email subject lines. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> EmailSubjectLinesAsResponseAsync( + global::Writesonic.EmailSubjectLinesEngine engine, + global::Writesonic.EmailSubjectLinesLanguage language, + int numCopies, + global::Writesonic.SubjectLinesRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessEmailSubjectLinesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/subject-lines", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessEmailSubjectLinesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessEmailSubjectLinesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessEmailSubjectLinesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessEmailSubjectLinesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessEmailSubjectLinesResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessEmailSubjectLinesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessEmailSubjectLinesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessEmailSubjectLinesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessEmailSubjectLinesResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessEmailSubjectLinesResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.FacebookAds.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.FacebookAds.g.cs index f81e88f..50207bd 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.FacebookAds.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.FacebookAds.g.cs @@ -63,6 +63,38 @@ partial void ProcessFacebookAdsResponseContent( global::Writesonic.FacebookAdsLanguage language, int numCopies, + global::Writesonic.FacebookAdsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await FacebookAdsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Facebook Ads
+ /// Generate compelling Facebook ad copy. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> FacebookAdsAsResponseAsync( + global::Writesonic.FacebookAdsEngine engine, + global::Writesonic.FacebookAdsLanguage language, + int numCopies, + global::Writesonic.FacebookAdsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessFacebookAdsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/facebook-ads", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessFacebookAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessFacebookAdsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessFacebookAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessFacebookAdsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessFacebookAdsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessFacebookAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessFacebookAdsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessFacebookAdsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessFacebookAdsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessFacebookAdsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GenerateImage.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GenerateImage.g.cs index c1581a6..9f76dc9 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GenerateImage.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GenerateImage.g.cs @@ -51,6 +51,29 @@ partial void ProcessGenerateImageResponseContent( /// public async global::System.Threading.Tasks.Task GenerateImageAsync( + global::Writesonic.GenerateImageRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GenerateImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate Image
+ /// Generate images from text descriptions using Photosonic AI. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GenerateImageAsResponseAsync( + global::Writesonic.GenerateImageRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessGenerateImageResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v1/business/photosonic/generate-image", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessGenerateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessGenerateImageResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessGenerateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessGenerateImageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessGenerateImageResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessGenerateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessGenerateImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessGenerateImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -355,9 +397,13 @@ partial void ProcessGenerateImageResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Writesonic.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Writesonic.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessGenerateImageResponseContent( #endif ).ConfigureAwait(false); - return - await global::Writesonic.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Writesonic.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GoogleAds.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GoogleAds.g.cs index 88c05c5..c2170aa 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GoogleAds.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.GoogleAds.g.cs @@ -63,6 +63,38 @@ partial void ProcessGoogleAdsResponseContent( global::Writesonic.GoogleAdsLanguage language, int numCopies, + global::Writesonic.GoogleAdsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GoogleAdsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Google Ads
+ /// Generate Google Ads headlines and descriptions. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> GoogleAdsAsResponseAsync( + global::Writesonic.GoogleAdsEngine engine, + global::Writesonic.GoogleAdsLanguage language, + int numCopies, + global::Writesonic.GoogleAdsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessGoogleAdsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/google-ads", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessGoogleAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessGoogleAdsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessGoogleAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessGoogleAdsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessGoogleAdsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessGoogleAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessGoogleAdsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessGoogleAdsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessGoogleAdsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessGoogleAdsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.InstagramCaptions.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.InstagramCaptions.g.cs index 730f4f1..b4baa5d 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.InstagramCaptions.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.InstagramCaptions.g.cs @@ -63,6 +63,38 @@ partial void ProcessInstagramCaptionsResponseContent( global::Writesonic.InstagramCaptionsLanguage language, int numCopies, + global::Writesonic.InstagramCaptionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await InstagramCaptionsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Instagram Captions
+ /// Generate engaging Instagram captions for posts. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> InstagramCaptionsAsResponseAsync( + global::Writesonic.InstagramCaptionsEngine engine, + global::Writesonic.InstagramCaptionsLanguage language, + int numCopies, + global::Writesonic.InstagramCaptionsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessInstagramCaptionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/instagram-captions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessInstagramCaptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessInstagramCaptionsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessInstagramCaptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessInstagramCaptionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessInstagramCaptionsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessInstagramCaptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessInstagramCaptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessInstagramCaptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessInstagramCaptionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessInstagramCaptionsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.LinkedInAds.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.LinkedInAds.g.cs index 2724927..f93c659 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.LinkedInAds.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.LinkedInAds.g.cs @@ -63,6 +63,38 @@ partial void ProcessLinkedInAdsResponseContent( global::Writesonic.LinkedInAdsLanguage language, int numCopies, + global::Writesonic.LinkedInAdsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await LinkedInAdsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// LinkedIn Ads
+ /// Generate professional LinkedIn ad copy. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> LinkedInAdsAsResponseAsync( + global::Writesonic.LinkedInAdsEngine engine, + global::Writesonic.LinkedInAdsLanguage language, + int numCopies, + global::Writesonic.LinkedInAdsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessLinkedInAdsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/linkedin-ads", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessLinkedInAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessLinkedInAdsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessLinkedInAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessLinkedInAdsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessLinkedInAdsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessLinkedInAdsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessLinkedInAdsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessLinkedInAdsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessLinkedInAdsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessLinkedInAdsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.PassiveToActiveVoice.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.PassiveToActiveVoice.g.cs index 84057ba..395e435 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.PassiveToActiveVoice.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.PassiveToActiveVoice.g.cs @@ -63,6 +63,38 @@ partial void ProcessPassiveToActiveVoiceResponseContent( global::Writesonic.PassiveToActiveVoiceLanguage language, int numCopies, + global::Writesonic.ActiveVoiceRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PassiveToActiveVoiceAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Passive to Active Voice
+ /// Convert content from passive voice to active voice for more engaging writing. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> PassiveToActiveVoiceAsResponseAsync( + global::Writesonic.PassiveToActiveVoiceEngine engine, + global::Writesonic.PassiveToActiveVoiceLanguage language, + int numCopies, + global::Writesonic.ActiveVoiceRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessPassiveToActiveVoiceResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/active-voice", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessPassiveToActiveVoiceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessPassiveToActiveVoiceResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessPassiveToActiveVoiceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessPassiveToActiveVoiceResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessPassiveToActiveVoiceResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessPassiveToActiveVoiceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessPassiveToActiveVoiceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessPassiveToActiveVoiceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessPassiveToActiveVoiceResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessPassiveToActiveVoiceResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductDescriptions.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductDescriptions.g.cs index b63d53d..3039fa3 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductDescriptions.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductDescriptions.g.cs @@ -63,6 +63,38 @@ partial void ProcessProductDescriptionsResponseContent( global::Writesonic.ProductDescriptionsLanguage language, int numCopies, + global::Writesonic.ProductDescriptionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ProductDescriptionsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Product Descriptions
+ /// Generate compelling product descriptions. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ProductDescriptionsAsResponseAsync( + global::Writesonic.ProductDescriptionsEngine engine, + global::Writesonic.ProductDescriptionsLanguage language, + int numCopies, + global::Writesonic.ProductDescriptionsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessProductDescriptionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/product-descriptions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessProductDescriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessProductDescriptionsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessProductDescriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessProductDescriptionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessProductDescriptionsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessProductDescriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessProductDescriptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessProductDescriptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessProductDescriptionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessProductDescriptionsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductNames.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductNames.g.cs index 08fa183..6f537b2 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductNames.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ProductNames.g.cs @@ -63,6 +63,38 @@ partial void ProcessProductNamesResponseContent( global::Writesonic.ProductNamesLanguage language, int numCopies, + global::Writesonic.ProductNamesRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ProductNamesAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Product Names
+ /// Generate creative product names from a description and keywords. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ProductNamesAsResponseAsync( + global::Writesonic.ProductNamesEngine engine, + global::Writesonic.ProductNamesLanguage language, + int numCopies, + global::Writesonic.ProductNamesRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessProductNamesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/product-names", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessProductNamesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessProductNamesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessProductNamesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessProductNamesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessProductNamesResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessProductNamesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessProductNamesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessProductNamesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessProductNamesResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessProductNamesResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.QuestionGeneration.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.QuestionGeneration.g.cs index 5d53dda..20fb511 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.QuestionGeneration.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.QuestionGeneration.g.cs @@ -63,6 +63,38 @@ partial void ProcessQuestionGenerationResponseContent( global::Writesonic.QuestionGenerationLanguage language, int numCopies, + global::Writesonic.QuestionsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await QuestionGenerationAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Questions
+ /// Generate engaging questions and polls that increase audience participation. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> QuestionGenerationAsResponseAsync( + global::Writesonic.QuestionGenerationEngine engine, + global::Writesonic.QuestionGenerationLanguage language, + int numCopies, + global::Writesonic.QuestionsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessQuestionGenerationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/question-generation", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessQuestionGenerationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessQuestionGenerationResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessQuestionGenerationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessQuestionGenerationResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessQuestionGenerationResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessQuestionGenerationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessQuestionGenerationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessQuestionGenerationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessQuestionGenerationResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessQuestionGenerationResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsBlogPost.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsBlogPost.g.cs index 1b2b687..e99e5e6 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsBlogPost.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsBlogPost.g.cs @@ -63,6 +63,38 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( global::Writesonic.SeoMetaTagsBlogPostLanguage language, int numCopies, + global::Writesonic.SeoMetaTagsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SeoMetaTagsBlogPostAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// SEO Meta Tags (Blog Post)
+ /// Generate SEO meta title and description for a blog post. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> SeoMetaTagsBlogPostAsResponseAsync( + global::Writesonic.SeoMetaTagsBlogPostEngine engine, + global::Writesonic.SeoMetaTagsBlogPostLanguage language, + int numCopies, + global::Writesonic.SeoMetaTagsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/meta-blog", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessSeoMetaTagsBlogPostResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsHomepage.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsHomepage.g.cs index c098b42..10e1c12 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsHomepage.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsHomepage.g.cs @@ -63,6 +63,38 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( global::Writesonic.SeoMetaTagsHomepageLanguage language, int numCopies, + global::Writesonic.SeoMetaTagsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SeoMetaTagsHomepageAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// SEO Meta Tags (Homepage)
+ /// Generate SEO meta title and description for a homepage. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> SeoMetaTagsHomepageAsResponseAsync( + global::Writesonic.SeoMetaTagsHomepageEngine engine, + global::Writesonic.SeoMetaTagsHomepageLanguage language, + int numCopies, + global::Writesonic.SeoMetaTagsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/meta-home", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessSeoMetaTagsHomepageResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsProductPage.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsProductPage.g.cs index 6285f44..804c5f0 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsProductPage.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.SeoMetaTagsProductPage.g.cs @@ -63,6 +63,38 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( global::Writesonic.SeoMetaTagsProductPageLanguage language, int numCopies, + global::Writesonic.SeoMetaTagsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SeoMetaTagsProductPageAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// SEO Meta Tags (Product Page)
+ /// Generate SEO meta title and description for a product page. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> SeoMetaTagsProductPageAsResponseAsync( + global::Writesonic.SeoMetaTagsProductPageEngine engine, + global::Writesonic.SeoMetaTagsProductPageLanguage language, + int numCopies, + global::Writesonic.SeoMetaTagsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/meta-prod", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessSeoMetaTagsProductPageResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.TikTokScripts.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.TikTokScripts.g.cs index b480d7c..95c199c 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.TikTokScripts.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.TikTokScripts.g.cs @@ -63,6 +63,38 @@ partial void ProcessTikTokScriptsResponseContent( global::Writesonic.TikTokScriptsLanguage language, int numCopies, + global::Writesonic.TikTokScriptsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await TikTokScriptsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// TikTok Video Scripts
+ /// Generate creative TikTok video scripts for a topic. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> TikTokScriptsAsResponseAsync( + global::Writesonic.TikTokScriptsEngine engine, + global::Writesonic.TikTokScriptsLanguage language, + int numCopies, + global::Writesonic.TikTokScriptsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessTikTokScriptsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/tiktok-scripts", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessTikTokScriptsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessTikTokScriptsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessTikTokScriptsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessTikTokScriptsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessTikTokScriptsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessTikTokScriptsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessTikTokScriptsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessTikTokScriptsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessTikTokScriptsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessTikTokScriptsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ToneChanger.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ToneChanger.g.cs index f144f94..7d1702f 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ToneChanger.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.ToneChanger.g.cs @@ -63,6 +63,38 @@ partial void ProcessToneChangerResponseContent( global::Writesonic.ToneChangerLanguage language, int numCopies, + global::Writesonic.ToneChangerRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ToneChangerAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Tone Changer
+ /// Change the tone of content to match a desired style (professional, casual, friendly, etc.). + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> ToneChangerAsResponseAsync( + global::Writesonic.ToneChangerEngine engine, + global::Writesonic.ToneChangerLanguage language, + int numCopies, + global::Writesonic.ToneChangerRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessToneChangerResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/tone-changer", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessToneChangerResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessToneChangerResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessToneChangerResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessToneChangerResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessToneChangerResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessToneChangerResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessToneChangerResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessToneChangerResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessToneChangerResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessToneChangerResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.Tweets.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.Tweets.g.cs index ebc1187..d3280b4 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.Tweets.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.Tweets.g.cs @@ -63,6 +63,38 @@ partial void ProcessTweetsResponseContent( global::Writesonic.TweetsLanguage language, int numCopies, + global::Writesonic.TweetsRequest request, + global::Writesonic.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await TweetsAsResponseAsync( + engine: engine, + language: language, + numCopies: numCopies, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Tweets
+ /// Generate engaging tweets for a topic. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task>> TweetsAsResponseAsync( + global::Writesonic.TweetsEngine engine, + global::Writesonic.TweetsLanguage language, + int numCopies, + global::Writesonic.TweetsRequest request, global::Writesonic.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -100,13 +132,14 @@ partial void ProcessTweetsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Writesonic.PathBuilder( path: "/v2/business/content/tweets", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("engine", engine.ToValueString()) .AddRequiredParameter("language", language.ToValueString()) - .AddRequiredParameter("num_copies", numCopies.ToString()!) + .AddRequiredParameter("num_copies", numCopies.ToString()!) ; var __path = __pathBuilder.ToString(); __path = global::Writesonic.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -187,6 +220,8 @@ partial void ProcessTweetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -197,6 +232,11 @@ partial void ProcessTweetsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -214,6 +254,8 @@ partial void ProcessTweetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -223,8 +265,7 @@ partial void ProcessTweetsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -233,6 +274,11 @@ partial void ProcessTweetsResponseContent( __attempt < __maxAttempts && global::Writesonic.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Writesonic.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Writesonic.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Writesonic.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -249,14 +295,15 @@ partial void ProcessTweetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Writesonic.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -296,6 +343,8 @@ partial void ProcessTweetsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -316,6 +365,8 @@ partial void ProcessTweetsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error. @@ -378,9 +429,13 @@ partial void ProcessTweetsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -408,9 +463,13 @@ partial void ProcessTweetsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Writesonic.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::Writesonic.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.g.cs b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.g.cs index 93bb750..3216bf6 100644 --- a/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.g.cs +++ b/src/libs/Writesonic/Generated/Writesonic.WritesonicClient.g.cs @@ -75,10 +75,10 @@ public WritesonicClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public WritesonicClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Writesonic.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Writesonic.AutoSDKClientOptions? options, bool disposeHttpClient = true) {