/// <summary> /// Create a new Legal Hold Policy. Optional date filter may be passed. /// If Policy has a date filter, any Custodian assignments will apply only to file versions created or uploaded inside of the date range. /// (Other assignment types, such as folders and files, will ignore the date filter). /// </summary> /// <param name="createRequest">BoxLegalHoldPolicyRequest object.</param> /// <returns>For a successful request, returns information about the Legal Hold Policy created. /// If the Policy Name is in use for your enterprise, will return null. /// </returns> public async Task<BoxLegalHoldPolicy> CreateLegalHoldPolicyAsync(BoxLegalHoldPolicyRequest createRequest) { createRequest.ThrowIfNull("createRequest") .PolicyName.ThrowIfNull("createRequest.PolicyName"); BoxRequest request = new BoxRequest(_config.LegalHoldPoliciesEndpointUri) .Method(RequestMethod.Post) .Payload(_converter.Serialize(createRequest)); IBoxResponse<BoxLegalHoldPolicy> response = await ToResponseAsync<BoxLegalHoldPolicy>(request).ConfigureAwait(false); return response.ResponseObject; }
/// <summary> /// Update existing Legal Hold Policy. Only name and description can be modified. /// </summary> /// <param name="legalHoldPolicyId">Id of the legal hold policy.</param> /// <param name="updateRequest">BoxLegalHoldPolicyRequest object.</param> /// <returns>Returns information about the Legal Hold Policy updated.</returns> public async Task<BoxLegalHoldPolicy> UpdateLegalHoldPolicyAsync(string legalHoldPolicyId, BoxLegalHoldPolicyRequest updateRequest) { legalHoldPolicyId.ThrowIfNull("legalHoldPolicyId"); updateRequest.ThrowIfNull("updateRequest"); BoxRequest request = new BoxRequest(_config.LegalHoldPoliciesEndpointUri, legalHoldPolicyId) .Method(RequestMethod.Put) .Payload(_converter.Serialize(updateRequest)); IBoxResponse<BoxLegalHoldPolicy> response = await ToResponseAsync<BoxLegalHoldPolicy>(request).ConfigureAwait(false); return response.ResponseObject; }