public Uri GenerateRequestUrl(Type type, List <string> queryList, int start = 0, int limit = 10)
        {
            string metaTypeName = GetMetaTypeName(type);

            var ftsQueryRequest = new FTSQueryRequest
            {
                Statements = new List <Statement>()
                {
                    new Statement {
                        Query = "*"
                    }
                },
                Start = start,
                Limit = limit
            };

            foreach (var query in queryList)
            {
                ftsQueryRequest.Statements.Add(new Statement {
                    Query = query
                });
            }

            var ftsQueryRequestString = JsonConvert.SerializeObject(ftsQueryRequest);

            var uri = FTSSearchTemplate.BindByName(BaseAddress,
                                                   new Dictionary <string, string>()
            {
                { "metaType", metaTypeName },
                { "query", ftsQueryRequestString }
            });

            return(uri);
        }
        public Uri GenerateRequestUrl(Type type, string query = "*", int start = 0, int limit = 10)
        {
            string metaTypeName    = GetMetaTypeName(type);
            var    ftsQueryRequest = new FTSQueryRequest
            {
                Statements = new List <Statement>
                {
                    new Statement {
                        Query = query
                    }
                },
                Start = start,
                Limit = limit
            };

            var ftsQueryRequestString = JsonConvert.SerializeObject(ftsQueryRequest);

            if (query.Contains(","))
            {
                string[] s        = query.Split(',');
                string   newQuery = "\"},{\"query\":\"";
                ftsQueryRequestString = ftsQueryRequestString.Replace($",{s[1]}", $"{newQuery}{s[1]}");
            }

            var uri = FTSSearchTemplate.BindByName(BaseAddress,
                                                   new Dictionary <string, string>()
            {
                { "metaType", metaTypeName },
                { "query", ftsQueryRequestString }
            });

            return(uri);
        }
Esempio n. 3
0
        public Uri GenerateRequestUrl(Type type, List <string> stringQueries, int start = 0, int limit = 10)
        {
            string metaTypeName = GetMetaTypeName(type);
            var    queries      = new List <Query>();

            foreach (var sq in stringQueries)
            {
                var q = new Query {
                    Value = sq
                };
                queries.Add(q);
            }

            var ftsQueryRequest = new FTSQueryRequest
            {
                Statements = new List <Query>(queries),
                Start      = start,
                Limit      = limit
            };

            var ftsQueryRequestString = JsonConvert.SerializeObject(ftsQueryRequest);

            var uri = FTSSearchTemplate.BindByName(BaseAddress,
                                                   new Dictionary <string, string>()
            {
                { "metaType", metaTypeName },
                { "query", ftsQueryRequestString }
            });

            return(uri);
        }
Esempio n. 4
0
        public Uri GenerateRequestUrl(Type type, string query = "*", int start = 0, int limit = 10)
        {
            string metaTypeName = GetMetaTypeName(type);

            var ftsQueryRequest = new FTSQueryRequest
            {
                Statements = new List <Query>
                {
                    new Query {
                        Value = query
                    }
                },
                Start = start,
                Limit = limit
            };

            var ftsQueryRequestString = JsonConvert.SerializeObject(ftsQueryRequest);

            var uri = FTSSearchTemplate.BindByName(BaseAddress,
                                                   new Dictionary <string, string>()
            {
                { "metaType", metaTypeName },
                { "query", ftsQueryRequestString }
            });

            return(uri);
        }
        public Uri GenerateRequestUrl(Type type, string[] query = null, int start = 0, int limit = 10)
        {
            if (query == null)
            {
                query = new[] { "*" };
            }
            string metaTypeName = GetMetaTypeName(type);

            var ftsQueryRequest = new FTSQueryRequest
            {
                Statements = new List <Statement>(
                    query.Select(q => new Statement
                {
                    Query = q
                })),
                Start = start,
                Limit = limit
            };

            var ftsQueryRequestString = JsonConvert.SerializeObject(ftsQueryRequest);

            var uri = FTSSearchTemplate.BindByName(BaseAddress,
                                                   new Dictionary <string, string>()
            {
                { "metaType", metaTypeName },
                { "query", ftsQueryRequestString }
            });

            return(uri);
        }
        public Uri GenerateRequestUrl(Type type, IList <string> queries, int start = 0, int limit = 10)
        {
            string metaTypeName = GetMetaTypeName(type);

            var ftsQueryRequest = new FTSQueryRequest
            {
                Statements = queries.Select(q => new Statement()
                {
                    Query = q
                }).ToList(),
                Start = start,
                Limit = limit
            };

            var ftsQueryRequestString = JsonConvert.SerializeObject(ftsQueryRequest);

            var uri = FTSSearchTemplate.BindByName(BaseAddress,
                                                   new Dictionary <string, string>()
            {
                { "metaType", metaTypeName },
                { "query", ftsQueryRequestString }
            });

            return(uri);
        }