internal GetMessagesController(
     GetAllMessagesApi getAllMessagesApi,
     GetAllMessagesForEndpointApi getAllMessagesForEndpointApi,
     GetBodyByIdApi getBodyByIdApi,
     SearchApi searchApi,
     SearchEndpointApi searchEndpointApi)
 {
     this.getAllMessagesForEndpointApi = getAllMessagesForEndpointApi;
     this.getAllMessagesApi            = getAllMessagesApi;
     this.getBodyByIdApi    = getBodyByIdApi;
     this.searchEndpointApi = searchEndpointApi;
     this.searchApi         = searchApi;
 }
Exemplo n.º 2
0
        public GetMessagesByQuery()
        {
            Get["/messages/search", true] = (_, token) =>
            {
                string keyword = Request.Query.q;

                return(SearchApi.Execute(this, keyword));
            };

            Get["/messages/search/{keyword*}", true] = (parameters, token) =>
            {
                string keyword = parameters.keyword;
                keyword = keyword?.Replace("/", @"\");

                return(SearchApi.Execute(this, keyword));
            };

            Get["/endpoints/{name}/messages/search", true] = (parameters, token) =>
            {
                var input = new SearchEndpointApi.Input
                {
                    Endpoint = parameters.name,
                    Keyword  = Request.Query.q
                };

                return(SearchEndpointApi.Execute(this, input));
            };

            Get["/endpoints/{name}/messages/search/{keyword}", true] = (parameters, token) =>
            {
                var input = new SearchEndpointApi.Input
                {
                    Endpoint = parameters.name,
                    Keyword  = parameters.keyword
                };

                return(SearchEndpointApi.Execute(this, input));
            };
        }
Exemplo n.º 3
0
 internal GetMessagesByQueryController(SearchApi searchApi, SearchEndpointApi searchEndpointApi)
 {
     this.searchEndpointApi = searchEndpointApi;
     this.searchApi         = searchApi;
 }