Exemplo n.º 1
0
        private static AutomationsApi GetApiInstance(string token, string serverUrl)
        {
            var apiInstance = new AutomationsApi(serverUrl);

            apiInstance.Configuration.AccessToken = token;

            return(apiInstance);
        }
Exemplo n.º 2
0
        public static ApiResponse <AutomationPaginatedList> GetAutomations(AuthAPIManager apiManager, string filter = null)
        {
            AutomationsApi automationsApi = new AutomationsApi(apiManager.Configuration);

            try
            {
                return(automationsApi.ApiV1AutomationsGetWithHttpInfo(filter));
            }
            catch (Exception ex)
            {
                // In case of Unauthorized request
                if (ex.GetType().GetProperty("ErrorCode").GetValue(ex, null).ToString() == "401")
                {
                    // Refresh Token and Call API
                    automationsApi.Configuration.AccessToken = apiManager.GetToken();
                    return(automationsApi.ApiV1AutomationsGetWithHttpInfo(filter));
                }
                throw ex;
            }
        }
Exemplo n.º 3
0
        public static Automation GetAutomation(AuthAPIManager apiManager, string automationID)
        {
            AutomationsApi automationsApi = new AutomationsApi(apiManager.Configuration);

            try
            {
                return(automationsApi.GetAutomationWithHttpInfo(automationID).Data);
            }
            catch (Exception ex)
            {
                // In case of Unauthorized request
                if (ex.GetType().GetProperty("ErrorCode").GetValue(ex, null).ToString() == "401")
                {
                    // Refresh Token and Call API
                    automationsApi.Configuration.AccessToken = apiManager.GetToken();
                    return(automationsApi.GetAutomationWithHttpInfo(automationID).Data);
                }
                throw ex;
            }
        }
Exemplo n.º 4
0
 public void Init()
 {
     instance = new AutomationsApi();
 }