public void UploadResource(string sessionId, Stream data, string fileName) { try { var uriPath = $"ProjectImportSession/{sessionId}/resource"; m_client.PostStreamAsForm <object>(uriPath, data, fileName); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public List <string> GetPublisherAutoComplete(string query) { try { var publishers = m_client.Get <List <string> >($"metadata/publisher/autocomplete?query={query}"); return(publishers); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public long CreateSnapshot(CreateSnapshotContract createSnapshotContract) { try { var snapshotId = m_client.Post <long>($"{BasePath}", createSnapshotContract); return(snapshotId); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public PagedResultList <SpecialPermissionContract> GetPermissions(int start, int count, string query) { try { var url = "permission".AddQueryString("start", start.ToString()); url = url.AddQueryString("count", count.ToString()); url = url.AddQueryString("filterByName", query); var result = m_client.GetPagedList <SpecialPermissionContract>(url); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public PagedResultList <NewsSyndicationItemContract> GetNewsSyndicationItems(int start, int count, NewsTypeEnumContract?itemType, PortalTypeContract portalType) { try { var url = UrlQueryBuilder.Create("news") .AddParameter("start", start) .AddParameter("count", count) .AddParameter("itemType", itemType) .AddParameter("portalType", portalType) .ToResult(); var result = m_client.GetPagedList <NewsSyndicationItemContract>(url); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public List <TermCategoryDetailContract> GetTermCategoriesWithTerms() { try { var result = m_client.Get <List <TermCategoryDetailContract> >("term/category/detail"); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public PagedResultList <FilteringExpressionSetDetailContract> GetFilteringExpressionSetList(int start, int count, bool fetchPageCount = false) { try { var result = m_client.GetPagedList <FilteringExpressionSetDetailContract>( $"bibliography/filtering-expression-set?start={start}&count={count}&fetchPageCount={fetchPageCount}"); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public List <CardFileContract> GetCardFiles() { try { var result = m_client.Get <List <CardFileContract> >("cardfile"); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public long CreateFeedback(CreateFeedbackContract data) { try { var result = m_client.Post <long>("feedback", data); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public int CreateNewUser(CreateUserContract data) { try { //EnsureSecuredClient(); var result = m_client.Post <int>("user", data); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public IList <ExternalRepositoryContract> GetAllExternalRepositories() { try { var result = m_client.Get <IList <ExternalRepositoryContract> >($"bibliography/repository/all"); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public PagedResultList <UserContract> GetUsersByGroup(int groupId, int start, int count, string query) { try { var url = UrlQueryBuilder.Create($"usergroup/{groupId}/user") .AddParameter("start", start) .AddParameter("count", count) .AddParameter("filterByName", query) .ToResult(); var result = m_client.GetPagedList <UserContract>(url); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public PagedResultList <ProjectDetailContract> GetProjectList(int start, int count, ProjectTypeContract projectType, ProjectOwnerTypeContract projectOwnerType = ProjectOwnerTypeContract.AllProjects, string filterByName = null, bool fetchPageCount = false, bool fetchLatestChangedResource = false, bool fetchPermissions = false) { try { var url = UrlQueryBuilder.Create("project") .AddParameter("start", start) .AddParameter("count", count) .AddParameter("projectType", projectType) .AddParameter("projectOwnerType", projectOwnerType) .AddParameter("filterByName", filterByName) .AddParameter("fetchPageCount", fetchPageCount) .AddParameter("fetchLatestChangedResource", fetchLatestChangedResource) .AddParameter("fetchPermissions", fetchPermissions) .ToResult(); var result = m_client.GetPagedList <ProjectDetailContract>(url); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public List <FavoriteLabelContract> GetFavoriteLabelList(int?count = null) { try { var result = m_client.Get <List <FavoriteLabelContract> >(UrlQueryBuilder.Create("favorite/label").AddParameter("count", count) .ToResult()); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public int CreateCategory(CategoryContract category) { try { var resultId = m_client.Post <int>("category", category); return(resultId); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public List <PageContract> SearchPage(long projectId, SearchPageRequestContract request) { try { var result = m_client.Post <List <PageContract> >($"book/{projectId}/page/search", request); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }