Пример #1
0
        /// <inheritdoc/>
        public async Task <string> GetChatThreadIdAsync(string userId, string appId)
        {
            if (string.IsNullOrWhiteSpace(userId))
            {
                throw new ArgumentNullException(nameof(userId));
            }

            if (string.IsNullOrWhiteSpace(appId))
            {
                throw new ArgumentNullException(nameof(appId));
            }

            var installationId = await this.appManagerService.GetAppInstallationIdForUserAsync(appId, userId);

            var retryPolicy = PollyPolicy.GetGraphRetryPolicy(GraphConstants.MaxRetry);
            var chat        = await retryPolicy.ExecuteAsync(async() => await this.graphServiceClient.Users[userId]
                                                             .Teamwork
                                                             .InstalledApps[installationId]
                                                             .Chat
                                                             .Request()
                                                             .WithMaxRetry(GraphConstants.MaxRetry)
                                                             .GetAsync());

            return(chat?.Id);
        }