Exemplo n.º 1
0
        /// <summary>
        ///     Initializes the project.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        public void InitializeProject(string projectName, Position start, Position end)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/project"
            };
            var request = new NewProjectRequest(projectName, start.ToString(), end.ToString());

            HttpFacade.PostJsonAsync(ub.Uri, request, null).GetAwaiter().GetResult();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Upserts the frames.
        /// </summary>
        /// <param name="frames">The frames.</param>
        /// <returns>Task.</returns>
        public void UpsertFrames(IEnumerable <Frame> frames)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/frame"
            };
            var headers = new HttpHeaders
            {
                ["X-Project-Name"] = Settings.ProjectName
            };

            HttpFacade.PostJsonAsync(ub.Uri, frames, headers).GetAwaiter().GetResult();
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Adds the tag.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="threadIds">The thread ids.</param>
        /// <param name="text">The text.</param>
        public void AddTag(Position position, IEnumerable <int> threadIds, string text)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/tag"
            };
            var addNoteRequest = new AddTagRequest(position, threadIds, text);
            var headers        = new HttpHeaders
            {
                ["X-Project-Name"] = Settings.ProjectName
            };

            HttpFacade.PostJsonAsync(ub.Uri, addNoteRequest, headers).GetAwaiter().GetResult();
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public void AddMemoryRange(MemoryChunk memoryChunk)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/memory"
            };
            var addMemoryRequest = new AddMemoryRequest(memoryChunk);
            var headers          = new HttpHeaders
            {
                ["X-Project-Name"] = Settings.ProjectName
            };

            HttpFacade.PostJsonAsync(ub.Uri, addMemoryRequest, headers).GetAwaiter().GetResult();
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Searches the frames.
        /// </summary>
        /// <param name="converted">The converted.</param>
        /// <returns>IEnumerable&lt;Frame&gt;.</returns>
        public IEnumerable <Frame> SearchFrames(SearchCriterionDto converted)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/search/frame"
            };
            var res = HttpFacade.PostJsonAsync(ub.Uri, converted, new HttpHeaders
            {
                ["X-Project-Name"] = Settings.ProjectName
            });
            var json      = res.Result.Content.ReadAsStringAsync().Result; // todo: 500's
            var returnVal = JsonConvert.DeserializeObject <IEnumerable <Frame> >(json);

            return(returnVal);
        }
Exemplo n.º 6
0
        /// <inheritdoc />
        public IEnumerable <Tag> GetRecentTags(int numTags)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/tag"
            };
            var request = new RecentTagsRequest(10);
            var headers = new HttpHeaders
            {
                ["X-Project-Name"] = Settings.ProjectName
            };
            var result = HttpFacade.PostJsonAsync(ub.Uri, request, headers).GetAwaiter().GetResult();
            var json   = result.Content.ReadAsStringAsync().GetAwaiter().GetResult();

            return(JsonConvert.DeserializeObject <IEnumerable <Tag> >(json));
        }