public static Queue GetQueue(UserInfo userInfo, string filter, int count = 0) { var apiInstance = new QueuesApi(userInfo.ServerUrl); apiInstance.Configuration.AccessToken = userInfo.Token; try { var queue = apiInstance.ApiVapiVersionQueuesGetAsyncWithHttpInfo(userInfo.ApiVersion, userInfo.OrganizationId, filter).Result.Data.Items.FirstOrDefault(); return(queue); } catch (Exception ex) { if (ex.GetType().GetProperty("ErrorCode").GetValue(ex, null).ToString() == "401" && count < 2) { UtilityMethods.RefreshToken(userInfo); count++; return(GetQueue(userInfo, filter, count)); } else if (ex.Message != "One or more errors occurred.") { throw new InvalidOperationException("Exception when calling QueuesApi.GetQueues: " + ex.Message); } else { throw new InvalidOperationException(ex.InnerException.Message); } } }
public static Queue GetQueue(string token, string serverUrl, string organizationId, string filter, string apiVersion) { var apiInstance = new QueuesApi(serverUrl); apiInstance.Configuration.AccessToken = token; try { var queue = apiInstance.ApiVapiVersionQueuesGetAsyncWithHttpInfo(apiVersion, organizationId, filter).Result.Data.Items.FirstOrDefault(); return(queue); } catch (Exception ex) { if (ex.Message != "One or more errors occurred.") { throw new InvalidOperationException("Exception when calling QueuesApi.GetQueues: " + ex.Message); } else { throw new InvalidOperationException(ex.InnerException.Message); } } }
public QueuesApiTests() { instance = new QueuesApi(); }
public void Init() { instance = new QueuesApi(); }