/// <summary> /// Lists all links with details. Please note, that if the user executing this method is not an admin, /// then only links created by the user will be listed /// </summary> /// <param name="path">Optional. List links to a file or folder specified by its full path</param> /// <param name="userName">Optional. List links created by this user</param> /// <param name="createdBefore">Optional. List links created before a given date /// (ISO-8601 e.g., 2017-03-05T14:55:59+0000).</param> /// <param name="createdAfter">Optional. List links created after a given date /// (ISO-8601 e.g., 2017-03-05T14:55:59+0000).</param> /// <param name="linkType">Optional. List links that are "file" or "folder"</param> /// <param name="accessibility">Optional. Filter to links whose accessiblity is "anyone," /// "password," "domain," or "recipients"</param> /// <param name="offset">Optional. The 0-based index of the initial record being requested</param> /// <param name="count">Limit number of entries per page. /// By default the max count of 500 entries is returned.</param> /// <returns></returns> public async Task <LinksListV2> ListLinksV2( string path = null, string userName = null, DateTime?createdBefore = null, DateTime?createdAfter = null, LinkType?linkType = null, LinkAccessibility?accessibility = null, int?offset = null, int?count = null) { var httpRequest = new HttpRequestMessage( HttpMethod.Get, ListLinksRequestUri( LinkMethodV2, path, userName, createdBefore, createdAfter, linkType, accessibility, offset, count)); var serviceHandler = new ServiceHandler <LinksListV2Response>(httpClient); var response = await serviceHandler.SendRequestAsync(httpRequest).ConfigureAwait(false); return(LinksHelper.MapLinksListResponse(response.Data)); }
/// <summary> /// Gets the details of a link /// </summary> /// <param name="linkId">Required. Link id, retrieved earlier from Egnyte</param> /// <returns>Details of the link</returns> public async Task <LinkDetails> GetLinkDetails(string linkId) { if (string.IsNullOrWhiteSpace(linkId)) { throw new ArgumentNullException(nameof(linkId)); } var uriBuilder = BuildUri(LinkMethod + "/" + linkId); var httpRequest = new HttpRequestMessage(HttpMethod.Get, uriBuilder.Uri); var serviceHandler = new ServiceHandler <LinkDetailsResponse>(httpClient); var response = await serviceHandler.SendRequestAsync(httpRequest).ConfigureAwait(false); return(LinksHelper.MapGetLinkDetailsResponse(response.Data)); }
/// <summary> /// Creates link /// </summary> /// <param name="link">Parameters</param> /// <returns>Created link details</returns> public async Task <CreatedLink> CreateLink(NewLink link) { ThrowExceptionsIfNewLinkIsInvalid(link); if (!link.Path.StartsWith("/", StringComparison.Ordinal)) { link.Path = "/" + link.Path; } var uriBuilder = BuildUri(LinkMethod); var httpRequest = new HttpRequestMessage(HttpMethod.Post, uriBuilder.Uri) { Content = new StringContent(MapLinkForRequest(link), Encoding.UTF8, "application/json") }; var serviceHandler = new ServiceHandler <CreatedLinkResponse>(httpClient); var response = await serviceHandler.SendRequestAsync(httpRequest).ConfigureAwait(false); return(LinksHelper.MapFlatCreatedLinkToCreatedLink(response.Data)); }