public async void TestMethod_RegisterUser1() { string UserName = ""; string EMail = ""; string Password = ""; var sc = new ScorocodeApi(); ScorocodeSdkStateHolder stateHolder = new ScorocodeSdkStateHolder( /* applicationId */ "", /* clientKey */ "", /* masterKey */ "", /* fileKey */ "", /* messageKey */ "", /* scriptKey */ "", /* webSocket */ "" ); RequestRegisterUser requestRegisterUsers; Dictionary <string, object> doc = new Dictionary <string, object>() { { "key1", "value1" }, { "key2", "value2" } }; DocumentInfo docInfo = new DocumentInfo(doc); requestRegisterUsers = new RequestRegisterUser(stateHolder, UserName, EMail, Password, docInfo); ResponseCodes responsCodes = await sc.RegisterAsync(requestRegisterUsers); }
public void TestMethod2b() { Task.Run(async() => { var sc = new ScorocodeApi(); ScorocodeSdkStateHolder stateHolder = new ScorocodeSdkStateHolder( /* applicationId */ "228730d6c20044fc85f8a5c8b015e0e7", /* clientKey */ "b93d0e6f7f0e4c18955f580c082345cc", /* masterKey */ "01db6a43743e4492a7bdef1a3be3a395", /* fileKey */ "deb3d951109d43069baba7b8e5424442", /* messageKey */ "80704b44194f4e1282986e5d68942848", /* scriptKey */ "c27ad4e97a784072b029dd02f68c347c", /* websocketKey */ "7b1966691002464e92066b2693135236"); RequestInsert requestInsert; ResponseInsert responsInsert; DocumentInfo docInfo = new DocumentInfo(); docInfo.Put("bossComment", "Good Job!"); docInfo.Put("name", "Kill Bill!"); requestInsert = new RequestInsert(stateHolder, "tasks", docInfo); responsInsert = await sc.InsertAsync(requestInsert); Assert.IsFalse(responsInsert.Error); Assert.AreEqual(responsInsert.ErrCode, ""); Assert.AreEqual(responsInsert.ErrMsg, ""); }).GetAwaiter().GetResult(); }
private async void StartCommandExecute() { Log = "Button clicked!"; //var uri = new Uri("https://api.scorocode.ru/api/v1/app"); //string jsonString = "{ \"acc\": \"01db6a43743e4492a7bdef1a3be3a395\", " // ключ доступа, только masterKey // + "\"app\": \"228730d6c20044fc85f8a5c8b015e0e7\", " // идентификатор приложения // + "\"cli\": \"b93d0e6f7f0e4c18955f580c082345cc\" }";// клиентский ключ //var content = new HttpStringContent(jsonString, Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"); //var httpClient = new HttpClient(); ////httpClient.DefaultRequestHeaders.Clear(); ////httpClient.DefaultRequestHeaders.Accept.Add(new HttpMediaTypeWithQualityHeaderValue("application/json")); ////httpClient.DefaultRequestHeaders.Accept.Add(new HttpMediaTypeWithQualityHeaderValue("text/javascript")); //var response = await httpClient.PostAsync(uri, content); //Log += $"\n\nStatus Code: {response.StatusCode}"; ////Log += $"\n\n{response.Content}"; //Models.Example example; ////var serializer = new DataContractJsonSerializer(typeof(Example)); ////example = (Example) serializer //example = JsonConvert.DeserializeObject<Models.Example>(response.Content.ToString()); var sc = new ScorocodeApi(); //tring applicationId, String clientKey, String masterKey, //String fileKey, String messageKey, String scriptKey, String webSocket ScorocodeSdkStateHolder stateHolder = new ScorocodeSdkStateHolder( /* applicationId */ "228730d6c20044fc85f8a5c8b015e0e7", /* clientKey */ "b93d0e6f7f0e4c18955f580c082345cc", /* masterKey */ "01db6a43743e4492a7bdef1a3be3a395", /* fileKey */ "deb3d951109d43069baba7b8e5424442", /* messageKey */ "80704b44194f4e1282986e5d68942848", /* scriptKey */ "c27ad4e97a784072b029dd02f68c347c", /* websocketKey */ "7b1966691002464e92066b2693135236"); RequestRegisterUser requestRegisterUsers = new RequestRegisterUser(stateHolder, "Dukar", "*****@*****.**", "moscow"); ResponseCodes responsCodes = await sc.RegisterAsync(requestRegisterUsers); Log += $"\n\nError:\t{responsCodes.Error}"; Log += $"\nErrCode:\t{responsCodes.ErrCode}"; Log += $"\nErrMsg:\t{responsCodes.ErrMsg}"; }