Пример #1
0
        public async Task <Response <CreateChatThreadResultInternal> > CreateChatThreadAsync(string topic, string repeatabilityRequestId = null, IEnumerable <ChatParticipantInternal> participants = null, CancellationToken cancellationToken = default)
        {
            if (topic == null)
            {
                throw new ArgumentNullException(nameof(topic));
            }

            using var message = CreateCreateChatThreadRequest(topic, repeatabilityRequestId, participants);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 201:
            {
                CreateChatThreadResultInternal value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = CreateChatThreadResultInternal.DeserializeCreateChatThreadResultInternal(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
 /// <summary> Initializes a new instance of CreateChatThreadResult. </summary>
 /// <param name="createChatThreadResultInternal"> Chat thread. </param>
 internal CreateChatThreadResult(CreateChatThreadResultInternal createChatThreadResultInternal)
 {
     ChatThread = new ChatThread(createChatThreadResultInternal.ChatThread);
     Errors     = createChatThreadResultInternal.Errors;
 }
 /// <summary> Initializes a new instance of CreateChatThreadResult. </summary>
 /// <param name="createChatThreadResultInternal"> Chat thread. </param>
 internal CreateChatThreadResult(CreateChatThreadResultInternal createChatThreadResultInternal)
 {
     ChatThread          = new ChatThreadProperties(createChatThreadResultInternal.ChatThread);
     InvalidParticipants = createChatThreadResultInternal.InvalidParticipants;
 }