public Task <string> DeleteUserProfileAsync(int userId, int profileId, CancellationToken token = default) { userId.EnsureGreaterThenZero(); profileId.EnsureGreaterThenZero(); return(Task.Run(async() => { GraphQLResponse response; using (var client = GraphQLClientFactory.Create(_configurationService.GraphQLEndPointAddress, (QUERY_NAMES_HEADER, QueryNames.UserProfile))) { response = await RetryHelper.Instance.Try(async() => await client.PostAsync ( GraphQLRequestFactory.Create(Properties.Settings.Default.DeleteProfileQueryString, (QueryVariableNames.UserId, userId), (QueryVariableNames.ProfileId, profileId)), token )) .WithTryInterval(_configurationService.TryIntervalTime) .WithMaxTryCount(_configurationService.MaxTryCountLimit) .WithTimeLimit(_configurationService.MaxTryTimeLimit) .Until(res => !HasErrors(res)) .ConfigureAwait(false); } return response?.Data?.ToString() as string; }, token)); }
public GraphQLService(IOptions <GraphQLServiceOptions> options) { options.EnsureNotNull(); _client = GraphQLClientFactory.Create(options.Value); }