Esempio n. 1
0
        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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 5
0
        public void Drop(string schema)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                SchemaName = schema
            };

            Submit <ActionGenericBase, ActionResponseBase>("api/Schema/Drop", action);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 12
0
        public void DeleteLoginByName(string username)
        {
            var action = new ActionGenericBase(client.Token.SessionId)
            {
                ObjectName = username
            };

            Submit <ActionGenericBase, ActionResponseId>
                ("api/Security/DeleteLoginByName", action);
        }
Esempio n. 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);
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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);
        }