Beispiel #1
0
        public static void RequestEx <T1, T2, T3, T4>(this IRapidAPI rapidAPI, Func <T1, T2, T3> requsetMethod, T1 param1, T2 param2, out T4 result)
            where T4 : new()
        {
            result = default;

            // invoke request
            T3 response = requsetMethod.Invoke(param1, param2);

            if (response == null)
            {
                return;
            }

            result = DataMapper.Map <T3, T4>(response);
        }
Beispiel #2
0
        public static void RequestEx <T1, T2, T3, T4>(this IRapidAPI rapidAPI, Func <T1, T2, IList <T3> > requsetMethod, T1 param1, T2 param2, out IList <T4> result)
            where T4 : new()
        {
            result = new List <T4>();

            // invoke request
            IList <T3> response = requsetMethod.Invoke(param1, param2);

            if (response == null)
            {
                return;
            }

            foreach (T3 data in response)
            {
                result.Add(DataMapper.Map <T3, T4>(data));
            }
        }
Beispiel #3
0
        public static void RequestEx <T1, T2, T3>(this IRapidAPI rapidAPI, Func <T1, IList <IList <T2> > > requsetMethod, T1 param, out IList <IList <T3> > result)
            where T3 : new()
        {
            result = new List <IList <T3> >();

            // invoke request
            IList <IList <T2> > response = requsetMethod.Invoke(param);

            if (response == null)
            {
                return;
            }

            foreach (IList <T2> datas in response)
            {
                var innerList = new List <T3>();
                result.Add(innerList);
                foreach (T2 data in datas)
                {
                    innerList.Add(DataMapper.Map <T2, T3>(data));
                }
            }
        }