コード例 #1
0
 /// <summary>Initializes a new instance of <see cref="ChatClient"/> for mocking.</summary>
 protected ChatClient()
 {
     _clientDiagnostics           = null !;
     _chatRestClient              = null !;
     _endpointUrl                 = null !;
     _communicationUserCredential = null !;
     _chatClientOptions           = null !;
 }
コード例 #2
0
        /// <summary> Initializes a new instance of <see cref="ChatThreadClient"/>.</summary>
        /// <param name="threadId"></param>
        /// <param name="endpointUrl">The uri for the Azure Communication Services Chat.</param>
        /// <param name="communicationTokenCredential">Instance of <see cref="CommunicationTokenCredential"/>.</param>
        /// <param name="options">Chat client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception>
        internal ChatThreadClient(string threadId, Uri endpointUrl, CommunicationTokenCredential communicationTokenCredential, ChatClientOptions?options = default)
        {
            Argument.AssertNotNull(threadId, nameof(threadId));
            Argument.AssertNotNull(communicationTokenCredential, nameof(communicationTokenCredential));
            Argument.AssertNotNull(endpointUrl, nameof(endpointUrl));
            options ??= new ChatClientOptions();
            Id = threadId;
            _clientDiagnostics = new ClientDiagnostics(options);
            HttpPipeline pipeline = CreatePipelineFromOptions(options, communicationTokenCredential);

            _chatRestClient = new ChatRestClient(_clientDiagnostics, pipeline, endpointUrl.AbsoluteUri, options.ApiVersion);
        }
コード例 #3
0
        /// <summary> Initializes a new instance of <see cref="ChatClient"/>.</summary>
        /// <param name="endpointUrl">The uri for the Azure Communication Services Chat.</param>
        /// <param name="communicationUserCredential">Instance of <see cref="CommunicationUserCredential"/>.</param>
        /// <param name="options">Chat client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
        public ChatClient(Uri endpointUrl, CommunicationUserCredential communicationUserCredential, ChatClientOptions?options = default)
        {
            Argument.AssertNotNull(communicationUserCredential, nameof(communicationUserCredential));
            Argument.AssertNotNull(endpointUrl, nameof(endpointUrl));
            _chatClientOptions           = options ?? new ChatClientOptions();
            _communicationUserCredential = communicationUserCredential;
            _endpointUrl       = endpointUrl;
            _clientDiagnostics = new ClientDiagnostics(_chatClientOptions);
            HttpPipeline pipeline = CreatePipelineFromOptions(_chatClientOptions, communicationUserCredential);

            _chatRestClient = new ChatRestClient(_clientDiagnostics, pipeline, endpointUrl.AbsoluteUri, _chatClientOptions.ApiVersion);
        }
コード例 #4
0
 /// <summary>Initializes a new instance of <see cref="ChatThreadClient"/> for mocking.</summary>
 protected ChatThreadClient()
 {
     _clientDiagnostics = null !;
     _chatRestClient    = null !;
     Id = null !;
 }