Exemplo n.º 1
0
        public async Task CreatePersonalUrl()
        {
            Printer.PrintStepTitle("Creates Purl");
            Console.Write("Enter Approval ID:");
            string id = Console.ReadLine();

            if (id == "-1")
            {
                return;
            }

            Console.Write("Enter Approval Version:");
            string versionInput = Console.ReadLine();

            int.TryParse(versionInput, out int version);

            Console.Write("Enter User ID:");
            string userId = Console.ReadLine();


            var parameters = new PersonalUrlCreateParameters
            {
                ApprovalId = id,
                Version    = version,
                UserId     = userId
            };

            Console.WriteLine("Creating PURL...");
            var purl = await _apiClient.Approvals.CreatePersonalUrl(parameters);

            Console.WriteLine($"Successfully created URL: {purl.Url}");
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public async Task <PersonalUrlCreateResult> CreatePersonalUrl(PersonalUrlCreateParameters parameters)
        {
            var response = await ApiClient.PostAsJsonAsync("Approvals/CreatePersonalUrl/", parameters);

            if (response.IsSuccessStatusCode)
            {
                return(await response.Content.ReadAsJsonAsync <PersonalUrlCreateResult>());
            }

            throw new ApiException("Approvals.GetPersonalUrl", response.StatusCode, await response.Content.ReadAsStringAsync());
        }
Exemplo n.º 3
0
        public static async Task CreatePersonalUrl()
        {
            Printer.PrintStepTitle("Creates Purl");

            var parameters = new PersonalUrlCreateParameters
            {
                ApprovalId = TestContainer.Approval.Id,
                Version    = TestContainer.Approval.Versions.FirstOrDefault().Version,
                UserId     = TestContainer.User.Id
            };

            Printer.Print("Creating PURL...");
            var purl = await ApiClient.Approvals.CreatePersonalUrl(parameters);

            Printer.Print($"Successfully created URL: {purl.Url}");
        }