Example #1
0
 public CallRecords(CallTypes callType, int number, DateTime date, DateTime time, int price)
 {
     CallType = callType;
     Number   = number;
     Date     = date;
     Time     = time;
     Price    = price;
 }
Example #2
0
        public DefaultOverloadResolver(ActionBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
            : base(binder) {
            ContractUtils.RequiresNotNullItems(args, "args");

            Debug.Assert((callType == CallTypes.ImplicitInstance ? 1 : 0) + signature.ArgumentCount == args.Count);
            _args = args;
            _signature = signature;
            _callType = callType;
        }
        public DefaultOverloadResolver(ActionBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
            : base(binder) {
            ContractUtils.RequiresNotNullItems(args, "args");

            Debug.Assert((callType == CallTypes.ImplicitInstance ? 1 : 0) + signature.ArgumentCount == args.Count);
            _args = args;
            _signature = signature;
            _callType = callType;
        }
Example #4
0
        public double GetCostOfMinute(CallTypes callType)
        {
            switch (callType)
            {
            case CallTypes.Incoming: return(MinuteCostOfIncomingCall);

            case CallTypes.Outgoing: return(MinuteCostOfOutgoingCall);

            default: return(0);
            }
        }
Example #5
0
        private void MakeMethodBaseRule(MethodBase[] targets)
        {
            Type[]     argTypes; // will not include implicit instance argument (if any)
            SymbolId[] argNames; // will include ArgumentKind.Dictionary keyword names


            GetArgumentNamesAndTypes(out argNames, out argTypes);

            Type[]    bindingArgs = argTypes; // will include instance argument (if any)
            CallTypes callType    = CallTypes.None;

            if (_instance != null)
            {
                bindingArgs = ArrayUtils.Insert(InstanceType, argTypes);
                callType    = CallTypes.ImplicitInstance;
            }

            if (_reversedOperator && bindingArgs.Length >= 2)
            {
                // we swap the arguments before binding, and swap back before calling.
                ArrayUtils.SwapLastTwo(bindingArgs);
                if (argNames.Length >= 2)
                {
                    ArrayUtils.SwapLastTwo(argNames);
                }
            }

            // attempt to bind to an individual method
            MethodBinder  binder = MethodBinder.MakeBinder(Binder, GetTargetName(targets), targets, argNames, NarrowingLevel.None, _maxLevel);
            BindingTarget bt     = binder.MakeBindingTarget(callType, bindingArgs);

            if (bt.Success)
            {
                // if we succeed make the target for the rule
                MethodBase target       = bt.Method;
                MethodInfo targetMethod = target as MethodInfo;

                if (targetMethod != null)
                {
                    target = CompilerHelpers.GetCallableMethod(targetMethod, Binder.PrivateBinding);
                }

                Expression[] exprargs = FinishTestForCandidate(bt.ArgumentTests, argTypes);

                _rule.Target = _rule.MakeReturn(
                    Binder,
                    bt.MakeExpression(_rule, exprargs));
            }
            else
            {
                // make an error rule
                MakeInvalidParametersRule(bt);
            }
        }
Example #6
0
        /// <summary>
        /// Pulls out the right argument to build the splat test.  MakeParamsTest makes the actual test.
        /// </summary>
        private static BindingRestrictions MakeParamsArrayTest(CallTypes callType, CallSignature signature, bool testTypes, IList <DynamicMetaObject> args)
        {
            int listIndex = signature.IndexOf(ArgumentType.List);

            Debug.Assert(listIndex != -1);
            if (callType == CallTypes.ImplicitInstance)
            {
                listIndex++;
            }

            return(MakeParamsTest(args[listIndex], testTypes));
        }
Example #7
0
        private static async Task <T> RequestAsync <T>(
            string relativeUrl,
            CallTypes callType = CallTypes.Data,
            Dictionary <string, object> queryParams = null,
            Dictionary <string, string> headers     = null,
            CancellationToken token = default(CancellationToken))
        {
            using (var client = new HttpClient())
            {
                client.Timeout.Add(new TimeSpan(0, 0, 0, 0, MaxHTTPRequestTimeout));
                client.BaseAddress = new Uri(Settings.Default.BaseUrl);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.UserAgent.Clear();
                client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent(callType));
                client.DefaultRequestHeaders.Add("Request-Platform", Utilities.ExcelVersionNumber);
                client.DefaultRequestHeaders.Add("Request-Version", Utilities.ReleaseVersion);
                client.DefaultRequestHeaders.Add("Request-Source", Utilities.ReleaseSource);

                if (!string.IsNullOrEmpty(QuandlConfig.ApiKey) &&
                    (headers == null || !headers.ContainsKey("X-API-Token")))
                {
                    client.DefaultRequestHeaders.Add("X-API-Token", QuandlConfig.ApiKey);
                }

                if (headers != null)
                {
                    foreach (var h in headers)
                    {
                        client.DefaultRequestHeaders.Add(h.Key, h.Value);
                    }
                }

                if (queryParams != null)
                {
                    relativeUrl = relativeUrl + "?" + StringifyQueryParams(queryParams);
                }

                // Attempt to fetch the data.
                var resp = await RetrieveResponseWithRetries(client, relativeUrl, token);

                var data = await resp.Content.ReadAsStringAsync();

                if (resp.StatusCode != HttpStatusCode.OK)
                {
                    var error = JsonConvert.DeserializeObject <QuandlError>(data, JsonSettings());
                    throw new QuandlErrorBase(resp.StatusCode, error.Code, error.Message);
                }

                return(JsonConvert.DeserializeObject <T>(data, JsonSettings()));
            }
        }
        /// <summary>
        /// Sets the requests end point URL based on the call type
        /// </summary>
        /// <param name="request">The request to which the URL will be assigned</param>
        /// <param name="callType">The type of call to be made</param>
        private static void SetRequestBaseUrl(HttpsClientRequest request, CallTypes callType)
        {
            switch (callType)
            {
            case CallTypes.NewAuthorization:
            case CallTypes.RefreshAuthorization:
                request.Url.Parse(Constants.URL_AUTHORIZATION);
                break;

            default:
                request.Url.Parse(Constants.URL_BASE);
                break;
            }
        }
Example #9
0
        private static MetaObject MakeInvalidParametersRule(CallTypes callType, CallSignature signature, DefaultBinder binder, IList <MetaObject> args, Restrictions restrictions, BindingTarget bt)
        {
            Restrictions restriction = MakeSplatTests(callType, signature, true, args);

            // restrict to the exact type of all parameters for errors
            for (int i = 0; i < args.Count; i++)
            {
                args[i] = args[i].Restrict(args[i].LimitType);
            }

            return(MakeError(
                       binder.MakeInvalidParametersError(bt),
                       restrictions.Merge(Restrictions.Combine(args).Merge(restriction))
                       ));
        }
Example #10
0
 private void InitialiseSetter()
 {
     setterMethod = propertyInfo.GetSetMethod() ?? propertyInfo.GetSetMethod(true);
     try
     {
         fastSetter          = FastMethodReflection.VoidCaller1Param(setterMethod);
         preferredSetterCall = fastSetter != null
                                       ? CallTypes.ViaDelegate
                                       : CallTypes.ReflectedMethod;
     }
     catch (Exception)
     {
         preferredSetterCall = CallTypes.ReflectedMethod;
     }
 }
Example #11
0
 private void InitialiseGetter()
 {
     getterMethod = propertyInfo.GetGetMethod() ?? propertyInfo.GetGetMethod(true);
     try
     {
         fastGetter          = FastMethodReflection.FuncCaller0Params(getterMethod);
         preferredGetterCall = fastGetter != null
                                       ? CallTypes.ViaDelegate
                                       : CallTypes.ReflectedMethod;
     }
     catch (Exception)
     {
         preferredGetterCall = CallTypes.ReflectedMethod;
     }
 }
Example #12
0
        /// <summary>
        /// Makes test for param arrays and param dictionary parameters.
        /// </summary>
        private static BindingRestrictions MakeSplatTests(CallTypes callType, CallSignature signature, bool testTypes, IList <DynamicMetaObject> args)
        {
            BindingRestrictions res = BindingRestrictions.Empty;

            if (signature.HasListArgument())
            {
                res = MakeParamsArrayTest(callType, signature, testTypes, args);
            }

            if (signature.HasDictionaryArgument())
            {
                res = res.Merge(MakeParamsDictionaryTest(args, testTypes));
            }

            return(res);
        }
Example #13
0
        public string GetSignatureString(CallTypes callType) {
            StringBuilder buf = new StringBuilder();
            Type[] types = GetParameterTypes();
            if (callType == CallTypes.ImplicitInstance) {
                types = ArrayUtils.RemoveFirst(types);
            }

            string comma = "";
            buf.Append("(");
            foreach (Type t in types) {
                buf.Append(comma);
                buf.Append(t.Name);
                comma = ", ";
            }
            buf.Append(")");
            return buf.ToString();
        }
Example #14
0
        private List <XElement> CreateCallTypeElms(CallTypes callTypes)
        {
            List <XElement> xml = new List <XElement>();

            if ((callTypes & CallTypes.AbandonedCalls) == CallTypes.AbandonedCalls)
            {
                xml.Add(new XElement("call_type", "abandoned_calls"));
            }
            if ((callTypes & CallTypes.CompletedCalls) == CallTypes.CompletedCalls)
            {
                xml.Add(new XElement("call_type", "completed_calls"));
            }
            if ((callTypes & CallTypes.RedirectedCalls) == CallTypes.RedirectedCalls)
            {
                xml.Add(new XElement("call_type", "redirected_calls"));
            }

            return(xml);
        }
        /// <summary>
        /// Creates a client for an HTTPS reqeust
        /// </summary>
        /// <param name="callType">The type of call to make</param>
        public static HttpsClientRequest GetClientRequest(CallTypes callType)
        {
            HttpsClientRequest request = new HttpsClientRequest();
            RequestTypes       requestType;

            // Set the base URL by the call type
            SetRequestBaseUrl(request, callType);

            // Determine the request type to send to the Content and Header factories
            requestType = GetRequestType(callType);

            // Get the content to be assigned to theheader
            ContentFactory.BuildRequestContentString(request, requestType);

            // Get the HTTP header for the request
            HeaderFactory.BuildRequestHeaders(request, requestType);

            return(request);
        }
        /// <summary>
        /// Gets the request type, based on the call type
        /// </summary>
        /// <param name="callType">The call type to be evaluated</param>
        private static RequestTypes GetRequestType(CallTypes callType)
        {
            RequestTypes requestType = RequestTypes.StandardGetRequest;

            switch (callType)
            {
            case CallTypes.RefreshAuthorization:
                requestType = RequestTypes.RefreshToken;
                break;

            case CallTypes.Command:
                requestType = RequestTypes.StandardPostRequest;
                break;

            case CallTypes.Request:
                requestType = RequestTypes.StandardGetRequest;
                break;
            }

            return(requestType);
        }
Example #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Switchvox.CallQueueLogs.Search"/> class to be executed against one or more call queues
        /// </summary>
        /// <param name="startDate">The minimum date to search from.</param>
        /// <param name="endDate">The maximum date to search to.</param>
        /// <param name="queueAccountIds">A list of Call Queue Account IDs to retrieve data for. At least 1 Account ID must be specified.</param>
        /// <param name="callTypes">A combination of flags indicating the type of calls to include in the search results.</param>
        /// <param name="ignoreWeekends">Whether weekends should be excluded from the search results.</param>
        /// <param name="itemsPerPage">The number of results to return in this request. Additional items can be retrieved by making additional requests and incrementing the pageNumber parameter</param>
        /// <param name="pageNumber">The page of results to return in this request. Used in conjunction with the itemsPerPage parameter.</param>
        /// <param name="sortOrder">How the search results will be sorted.</param>
        /// <param name="sortField">The field of the search results to sort on</param>
        public Search(DateTime startDate, DateTime endDate, string[] queueAccountIds, CallTypes callTypes, bool ignoreWeekends = false, int itemsPerPage = 50, int pageNumber = 1, SortOrder sortOrder = SortOrder.Asc, SortField sortField = SortField.StartTime)
            : base("switchvox.callQueueLogs.search")
        {
            if (queueAccountIds.Length == 0)
                throw new ArgumentException();

            List<XElement> xml = new List<XElement>
            {
                new XElement("start_date", startDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("end_date",  endDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("ignore_weekends", Convert.ToInt32(ignoreWeekends)),
                new XElement("queue_account_ids", CreateAccountIdElms(queueAccountIds)),
                new XElement("call_types", CreateCallTypeElms(callTypes)),
                new XElement("sort_field", GetSortField(sortField)),
                new XElement("sort_order", sortOrder.ToString()),
                new XElement("items_per_page", itemsPerPage),
                new XElement("page_number", pageNumber)
            };

            SetXml(xml);
        }
Example #18
0
        public string GetSignatureString(CallTypes callType)
        {
            StringBuilder buf = new StringBuilder();

            Type[] types = GetParameterTypes();
            if (callType == CallTypes.ImplicitInstance)
            {
                types = ArrayUtils.RemoveFirst(types);
            }

            string comma = "";

            buf.Append("(");
            foreach (Type t in types)
            {
                buf.Append(comma);
                buf.Append(t.Name);
                comma = ", ";
            }
            buf.Append(")");
            return(buf.ToString());
        }
Example #19
0
        public void Set(object target, object value)
        {
            lock (setterLock)
            {
tryAgain:
                switch (preferredSetterCall)
                {
                case CallTypes.ViaDelegate:
                    try
                    {
                        fastSetter(target, value);
                    }
                    catch (Exception)
                    {
                        preferredSetterCall = CallTypes.ReflectedMethod;
                        goto tryAgain;
                    }
                    break;

                case CallTypes.ReflectedMethod:
                    try
                    {
                        setterMethod.Invoke(target, new[] { value });
                    }
                    catch (Exception)
                    {
                        preferredSetterCall = CallTypes.ClassMethod;
                        goto tryAgain;
                    }
                    break;

                case CallTypes.ClassMethod:
                    propertyInfo.SetValue(target, value, null);
                    break;
                }
            }
        }
        private void HandleSystemSettingsStatus(Hashtable data)
        {
            bool      callRightAway   = false;
            CallTypes defaultCallType = CallTypes.audio;

            string callRightAwayStr = (string)data[CMessageParser.ApiStringConstants.SystemSettingsStatusResponse.CallRightAwayOnceNumberSelected];

            if (callRightAwayStr != null)
            {
                callRightAway = (callRightAwayStr == CMessageParser.ApiStringConstants.GenericTrueFalse.True);
            }

            string defaultCallTypeStr = (string)data[CMessageParser.ApiStringConstants.SystemSettingsStatusResponse.DefaultCallType];

            if (defaultCallTypeStr != null)
            {
                switch (defaultCallTypeStr)
                {
                case CMessageParser.ApiStringConstants.GenericAudioVideoConference.Audio:
                    defaultCallType = CallTypes.audio;
                    break;

                case CMessageParser.ApiStringConstants.GenericAudioVideoConference.Video:
                    defaultCallType = CallTypes.video;
                    break;

                case CMessageParser.ApiStringConstants.GenericAudioVideoConference.Conference:
                    defaultCallType = CallTypes.conference;
                    break;
                }
            }

            if (OnSystemSettingsStatus != null)
            {
                OnSystemSettingsStatus(this, new SystemSettingsStatusEventArgs(defaultCallType, callRightAway));
            }
        }
Example #21
0
        public object Get(object target)
        {
            lock (getterLock)
            {
tryAgain:
                switch (preferredGetterCall)
                {
                case CallTypes.ViaDelegate:
                    try
                    {
                        return(fastGetter(target));
                    }
                    catch (Exception)
                    {
                        preferredGetterCall = CallTypes.ReflectedMethod;
                        goto tryAgain;
                    }

                case CallTypes.ReflectedMethod:
                    try
                    {
                        return(getterMethod.Invoke(target, null));
                    }
                    catch (Exception)
                    {
                        preferredGetterCall = CallTypes.ClassMethod;
                        goto tryAgain;
                    }

                case CallTypes.ClassMethod:
                    return(propertyInfo.GetValue(target, null));
                }
            }

            return(null);
        }
 /// <summary>
 /// Thsi will log the name of the calling method
 /// </summary>
 /// <param name="callType">defaults to Point</param>
 /// <param name="callerName">Do not use. Filled in by system with the calling method name</param>
 private void LogCaller(CallTypes callType = CallTypes.Point, [CallerMemberName] string callerName = "")
 {
     LogSpecificName(callerName, callType);
 }
        //---------------------------------------------------------------------
        //public methods for logging and getting results

        /// <summary>
        /// Instrumentation method which allows a specific point to be logged with a given name
        /// </summary>
        /// <param name="callPoint"></param>
        /// <param name="callType">defaults to Point</param>
        public void LogSpecificName(string callPoint, CallTypes callType = CallTypes.Point)
        {
            _logOfCalls.Add(new InstrumentedLog(callPoint, callType, _timer.ElapsedMilliseconds));
        }
        private DynamicMetaObject CallWorker(ParameterBinder parameterBinder, IList<MethodBase> targets, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType, BindingRestrictions restrictions, NarrowingLevel minLevel, NarrowingLevel maxLevel, string name, out BindingTarget target) {
            ContractUtils.RequiresNotNull(parameterBinder, "parameterBinder");
            ContractUtils.RequiresNotNullItems(args, "args");
            ContractUtils.RequiresNotNullItems(targets, "targets");
            ContractUtils.RequiresNotNull(restrictions, "restrictions");

            DynamicMetaObject[] finalArgs;
            SymbolId[] argNames;

            if (callType == CallTypes.ImplicitInstance) {
                GetArgumentNamesAndTypes(signature, ArrayUtils.RemoveFirst(args), out argNames, out finalArgs);
                finalArgs = ArrayUtils.Insert(args[0], finalArgs);
            } else {
                GetArgumentNamesAndTypes(signature, args, out argNames, out finalArgs);
            }

            // attempt to bind to an individual method
            MethodBinder binder = MethodBinder.MakeBinder(
                this,
                name ?? GetTargetName(targets),
                targets,
                argNames,
                minLevel,
                maxLevel);
            target = binder.MakeBindingTarget(callType, finalArgs);

            if (target.Success) {
                // if we succeed make the target for the rule
                return new DynamicMetaObject(
                    target.MakeExpression(parameterBinder),
                    restrictions.Merge(MakeSplatTests(callType, signature, args).Merge(BindingRestrictions.Combine(target.RestrictedArguments)))
                );
            }
            // make an error rule
            return MakeInvalidParametersRule(callType, signature, this, args, restrictions, target);
        }
Example #25
0
        private List<XElement> CreateCallTypeElms(CallTypes callTypes)
        {
            List<XElement> xml = new List<XElement>();

            if ((callTypes & CallTypes.AbandonedCalls) == CallTypes.AbandonedCalls)
            {
                xml.Add(new XElement("call_type", "abandoned_calls"));
            }
            if ((callTypes & CallTypes.CompletedCalls) == CallTypes.CompletedCalls)
            {
                xml.Add(new XElement("call_type", "completed_calls"));
            }
            if ((callTypes & CallTypes.RedirectedCalls) == CallTypes.RedirectedCalls)
            {
                xml.Add(new XElement("call_type", "redirected_calls"));
            }

            return xml;
        }
Example #26
0
 private static BindingRestrictions MakeSplatTests(CallTypes callType, CallSignature signature, IList <DynamicMetaObject> args)
 {
     return(MakeSplatTests(callType, signature, false, args));
 }
Example #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Switchvox.CallQueueLogs.Search"/> class to be executed against a single call queue
 /// </summary>
 /// <param name="startDate">The minimum date to search from.</param>
 /// <param name="endDate">The maximum date to search to.</param>
 /// <param name="queueAccountId">The Call Queue Account ID to retrieve data for.</param>
 /// <param name="callTypes">A combination of flags indicating the type of calls to include in the search results.</param>
 /// <param name="ignoreWeekends">Whether weekends should be excluded from the search results.</param>
 /// <param name="itemsPerPage">The number of results to return in this request. Additional items can be retrieved by making additional requests and incrementing the pageNumber parameter</param>
 /// <param name="pageNumber">The page of results to return in this request. Used in conjunction with the itemsPerPage parameter.</param>
 /// <param name="sortOrder">How the search results will be sorted.</param>
 /// <param name="sortField">The field of the search results to sort on</param>
 public Search(DateTime startDate, DateTime endDate, string queueAccountId, CallTypes callTypes, bool ignoreWeekends = false, int itemsPerPage = 50, int pageNumber = 1, SortOrder sortOrder = SortOrder.Asc, SortField sortField = SortField.StartTime)
     : this(startDate, endDate, new[] {  queueAccountId }, callTypes, ignoreWeekends, itemsPerPage, pageNumber, sortOrder, sortField)
 {
 }
Example #28
0
        /// <summary>
        /// Search for call logs against one or more call queues, automatically requesting additional pages as the results are enumerated.
        /// </summary>
        /// <param name="startDate">The minimum date to search from.</param>
        /// <param name="endDate">The maximum date to search to.</param>
        /// <param name="queueAccountIds">A list of Call Queue Account IDs to retrieve data for. At least 1 Account ID must be specified.</param>
        /// <param name="callTypes">A combination of flags indicating the type of calls to include in the search results.</param>
        /// <param name="ignoreWeekends">Whether weekends should be excluded from the search results.</param>
        /// <param name="itemsPerPage">The number of results to return in each response. SwitchvoxAPI will automatically request additional items as required as the results are enumerated.</param>
        public IEnumerable <CallQueueLog> StreamSearch(DateTime startDate, DateTime endDate, string[] queueAccountIds, CallTypes callTypes = CallTypes.AllCalls, bool ignoreWeekends = false, int itemsPerPage = 50)
        {
            var method = GetRequestMethod(startDate, endDate, ignoreWeekends, queueAccountIds, callTypes, itemsPerPage, 1);

            var response = client.Stream <CallLogs <CallQueueLog>, CallQueueLog>(method, GetTotalItems, SetNextPage, itemsPerPage, r => r.Items);

            return(response);
        }
 // method call
 public ClojureOverloadResolver(ClojureBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
     : base(binder, args, signature, callType)
 {
 }
Example #30
0
 public abstract DefaultOverloadResolver CreateOverloadResolver(IList <DynamicMetaObject> args, CallSignature signature, CallTypes callType);
 public void RequestPlaceCall(string number, CallTypes type)
 {
     API_PlaceCall(number, type);
 }
 private DynamicMetaObject CallWorker(ParameterBinder parameterBinder, IList<MethodBase> targets, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType, BindingRestrictions restrictions, NarrowingLevel minLevel, NarrowingLevel maxLevel, string name) {
     BindingTarget dummy;
     return CallWorker(parameterBinder, targets, args, signature, callType, restrictions, minLevel, maxLevel, name, out dummy);
 }
Example #33
0
 // method call:
 public PythonOverloadResolver(PythonBinder binder, IList <DynamicMetaObject> args, CallSignature signature, CallTypes callType, Expression codeContext)
     : base(binder, args, signature, callType)
 {
     Assert.NotNull(codeContext);
     _context = codeContext;
 }
Example #34
0
        //http://developers.digium.com/switchvox/wiki/index.php/Switchvox.callQueueLogs.search

        /// <summary>
        /// Search for call logs against a single call queue.
        /// </summary>
        /// <param name="startDate">The minimum date to search from.</param>
        /// <param name="endDate">The maximum date to search to.</param>
        /// <param name="queueAccountId">The Call Queue Account ID to retrieve data for.</param>
        /// <param name="callTypes">A combination of flags indicating the type of calls to include in the search results.</param>
        /// <param name="ignoreWeekends">Whether weekends should be excluded from the search results.</param>
        /// <param name="itemsPerPage">The number of results to return in this request. Additional items can be retrieved by making additional requests and incrementing the pageNumber parameter</param>
        /// <param name="pageNumber">The page of results to return in this request. Used in conjunction with the itemsPerPage parameter.</param>
        public CallLogs <CallQueueLog> Search(DateTime startDate, DateTime endDate, string queueAccountId, CallTypes callTypes = CallTypes.AllCalls, bool ignoreWeekends = false, int itemsPerPage = 50, int pageNumber = 1)
        {
            return(Search(startDate, endDate, new[] { queueAccountId }, callTypes, ignoreWeekends, itemsPerPage, pageNumber));
        }
Example #35
0
 // method call:
 public PythonOverloadResolver(PythonBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType, Expression codeContext)
     : base(binder, args, signature, callType)
 {
     Assert.NotNull(codeContext);
     _context = codeContext;
 }
Example #36
0
        /// <summary>
        /// Search for call logs against one or more call queues.
        /// </summary>
        /// <param name="startDate">The minimum date to search from.</param>
        /// <param name="endDate">The maximum date to search to.</param>
        /// <param name="queueAccountIds">A list of Call Queue Account IDs to retrieve data for. At least 1 Account ID must be specified.</param>
        /// <param name="callTypes">A combination of flags indicating the type of calls to include in the search results.</param>
        /// <param name="ignoreWeekends">Whether weekends should be excluded from the search results.</param>
        /// <param name="itemsPerPage">The number of results to return in this request. Additional items can be retrieved by making additional requests and incrementing the pageNumber parameter</param>
        /// <param name="pageNumber">The page of results to return in this request. Used in conjunction with the itemsPerPage parameter.</param>
        public CallLogs <CallQueueLog> Search(DateTime startDate, DateTime endDate, string[] queueAccountIds, CallTypes callTypes = CallTypes.AllCalls, bool ignoreWeekends = false, int itemsPerPage = 50, int pageNumber = 1)
        {
            if (queueAccountIds.Length == 0)
            {
                throw new ArgumentException("At least one queue account ID must be specified", nameof(queueAccountIds));
            }

            var method = GetRequestMethod(startDate, endDate, ignoreWeekends, queueAccountIds, callTypes, itemsPerPage, pageNumber);

            var response = client.Execute <CallLogs <CallQueueLog> >(method);

            return(response);
        }
 private static BindingRestrictions MakeSplatTests(CallTypes callType, CallSignature signature, IList<DynamicMetaObject> args) {
     return MakeSplatTests(callType, signature, false, args);
 }
Example #38
0
        private RequestMethod GetRequestMethod(DateTime startDate, DateTime endDate, bool ignoreWeekends, string[] queueAccountIds, CallTypes callTypes, int itemsPerPage, int pageNumber)
        {
            List <XElement> xml = new List <XElement>
            {
                new XElement("start_date", startDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("end_date", endDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("ignore_weekends", Convert.ToInt32(ignoreWeekends)),
                new XElement("queue_account_ids", CreateAccountIdElms(queueAccountIds)),
                new XElement("call_types", CreateCallTypeElms(callTypes)),
                new XElement("items_per_page", itemsPerPage),
                new XElement("page_number", pageNumber)
            };

            return(new RequestMethod("switchvox.callQueueLogs.search", xml));
        }
        /// <summary>
        /// Makes test for param arrays and param dictionary parameters.
        /// </summary>
        private static BindingRestrictions MakeSplatTests(CallTypes callType, CallSignature signature, bool testTypes, IList<DynamicMetaObject> args) {
            BindingRestrictions res = BindingRestrictions.Empty;

            if (signature.HasListArgument()) {
                res = MakeParamsArrayTest(callType, signature, testTypes, args);
            }

            if (signature.HasDictionaryArgument()) {
                res = res.Merge(MakeParamsDictionaryTest(args, testTypes));
            }

            return res;
        }
 public abstract DefaultOverloadResolver CreateOverloadResolver(IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType);
        /// <summary>
        /// Pulls out the right argument to build the splat test.  MakeParamsTest makes the actual test.
        /// </summary>
        private static BindingRestrictions MakeParamsArrayTest(CallTypes callType, CallSignature signature, bool testTypes, IList<DynamicMetaObject> args) {
            int listIndex = signature.IndexOf(ArgumentType.List);
            Debug.Assert(listIndex != -1);
            if (callType == CallTypes.ImplicitInstance) {
                listIndex++;
            }

            return MakeParamsTest(args[listIndex], testTypes);
        }
Example #42
0
 public LuaOverloadResolver(ActionBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
     : base(binder, args, signature, callType)
 {
 }
 public override DefaultOverloadResolver CreateOverloadResolver(IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
 {
     return new DefaultOverloadResolver(_binder, args, signature, callType);
 }
Example #44
0
 // method call
 public ClojureOverloadResolver(ClojureBinder binder, IList <DynamicMetaObject> args, CallSignature signature, CallTypes callType)
     : base(binder, args, signature, callType)
 {
 }
        private static DynamicMetaObject MakeInvalidParametersRule(CallTypes callType, CallSignature signature, DefaultBinder binder, IList<DynamicMetaObject> args, BindingRestrictions restrictions, BindingTarget bt) {
            BindingRestrictions restriction = MakeSplatTests(callType, signature, true, args);

            // restrict to the exact type of all parameters for errors
            for (int i = 0; i < args.Count; i++) {
                args[i] = args[i].Restrict(args[i].GetLimitType());
            }

            return MakeError(
                binder.MakeInvalidParametersError(bt),
                restrictions.Merge(BindingRestrictions.Combine(args).Merge(restriction))
            );
        }
Example #46
0
 public override DefaultOverloadResolver CreateOverloadResolver(IList <DynamicMetaObject> args, CallSignature signature, CallTypes callType)
 {
     return(new DefaultOverloadResolver(_binder, args, signature, callType));
 }
 public InstrumentedLog(string callPoint, CallTypes callType, long elapsedMilisecondsSoFar)
 {
     CallPoint = callPoint;
     CallType = callType;
     _elapsedMilisecondsSoFar = elapsedMilisecondsSoFar;
 }