Example #1
0
        public static async Task <string> GetDevices(string url, string accessToken)
        {
            var client = new RestClient(url);

            var request = new RestRequest("/user/device", Method.Get);

            request.AddQueryParameter("lang", "en");
            request.AddQueryParameter("getTags", "1");
            request.AddQueryParameter("version", AppData.VERSION);
            request.AddQueryParameter("ts", EwelinkHelper.MakeTimestamp());
            request.AddQueryParameter("appid", AppData.APP_ID);
            request.AddQueryParameter("imei", EwelinkHelper.MakeFakeImei());
            request.AddQueryParameter("os", AppData.OS);
            request.AddQueryParameter("model", AppData.MODEL);
            request.AddQueryParameter("romVersion", AppData.ROM_VERSION);
            request.AddQueryParameter("appVersion", AppData.APP_VERSION);

            request.AddHeader("Authorization", $"Bearer {accessToken}");
            request.RequestFormat = DataFormat.Json;

            var cancellationTokenSource = new CancellationTokenSource();
            var response = await client.ExecuteAsync(request, cancellationTokenSource.Token);

            return(response.Content);
        }
Example #2
0
        internal WsUpdatePayload(string deviceId, string apiKey, object @params)
        {
            var seq = EwelinkHelper.MakeSequence();

            action       = "update";
            userAgent    = "app";
            deviceid     = deviceId;
            apikey       = apiKey;
            selfApikey   = apiKey;
            this.@params = @params;
            sequence     = seq.sequence;
        }
Example #3
0
 internal CredentialsPayload(string email, string password)
 {
     this.email    = email;
     this.password = password;
     version       = AppData.VERSION;
     ts            = EwelinkHelper.MakeTimestamp();
     nonce         = EwelinkHelper.MakeNonce();
     os            = AppData.OS;
     appid         = AppData.APP_ID;
     imei          = EwelinkHelper.MakeFakeImei();
     model         = AppData.MODEL;
     romVersion    = AppData.ROM_VERSION;
     appVersion    = AppData.APP_VERSION;
 }
Example #4
0
        internal WsCredentialsPayload(string accessToken, string apiKey)
        {
            var seq = EwelinkHelper.MakeSequence();

            action     = "userOnline";
            userAgent  = "app";
            version    = AppData.VERSION;
            nonce      = EwelinkHelper.MakeNonce();
            apkVesrion = AppData.APK_VERSION;
            os         = AppData.OS;
            at         = accessToken;
            apikey     = apiKey;
            ts         = seq.timestamp;
            model      = AppData.MODEL;
            romVersion = AppData.ROM_VERSION;
            sequence   = seq.sequence;
        }