<commit_before>﻿using System.Threading;
using System.Threading.Tasks;

namespace Vault.Endpoints
{
    public class SecretEndpoint : ISecretEndpoint
    {
        private readonly VaultClient _client;
        private const string UriBasePath = "/v1";
        private const string WrappedResponseLocation = "cubbyhole/response";

        public SecretEndpoint(VaultClient client)
        {
            _client = client;
        }

        public Task<Secret<TData>> Read<TData>(string path)
        {
            return Read<TData>(path, CancellationToken.None);
        }

        public Task<Secret<TData>> Read<TData>(string path, CancellationToken ct)
        {
            return _client.Get<Secret<TData>>($"{UriBasePath}/{path}", ct);
        }

        private Task<Secret<TData>> Read<TData>(string path, string token, CancellationToken ct)
        {
            return _client.Get<Secret<TData>>($"{UriBasePath}/{path}", token, ct);
        }

        public Task<Secret<TData>> List<TData>(string path)
        {
            return List<TData>(path, CancellationToken.None);
        }

        public Task<Secret<TData>> List<TData>(string path, CancellationToken ct)
        {
            return _client.List<Secret<TData>>($"{UriBasePath}/{path}", ct);
        }

        public Task Write<TParameters>(string path, TParameters parameters)
        {
            return Write(path, parameters, CancellationToken.None);
        }

        public Task Write<TParameters>(string path, TParameters parameters, CancellationToken ct)<commit_msg>TParameters -> TData<commit_after>﻿using System.Threading;
using System.Threading.Tasks;

namespace Vault.Endpoints
{
    public class SecretEndpoint : ISecretEndpoint
    {
        private readonly VaultClient _client;
        private const string UriBasePath = "/v1";
        private const string WrappedResponseLocation = "cubbyhole/response";

        public SecretEndpoint(VaultClient client)
        {
            _client = client;
        }

        public Task<Secret<TData>> Read<TData>(string path)
        {
            return Read<TData>(path, CancellationToken.None);
        }

        public Task<Secret<TData>> Read<TData>(string path, CancellationToken ct)
        {
            return _client.Get<Secret<TData>>($"{UriBasePath}/{path}", ct);
        }

        private Task<Secret<TData>> Read<TData>(string path, string token, CancellationToken ct)
        {
            return _client.Get<Secret<TData>>($"{UriBasePath}/{path}", token, ct);
        }

        public Task<Secret<TData>> List<TData>(string path)
        {
            return List<TData>(path, CancellationToken.None);
        }

        public Task<Secret<TData>> List<TData>(string path, CancellationToken ct)
        {
            return _client.List<Secret<TData>>($"{UriBasePath}/{path}", ct);
        }

        public Task Write<TData>(string path, TData parameters)
        {
            return Write(path, parameters, CancellationToken.None);
        }

        public Task Write<TData>(string path, TData parameters, CancellationToken ct)
{'fraction_non_alphanumeric': 0.11028219266947778, 'fraction_numerical': 0.0006487187804086928, 'mean_word_length': 2.602803738317757, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6597508', 'n_tokens_mistral': 855, 'n_tokens_neox': 851, 'n_words': 182}