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(); }
public RequestLoginUser(ScorocodeSdkStateHolder stateHolder, String email, String password) { App = stateHolder.ApplicationId; Cli = stateHolder.ClientKey; Email = email; Password = password; }
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 RequestCloneCollection(ScorocodeSdkStateHolder stateHolder, string collectionId, string newCollectionName) : base(stateHolder) { //this.collection = new ScorocodeCollection() // .setCollectionId(collectionId) // .setCollectionName(newCollectionName); collection = new CloneCollection(collectionId, newCollectionName); }
public RequestUpdateById(ScorocodeSdkStateHolder stateHolder, string collectionName, QueryInfo query, UpdateInfo doc) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterKey; this.sess = stateHolder.SessionId; this.coll = collectionName; this.query = query; this.doc = doc.Info; }
//private ScorocodeCollection collection; public RequestCreateCollection(ScorocodeSdkStateHolder stateHolder, string collectionName, bool isUseDocsACL, ScorocodeACL ACL) : base(stateHolder) { collection = new CreateCollection(collectionName, isUseDocsACL, ACL); // this.collection = new ScorocodeCollection() // .setCollectionName(collectionName) // .setUseDocsACL(isUseDocsACL) // .setACL(ACL) // .setNotify(false) // .setTriggers(new ScorocodeTriggers()); }
public RequestFile(ScorocodeSdkStateHolder stateHolder, string coll, string docId, string field, string file) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterOrFileKey; this.sess = stateHolder.SessionId; this.coll = coll; this.docId = docId; this.field = field; this.file = file; }
public RequestUpdateCollection(ScorocodeSdkStateHolder stateHolder, string collectionId, string collectionName, bool isUseDocsACL, ScorocodeACL ACL, bool notify) : base(stateHolder) { this.collection = new ScorocodeCollection() .setCollectionName(collectionName) .setUseDocsACL(isUseDocsACL) .setACL(ACL) .setCollectionId(collectionId) .setNotify(notify) .setTriggers(new ScorocodeTriggers()); }
public RequestCount(ScorocodeSdkStateHolder stateHolder, string coll, Query query = null) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterKey; this.sess = stateHolder.SessionId; this.coll = coll; if (query != null) { this.query = query.getQueryInfo(); //.getInfo(); } }
public RequestRegisterUser(ScorocodeSdkStateHolder stateHolder, String username, String email, String password, DocumentInfo doc) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterKey; this.email = email; this.username = username; this.password = password; if (doc != null) { this.doc = doc.GetContent(); } }
public RequestSendEmail(ScorocodeSdkStateHolder stateHolder, string coll, Query query, MessageEmail msg) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterOrMessageKey; this.sess = stateHolder.SessionId; this.coll = coll; if (query != null) { this.query = query.getQueryInfo(); //.getInfo(); } this.msg = msg; }
public RequestSendScriptTask(ScorocodeSdkStateHolder stateHolder, String coll, Query query, string script, bool isDebugMode) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterOrMessageKey; this.sess = stateHolder.SessionId; this.coll = coll; if (query != null) { this.query = query.getQueryInfo(); //.getInfo(); } this.script = script; this.debug = isDebugMode; }
public RequestRemove(ScorocodeSdkStateHolder stateHolder, string collectionName, Dictionary <string, object> query, int limit = 0) { _app = stateHolder.ApplicationId; _cli = stateHolder.ClientKey; _acc = stateHolder.MasterKey; _sess = stateHolder.SessionId; _coll = collectionName; if (query != null) { _query = query; } this.limit = limit; }
public RequestUpdate(ScorocodeSdkStateHolder stateHolder, string collectionName, Query query, UpdateInfo doc, int limit) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterKey; this.sess = stateHolder.SessionId; this.coll = collectionName; if (query != null) { this.query = query.getQueryInfo(); //.getInfo(); } this.doc = doc.Info; this.limit = limit; }
public RequestInsert(ScorocodeSdkStateHolder stateHolder, string collectionName, DocumentInfo doc = null) { _app = stateHolder.ApplicationId; _cli = stateHolder.ClientKey; _acc = stateHolder.MasterKey; _sess = stateHolder.SessionId; _coll = collectionName; if (doc != null) { _doc = doc.GetFields(); } else { _doc = new Dictionary <string, object>(); } }
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}"; }
public void TestMethod1() { ScorocodeSdkStateHolder stateHolder = new ScorocodeSdkStateHolder( /* applicationId */ "228730d6c20044fc85f8a5c8b015e0e7", /* clientKey */ "b93d0e6f7f0e4c18955f580c082345cc", /* masterKey */ "01db6a43743e4492a7bdef1a3be3a395", /* fileKey */ "deb3d951109d43069baba7b8e5424442", /* messageKey */ "80704b44194f4e1282986e5d68942848", /* scriptKey */ "c27ad4e97a784072b029dd02f68c347c", /* websocketKey */ "7b1966691002464e92066b2693135236"); Assert.AreEqual(stateHolder.ApplicationId, "228730d6c20044fc85f8a5c8b015e0e7"); Assert.AreEqual(stateHolder.ClientKey, "b93d0e6f7f0e4c18955f580c082345cc"); Assert.AreEqual(stateHolder.MasterKey, "01db6a43743e4492a7bdef1a3be3a395"); Assert.AreEqual(stateHolder.FileKey, "deb3d951109d43069baba7b8e5424442"); Assert.AreEqual(stateHolder.MessageKey, "80704b44194f4e1282986e5d68942848"); Assert.AreEqual(stateHolder.ScriptKey, "c27ad4e97a784072b029dd02f68c347c"); Assert.AreEqual(stateHolder.WebSocket, "7b1966691002464e92066b2693135236"); Assert.IsTrue(string.IsNullOrEmpty(stateHolder.SessionId)); Assert.AreEqual(stateHolder.BaseUrl, "https://api.scorocode.ru"); }
public RequestFind(ScorocodeSdkStateHolder stateHolder, string coll, Query query, SortInfo sort, List <String> fields, int limit, int skip) { this.app = stateHolder.ApplicationId; this.cli = stateHolder.ClientKey; this.acc = stateHolder.MasterKey; this.sess = stateHolder.SessionId; this.coll = coll; if (query != null) { this.query = query.getQueryInfo(); //.getInfo(); } if (sort != null) { this.sort = sort.Info; //.getInfo(); } this.fields = fields; this.limit = limit; this.skip = skip; }
public RequestGetBotsList(ScorocodeSdkStateHolder stateHolder) : base(stateHolder) { }
public RequestDeleteFolder(ScorocodeSdkStateHolder stateHolder, string path) : base(stateHolder) { this.path = path; }
public RequestChangeCollectionTrigers(ScorocodeSdkStateHolder stateHolder, String collectionName) : base(stateHolder) { this.coll = collectionName; }
public RequestLogoutUser(ScorocodeSdkStateHolder stateHolder) { App = stateHolder.ApplicationId; Cli = stateHolder.ClientKey; Sess = stateHolder.SessionId; }
public RequestCreateCollectionIndex(ScorocodeSdkStateHolder stateHolder, string collectionName, Index index) : base(stateHolder) { this.coll = collectionName; this.index = index; }
public RequestDeleteCollection(ScorocodeSdkStateHolder stateHolder, string collectionId) : base(stateHolder) { this.collection = new DeleteCollection(collectionId); }
public RequestDeleteField(ScorocodeSdkStateHolder stateHolder, string collectionName, string fieldName) : base(stateHolder) { this.coll = collectionName; this.collField = new DeleteField(fieldName); }
public RequestStatistic(ScorocodeSdkStateHolder stateHolder) { app = stateHolder.ApplicationId; cli = stateHolder.ClientKey; acc = stateHolder.MasterKey; }
public RequestUpdateBot(ScorocodeSdkStateHolder stateHolder, string botId, ScorocodeBot bot) : base(stateHolder) { this.bot = bot; this.bot.setBotId(botId); }
public RequestUpdateScript(ScorocodeSdkStateHolder stateHolder, string scriptId, ScorocodeScript script) : base(stateHolder, script) { this.script = scriptId; }
public RequestCreateBot(ScorocodeSdkStateHolder stateHolder, string botName, string botId, string scriptId, bool isActive) : base(stateHolder) { this.bot = new ScorocodeBot(botName, botId, scriptId, isActive); }
public RequestRegisterUser(ScorocodeSdkStateHolder stateHolder, String username, String email, String password) : this(stateHolder, username, email, password, null) { }