/// <summary> /// Creates a web link object within a given folder. /// </summary> /// <param name="createWebLinkRequest">BoxWebLinkRequest object</param> /// <returns>The web link object is returned.</returns> public async Task<BoxWebLink> CreateWebLinkAsync(BoxWebLinkRequest createWebLinkRequest) { createWebLinkRequest.ThrowIfNull("createWebLinkRequest") .Parent.ThrowIfNull("createWebLinkRequest.Parent") .Id.ThrowIfNullOrWhiteSpace("createWebLinkRequest.Parent.Id"); BoxRequest request = new BoxRequest(_config.WebLinksEndpointUri) .Method(RequestMethod.Post) .Payload(_converter.Serialize(createWebLinkRequest)); IBoxResponse<BoxWebLink> response = await ToResponseAsync<BoxWebLink>(request).ConfigureAwait(false); return response.ResponseObject; }
/// <summary> /// Updates information for a web link. /// </summary> /// <param name="webLinkId">Id of the weblink.</param> /// <param name="updateWebLinkRequest">BoxWebLinkRequest object</param> /// <returns>An updated web link object if the update was successful.</returns> public async Task<BoxWebLink> UpdateWebLinkAsync(string webLinkId, BoxWebLinkRequest updateWebLinkRequest) { webLinkId.ThrowIfNullOrWhiteSpace("webLinkId"); updateWebLinkRequest.ThrowIfNull("updateWebLinkRequest"); BoxRequest request = new BoxRequest(_config.WebLinksEndpointUri, webLinkId) .Method(RequestMethod.Put) .Payload(_converter.Serialize(updateWebLinkRequest)); IBoxResponse<BoxWebLink> response = await ToResponseAsync<BoxWebLink>(request).ConfigureAwait(false); return response.ResponseObject; }