using Microsoft.TypeSpec.Generator.Customizations; using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; namespace OpenAI.Containers; [CodeGenType("Containers")] [CodeGenSuppress("ContainerClient", typeof(ClientPipeline), typeof(Uri))] public partial class ContainerClient { // CUSTOM: Added as a convenience. /// Initializes a new instance of . /// The API key to authenticate with the service. /// is null. public ContainerClient(string apiKey) : this(new ApiKeyCredential(apiKey), new OpenAIClientOptions()) { } // CUSTOM: // - Used a custom pipeline. // - Demoted the endpoint parameter to be a property in the options class. /// Initializes a new instance of . /// The to authenticate with the service. /// is null. public ContainerClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions()) { } // CUSTOM: // - Used a custom pipeline. // - Demoted the endpoint parameter to be a property in the options class. /// Initializes a new instance of . /// The to authenticate with the service. /// The options to configure the client. /// is null. public ContainerClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options) { } // CUSTOM: Added as a convenience. /// Initializes a new instance of . /// The authentication policy used to authenticate with the service. /// is null. public ContainerClient(AuthenticationPolicy authenticationPolicy) : this(authenticationPolicy, new OpenAIClientOptions()) { } // CUSTOM: Added as a convenience. /// Initializes a new instance of . /// The authentication policy used to authenticate with the service. /// The options to configure the client. /// is null. public ContainerClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOptions options) { Argument.AssertNotNull(authenticationPolicy, nameof(authenticationPolicy)); options ??= new OpenAIClientOptions(); Pipeline = OpenAIClient.CreatePipeline(authenticationPolicy, options); _endpoint = OpenAIClient.GetEndpoint(options); } // CUSTOM: // - Used a custom pipeline. // - Demoted the endpoint parameter to be a property in the options class. // - Made protected. /// Initializes a new instance of . /// The HTTP pipeline to send and receive REST requests and responses. /// The options to configure the client. /// is null. protected internal ContainerClient(ClientPipeline pipeline, OpenAIClientOptions options) { Argument.AssertNotNull(pipeline, nameof(pipeline)); options ??= new OpenAIClientOptions(); Pipeline = pipeline; _endpoint = OpenAIClient.GetEndpoint(options); } [Experimental("SCME0002")] public ContainerClient(ContainerClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Options) { } /// /// Gets the endpoint URI for the service. /// [Experimental("OPENAI001")] public Uri Endpoint => _endpoint; }