public XElement GetTitleListXML(int nskip, int nlist, APIRequestType req_type)
        {
            XElement result = null;
            using (WebClient wc = new WebClient())
            {
                String request = "?id=155&nskip=" + nskip.ToString();
                if (nlist > 0)
                {
                    request = request + "&nlist=" + nlist.ToString();
                }
                else
                {
                    request = request + "&nlist=all";
                }

                switch (req_type)
                {
                    case APIRequestType.ANIME:
                        request = request + "&type=anime";
                        break;
                    case APIRequestType.MANGA:
                        request = request + "&type=manga";
                        break;
                }

                result = XElement.Parse(wc.DownloadString(API_BASE_DOMAIN_REPORTS + request));
                System.Threading.Thread.Sleep(1000);
                return result;
            }
        }
        private ConstructorIORequest CreateTrackingRequest(APIRequestType APIPath, string Method, HashArgs ExtraArgs)
        {
            var trackingRequest = new ConstructorIORequest(APIPath, Method);

            if (ExtraArgs != null)
                Util.Merge(ExtraArgs, trackingRequest.RequestBody);

            return trackingRequest;
        }
Beispiel #3
0
        /// <summary>
        /// Only for plain get requests
        /// </summary>
        /// <param name="url"></param>
        /// <param name="reqMethod"></param>
        /// <param name="_requestType"></param>
        /// <returns></returns>
        public static APIRequest Prepare(string url, APIRequestType _requestType, bool setToken = true)
        {
            APIRequest req;

            req = Get(url);
            if (setToken)
            {
                req.SetRequestHeader("Authorization", "Bearer " + IOCCore.Resolve <IWebInterface>().AccessToken);
            }
            req.form        = null;
            req.requestType = _requestType;

            return(req);
        }
Beispiel #4
0
        public void CreateWebRequest(APIRequestType apiRequestType, params string[] data)
        {
            try
            {
                APIRequest request;
                switch (apiRequestType)
                {
                case APIRequestType.Avatar:
                    request = new APIAvatarRequest("elleyer");
                    request.APIRequestType = APIRequestType.Avatar;
                    break;

                case APIRequestType.Config:
                    request = new APIConfigRequest(1337);
                    request.APIRequestType = APIRequestType.Config;
                    break;

                case APIRequestType.Settings:
                    request = new APISettingsRequest();
                    request.APIRequestType = APIRequestType.Settings;
                    break;

                case APIRequestType.PlayerInfo:
                    request = new APIPlayerInfoRequest("elleyer");
                    request.APIRequestType = APIRequestType.PlayerInfo;
                    break;

                case APIRequestType.Leaderboards:
                    request = new APILeaderboardsRequest();
                    request.APIRequestType = APIRequestType.Leaderboards;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(apiRequestType), apiRequestType, null);
                }
                request.SetRequestHeader(AuthorizationHeader, SecretToken);
                StartCoroutine(SendRequest(request));
            }
            catch
            {
                // ignored
            }
        }
Beispiel #5
0
        public static APIRequest Prepare(List <IMultipartFormSection> data, string url, string reqMethod, APIRequestType _requestType)
        {
            APIRequest req;

            if (reqMethod.Equals(kHttpVerbGET))
            {
                req = Get(url);
            }
            else
            {
                req = Post(url, data);
            }
            req.SetRequestHeader("Authorization", "Bearer " + IOCCore.Resolve <IWebInterface>().AccessToken);

            //req.form = _form;
            req.requestType = _requestType;

            return(req);
        }
Beispiel #6
0
        public static APIRequest Prepare(WWWForm _form, string url, string reqMethod, APIRequestType _requestType)
        {
            APIRequest req;

            req = new APIRequest(" ", UnityWebRequest.kHttpVerbPOST);

            if (reqMethod.Equals(kHttpVerbGET))
            {
                req = Get(url);
            }
            else
            {
                req = Post(url, _form);
            }
            req.SetRequestHeader("Authorization", "Bearer " + IOCCore.Resolve <IWebInterface>().AccessToken);
            req.form        = _form;
            req.requestType = _requestType;
            return(req);
        }
 public ConstructorIORequest(APIRequestType APIRequest, string Method,
     string Protocol = "https")
     : this(StringEnum.GetStringValue(APIRequest), Method, Protocol)
 {
 }