/// <summary> /// Retrieve information about metadata packages, properties and tags. /// </summary> /// <param name="request">Request. <see cref="TagsRequest" /></param> /// <returns><see cref="TagsResult"/></returns> public TagsResult Tags(TagsRequest request) { // verify the required parameter 'options' is set if (request.options == null) { throw new ApiException(400, "Missing required parameter 'options' when calling Tags"); } // create path and map variables var resourcePath = this.configuration.GetServerUrl() + "/metadata/tags"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); var postBody = SerializationHelper.Serialize(request.options); // http body (model) parameter var response = this.apiInvoker.InvokeApi( resourcePath, "POST", postBody, null, null); if (response != null) { return((TagsResult)SerializationHelper.Deserialize(response, typeof(TagsResult))); } return(null); }
public async Task <ActionResult <TagsResult> > Tags([FromBody] TagsRequest request) { if (!await _authManager.HasSitePermissionsAsync(request.SiteId, MenuUtils.SitePermissions.Contents) || !await _authManager.HasContentPermissionsAsync(request.SiteId, request.ChannelId, MenuUtils.ContentPermissions.Add, MenuUtils.ContentPermissions.Edit)) { return(Unauthorized()); } var site = await _siteRepository.GetAsync(request.SiteId); if (site == null) { return(NotFound()); } var spliter = new WordSpliter(_contentTagRepository); var tags = await spliter.GetKeywordsAsync(request.Content, request.SiteId, 10); return(new TagsResult { Tags = tags }); }
public ActionResult Edit(int id) { ViewBag.Retards_Tags = new SelectList(TagsRequest.GetTags(), "id", "libelle"); //ViewBag.Eleve = new SelectList(EleveRequest.GetEleves(), "id", "pseudo"); CreateRetardsVM retard = new CreateRetardsVM(RetardRequest.getRetard(id)); return(View(retard)); }
/// <summary> /// Provides a listing of all tags on a user account /// </summary> /// <param name="request"><see cref="TagsRequest"/></param> /// <returns>List of Tags</returns> public async Task <List <Tag> > GetTagsAsync(TagsRequest request = null) { if (request == null) { return(await GetAsync <List <Tag> >(TagsResource)); } return(await GetAsync <List <Tag> >(TagsResource, request.CreateParameters())); }
public ActionResult Create(Tags tags) { if (ModelState.IsValid) { TagsRequest.Create(tags); return RedirectToAction("Index", "Home"); } return View(); }
/// <summary> /// Provides a listing of all tags on a user account /// </summary> /// <param name="request"><see cref="TagsRequest"/></param> /// <returns>List of Tags</returns> public async Task <List <Tag> > GetTagsAsync(TagsRequest request = null) { const string path = "tag/"; if (request == null) { return(await GetAsync <List <Tag> >(path)); } return(await GetAsync <List <Tag> >(path, request.CreateParameters())); }
private ActionResult GetTagsView(TagsRequest request) { var tags = FeedService.GetTags(request); return(View("Tags", new TagsVM { CurrentUser = CurrentUser, Request = request, Tags = tags })); }
public void Tags_UnsupportedFormat() { var testFile = TestFiles.Json; var options = new TagsOptions { FileInfo = testFile.ToFileInfo() }; var request = new TagsRequest(options); var ex = Assert.Throws <ApiException>(() => { InfoApi.Tags(request); }); Assert.AreEqual($"The specified file '{testFile.FullName}' has type which is not currently supported.", ex.Message); }
public void Tags_DocumentProtectedException() { var testFile = TestFiles.PasswordProtected; var options = new TagsOptions { FileInfo = testFile.ToFileInfo(), }; var request = new TagsRequest(options); var ex = Assert.Throws <ApiException>(() => { InfoApi.Tags(request); }); Assert.AreEqual($"The specified file '{testFile.FullName}' is protected.", ex.Message); }
public ActionResult Edit(Retard retard) { if (ModelState.IsValid) { retard.file = Request["fileEnvoie"]; retard.eleve = EleveRequest.GetEleveById(Convert.ToInt64(Request["Eleve"])); RetardRequest.Update(retard); return(RedirectToAction("Index", "Home")); } ViewBag.Retards_Tags = new SelectList(TagsRequest.GetTags(), "id", "libelle"); //ViewBag.Eleve = new SelectList(EleveRequest.GetEleves(), "id", "pseudo"); return(View()); }
public void Tags_FileNotFound() { var testFile = TestFiles.NotExist; var options = new TagsOptions { FileInfo = testFile.ToFileInfo(), }; var request = new TagsRequest(options); var ex = Assert.Throws <ApiException>(() => { InfoApi.Tags(request); }); Assert.AreEqual($"Can't find file located at '{testFile.FullName}'.", ex.Message); }
public void TagsApiTest() { var options = new TagsOptions { FileInfo = TestFiles.Docx.ToFileInfo() }; var request = new TagsRequest(options); var result = InfoApi.Tags(request); Assert.IsNotNull(result.RootPackage); Assert.IsNotEmpty(result.RootPackage.InnerPackages); Assert.IsTrue(result.RootPackage.InnerPackages.Any(x => string.Equals(x.PackageName, "FileFormat"))); Assert.IsTrue(result.RootPackage.InnerPackages.Any(x => x.PackageProperties.First(p => p.Name == "FileFormat").Tags .Select(s => s.Name).Any(e => string.Equals(e, "FileFormat")))); }
public ActionResult Tags(int page = 0, string tab = null, string tag = null) { var request = new TagsRequest(); request.SearchQuery = tag; request.PageSize = PageSize; request.Page = page; switch (tab) { case "name": request.Name = true; break; case "new": request.New = true; break; default: request.Popular = tag.IsNullOrEmpty(); break; } return(GetTagsView(request)); }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new InfoApi(configuration); try { var fileInfo = new FileInfo { FilePath = "documents/input.docx", StorageName = Common.MyStorage }; var options = new TagsOptions { FileInfo = fileInfo }; var request = new TagsRequest(options); // Get tags var response = apiInstance.Tags(request); Console.WriteLine($"Root package: {response.RootPackage.PackageName}"); foreach (var entry in response.RootPackage.InnerPackages[0].PackageProperties) { Console.WriteLine($"{entry.Name}: {entry.Value}"); if (entry.Tags == null) { continue; } foreach (var tag in entry.Tags) { Console.WriteLine($"Tag for property: name - {tag.Name}, category - {tag.Category}"); } } } catch (Exception e) { Console.WriteLine("Exception while calling InfoApi: " + e.Message); } }
public ActionResult GetTags() { var json = GetJson(HttpContext.Request); ValidateJson(json); var user = GetUserCached(json); int page = json["page"].Value <int>() + 1; var request = new TagsRequest(); request._PageSize = 20; request._Page = page; request.Popular = true; var tags = FeedService.GetTags(request); return(Json(new { tags = tags })); }
public ActionResult Create([Bind(Include = "id,titre,description,Retards_Tags,pj")] Retard retard) { if (ModelState.IsValid) { retard.file = Request["fileEnvoie"]; retard.eleve = EleveRequest.GetEleveById(Int32.Parse(User.Identity.Name)); RetardRequest.Create(retard); retard = RetardRequest.getLastRetard(retard); Retards_Tags rt = new Retards_Tags { Id_Retard = retard.id, Id_Tags = Int32.Parse(Request["Retards_Tags"]) }; Tags_RetardRequest.Create(rt); return(RedirectToAction("Index", "Home")); } ViewBag.Retards_Tags = new SelectList(TagsRequest.GetTags(), "id", "libelle"); //ViewBag.Eleve = new SelectList(EleveRequest.GetEleves(), "id", "pseudo"); return(View()); }
public List <Tag> GetTags(TagsRequest request) { return(DataProvider.GetTags(request)); }
public static SetTags ToCommand(this TagsRequest tags, string name) => new SetTags { Name = name, Tags = tags.Tags.EmptyIfNull().NoNulls().ToImmutableArray() };
public ActionResult GetTags() { return(Json(TagsRequest.GetTags(), JsonRequestBehavior.AllowGet)); }
public ActionResult Create() { ViewBag.Retards_Tags = new SelectList(TagsRequest.GetTags(), "id", "libelle"); //ViewBag.Eleve = new SelectList(EleveRequest.GetEleves(), "id", "pseudo"); return(View()); }