<commit_before>﻿using Atlassian.Stash.Entities;
using Atlassian.Stash.Helpers;
using Atlassian.Stash.Workers;
using System.Threading.Tasks;

namespace Atlassian.Stash.Api
{
    public class Users
    {
        private const string ADMIN_USERS = "/rest/api/1.0/admin/users";
        private const string GET_USERS = ADMIN_USERS + "?filter={0}";
        private const string CREATE_USER_SILENT = ADMIN_USERS + "?name={0}&displayName={1}&emailAddress={2}&addToDefaultGroup=false&notify=false&password={3}";
        //private const string CREATE_USER_NOTIFY = ADMIN_USERS + "?name={0}&displayName={1}&emailAddress={2}&addToDefaultGroup=false&notify=true";
        private const string DELETE_USER = ADMIN_USERS + "?name={0}";

        private HttpCommunicationWorker _httpWorker;

        internal Users(HttpCommunicationWorker httpWorker)
        {
            _httpWorker = httpWorker;
        }

        
        public async Task<ResponseWrapper<User>> Get(string filter, RequestOptions requestOptions = null)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(GET_USERS, requestOptions, filter);

            ResponseWrapper<User> response = await _httpWorker.GetAsync<ResponseWrapper<User>>(requestUrl).ConfigureAwait(false);

            return response;
        }

        public async Task Create(string name, string displayName, string emailAddress, string password)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(CREATE_USER_SILENT, null, name, displayName, emailAddress, password);

            await _httpWorker.PostAsync<string>(requestUrl, null).ConfigureAwait(false);
        }<commit_msg>The leading slash on the user path causes issues with bitbucket is running from a sub directory<commit_after>﻿using Atlassian.Stash.Entities;
using Atlassian.Stash.Helpers;
using Atlassian.Stash.Workers;
using System.Threading.Tasks;

namespace Atlassian.Stash.Api
{
    public class Users
    {
        private const string ADMIN_USERS = "rest/api/1.0/admin/users";
        private const string GET_USERS = ADMIN_USERS + "?filter={0}";
        private const string CREATE_USER_SILENT = ADMIN_USERS + "?name={0}&displayName={1}&emailAddress={2}&addToDefaultGroup=false&notify=false&password={3}";
        //private const string CREATE_USER_NOTIFY = ADMIN_USERS + "?name={0}&displayName={1}&emailAddress={2}&addToDefaultGroup=false&notify=true";
        private const string DELETE_USER = ADMIN_USERS + "?name={0}";

        private HttpCommunicationWorker _httpWorker;

        internal Users(HttpCommunicationWorker httpWorker)
        {
            _httpWorker = httpWorker;
        }

        
        public async Task<ResponseWrapper<User>> Get(string filter, RequestOptions requestOptions = null)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(GET_USERS, requestOptions, filter);

            ResponseWrapper<User> response = await _httpWorker.GetAsync<ResponseWrapper<User>>(requestUrl).ConfigureAwait(false);

            return response;
        }

        public async Task Create(string name, string displayName, string emailAddress, string password)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(CREATE_USER_SILENT, null, name, displayName, emailAddress, password);

            await _httpWorker.PostAsync<string>(requestUrl, null).ConfigureAwait(false);
        }
{'fraction_non_alphanumeric': 0.09593109593109593, 'fraction_numerical': 0.006534006534006534, 'mean_word_length': 3.664819944598338, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6253197', 'n_tokens_mistral': 967, 'n_tokens_neox': 940, 'n_words': 198}