diff --git a/README.md b/README.md index b333cb9..a78e05f 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,7 @@ ```csharp using Leonardo; -using var api = new LeonardoApi(); -api.AuthorizeUsingBearer(apiKey); +using var api = new LeonardoApi(apiKey); var createResponse = await api.Image.CreateGenerationAsync( prompt: "Generate cat"); diff --git a/src/libs/Leonardo/Generated/Leonardo.LeonardoApi.Constructors.Bearer.g.cs b/src/libs/Leonardo/Generated/Leonardo.LeonardoApi.Constructors.Bearer.g.cs new file mode 100644 index 0000000..16c0c90 --- /dev/null +++ b/src/libs/Leonardo/Generated/Leonardo.LeonardoApi.Constructors.Bearer.g.cs @@ -0,0 +1,17 @@ + +#nullable enable + +namespace Leonardo +{ + public sealed partial class LeonardoApi + { + /// + public LeonardoApi( + string apiKey, + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null) : this(httpClient, baseUri) + { + AuthorizeUsingBearer(apiKey); + } + } +} \ No newline at end of file diff --git a/src/libs/Leonardo/generate.sh b/src/libs/Leonardo/generate.sh index 5405539..67d1267 100755 --- a/src/libs/Leonardo/generate.sh +++ b/src/libs/Leonardo/generate.sh @@ -10,4 +10,5 @@ oag generate openapi.yaml \ --namespace Leonardo \ --clientClassName LeonardoApi \ --targetFramework net8.0 \ - --output Generated \ No newline at end of file + --output Generated \ + --exclude-deprecated-operations \ No newline at end of file diff --git a/src/tests/Leonardo.IntegrationTests/Tests.cs b/src/tests/Leonardo.IntegrationTests/Tests.cs index 4d20f77..69b201c 100755 --- a/src/tests/Leonardo.IntegrationTests/Tests.cs +++ b/src/tests/Leonardo.IntegrationTests/Tests.cs @@ -9,8 +9,7 @@ public static LeonardoApi GetAuthorizedApi() Environment.GetEnvironmentVariable("LEONARDO_API_KEY") ?? throw new AssertInconclusiveException("LEONARDO_API_KEY environment variable is not found."); - var api = new LeonardoApi(); - api.AuthorizeUsingBearer(apiKey); + var api = new LeonardoApi(apiKey); return api; }