<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParatureSDK.ParaObjects;
using ApiHandler = ParatureSDK.ApiHandler;
using Action = ParatureSDK.ParaObjects.Action;

namespace Exercises
{
    class Exercise11TicketActions
    {
        /// <summary>
        /// The actions that can be performed on a ticket depend on the current State.
        /// Retrieve the ticket to get a list of Actions available. This ensures no invalid transition is requested.
        /// </summary>
        /// <param name="ticketId">Id of the ticket to get available actions for</param>
        /// <returns></returns>
        public static List<Action> GetAvailableTicketActions(long ticketId)
        {
            var ticketResponse = ApiHandler.Ticket.GetDetails(ticketId, CredentialProvider.Creds, false);
            
            return ticketResponse.Actions;
        }

        /// <summary>
        /// Run an action on a ticket.
        /// </summary>
        /// <param name="ticketId">Id of the ticket</param>
        /// <param name="action">Action object, which should be one of the Actions retrieved in GetAvailableTicketActions.</param>
        /// <returns></returns>
        public static ApiCallResponse RunAction(long ticketId, Action action)
        {
            var actionResponse = ApiHandler.Ticket.ActionRun(ticketId, action, CredentialProvider.Creds);
            return actionResponse;
        }
    }
}<commit_msg>Updating the ticket action exercise class<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParatureSDK.ParaObjects;
using ApiHandler = ParatureSDK.ApiHandler;
using Action = ParatureSDK.ParaObjects.Action;

namespace Exercises
{
    class Exercise11TicketActions
    {
        /// <summary>
        /// The actions that can be performed on a ticket depend on the current State.
        /// Retrieve the ticket to get a list of Actions available. This ensures no invalid transition is requested.
        /// </summary>
        /// <param name="ticketId">Id of the ticket to get available actions for</param>
        /// <returns></returns>
        public static List<Action> GetAvailableTicketActions(long ticketId)
        {
            var ticketResponse = ApiHandler.Ticket.GetDetails(ticketId, CredentialProvider.Creds, false);
            
            return ticketResponse.Actions;
        }

        /// <summary>
        /// Run an action on a ticket.
        /// If you need to add an attachment, run the AttachmentToAction method first!
        /// </summary>
        /// <param name="ticketId">Id of the ticket</param>
        /// <param name="action">Action object, which should be one of the Actions retrieved in GetAvailableTicketActions.</param>
        /// <returns></returns>
        public static ApiCallResponse RunAction(long ticketId, Action action)
        {
            var actionResponse = ApiHandler.Ticket.ActionRun(ticketId, action, CredentialProvider.Creds);
            return actionResponse;
        }

        /// <summary>
        /// Before running an action, attachments need to be uploaded to the server and a GUID retrieved
        /// This requires an API call first, and must occur before the action is run
        /// The GUID returned is temporary, and will expire after a while
        /// </summary>
        /// <param name="action"></param>
        public static void AddAttachmentToAction(Action action)
        {
            action.AddAttachment(CredentialProvider.Creds, "Contents of the file", "text/plain", "attachment1.txt");
        }
    }
}
{'fraction_non_alphanumeric': 0.09509371554575524, 'fraction_numerical': 0.0013781697905181918, 'mean_word_length': 2.4627862595419847, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '7642303', 'n_tokens_mistral': 926, 'n_tokens_neox': 897, 'n_words': 308}