コード例 #1
0
ファイル: SchemaController.cs プロジェクト: NTDLS/LeafSQL
        public ActionResponseSchemas List([FromBody] ActionGenericBase action)
        {
            var session = Program.Core.Sessions.GetSession(action.SessionId);

            Thread.CurrentThread.Name = $"API:{session.InstanceKey}:{Utility.GetCurrentMethod()}";
            Program.Core.Log.Trace(Thread.CurrentThread.Name);

            ActionResponseSchemas result = new ActionResponseSchemas();

            try
            {
                var persistSchemas = Program.Core.Schemas.GetList(session, action.SchemaName);

                foreach (var persistSchema in persistSchemas)
                {
                    result.Add(persistSchema.ToPayload());
                }

                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return(result);
        }
コード例 #2
0
        public List <Payloads.Models.DocumentMeta> GetCatalog(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema,
            };

            return(Submit <ActionGenericBase, ActionResponseDocuments>("api/Document/List", action).List);
        }
コード例 #3
0
        /// <summary>
        /// Lists the doucments within a given schema.
        /// </summary>
        /// <param name="schema"></param>
        public async Task <List <Payloads.Models.DocumentMeta> > GetCatalogAsync(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema,
            };

            return((await SubmitAsync <ActionGenericBase, ActionResponseDocuments>("api/Document/List", action)).List);
        }
コード例 #4
0
        /// <summary>
        /// Lists the existing schemas within a given schema.
        /// </summary>
        /// <param name="schema"></param>
        public async Task <List <Payloads.Models.Schema> > ListAsync(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            return((await SubmitAsync <ActionGenericBase, ActionResponseSchemas>("api/Schema/List", action)).List);
        }
コード例 #5
0
        public void Drop(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            Submit <ActionGenericBase, ActionResponseBase>("api/Schema/Drop", action);
        }
コード例 #6
0
        /// <summary>
        /// Drops a single schema or an entire schema path.
        /// </summary>
        /// <param name="schema"></param>
        public async Task DropAsync(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            await SubmitAsync <ActionGenericBase, ActionResponseBase>("api/Schema/Drop", action);
        }
コード例 #7
0
        public bool Exists(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            return(Submit <ActionGenericBase, ActionResponseBoolean>("api/Schema/Exists", action).Value);
        }
コード例 #8
0
        /// <summary>
        /// Checks for the existence of a schema.
        /// </summary>
        /// <param name="schema"></param>
        public async Task <bool> ExistsAsync(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            return((await SubmitAsync <ActionGenericBase, ActionResponseBoolean>("api/Schema/Exists", action)).Value);
        }
コード例 #9
0
        public List <Payloads.Models.Schema> List(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            return(Submit <ActionGenericBase, ActionResponseSchemas>("api/Schema/List", action).List);
        }
コード例 #10
0
        public void DeleteById(string schema, Guid id)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema,
                ObjectId   = id
            };

            Submit <ActionGenericBase, ActionResponseBase>("api/Document/DeleteById", action);
        }
コード例 #11
0
        /// <summary>
        /// Deletes a document in the given schema by its Id.
        /// </summary>
        /// <param name="schema"></param>
        /// <param name="document"></param>
        public async Task DeleteByIdAsync(string schema, Guid id)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema,
                ObjectId   = id
            };

            await SubmitAsync <ActionGenericBase, ActionResponseBase>("api/Document/DeleteById", action);
        }
コード例 #12
0
        public void DeleteLoginByName(string username)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                ObjectName = username
            };

            Submit <ActionGenericBase, ActionResponseId>
                ("api/Security/DeleteLoginByName", action);
        }
コード例 #13
0
        public async Task DeleteLoginByNameAsync(string username)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                ObjectName = username
            };

            await SubmitAsync <ActionGenericBase, ActionResponseId>
                ("api/Security/DeleteLoginByName", action);
        }
コード例 #14
0
ファイル: DocumentController.cs プロジェクト: NTDLS/LeafSQL
        public ActionResponseDocuments List([FromBody] ActionGenericBase action)
        {
            Session session = Program.Core.Sessions.GetSession(action.SessionId);

            Thread.CurrentThread.Name = $"API:{session.InstanceKey}:{Utility.GetCurrentMethod()}";
            Program.Core.Log.Trace(Thread.CurrentThread.Name);

            var persistCatalog = Program.Core.Documents.EnumerateCatalog(session, action.SchemaName);

            var result = new ActionResponseDocuments();

            foreach (var catalogItem in persistCatalog)
            {
                result.Add(catalogItem.ToPayload());
            }

            return(result);
        }
コード例 #15
0
ファイル: DocumentController.cs プロジェクト: NTDLS/LeafSQL
        public ActionResponseBase DeleteById([FromBody] ActionGenericBase action)
        {
            var session = Program.Core.Sessions.GetSession(action.SessionId);

            Thread.CurrentThread.Name = $"API:{session.InstanceKey}:{Utility.GetCurrentMethod()}";
            Program.Core.Log.Trace(Thread.CurrentThread.Name);

            ActionResponseBase result = new ActionResponseBase();

            try
            {
                Program.Core.Documents.DeleteById(session, action.SchemaName, action.ObjectId);
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return(result);
        }
コード例 #16
0
ファイル: IndexesController.cs プロジェクト: NTDLS/LeafSQL
        public ActionResponseIndexes List([FromBody] ActionGenericBase action)
        {
            var session = Program.Core.Sessions.GetSession(action.SessionId);

            Thread.CurrentThread.Name = $"API:{session.InstanceKey}:{Utility.GetCurrentMethod()}";
            Program.Core.Log.Trace(Thread.CurrentThread.Name);

            var result = new ActionResponseIndexes();

            try
            {
                result.List    = Program.Core.Indexes.List(session, action.SchemaName);
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return(result);
        }