001/* 002 * Copyright 2020 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.redact; 017 018 019import com.vonage.client.*; 020 021/** 022 * A client for talking to the Vonage Redact API. The standard way to obtain an instance of this class is to use {@link 023 * VonageClient#getRedactClient()}. 024 */ 025public class RedactClient extends AbstractClient { 026 private RedactEndpoint redactEndpoint; 027 028 public RedactClient(HttpWrapper httpWrapper) { 029 super(httpWrapper); 030 031 this.redactEndpoint = new RedactEndpoint(httpWrapper); 032 } 033 034 /** 035 * Submit a request to the Redact API to redact a transaction. 036 * 037 * @param id The transaction id to redact. 038 * @param product The {@link RedactRequest.Product} which corresponds to the transaction. 039 * 040 * @throws VonageClientException if there was a problem with the Vonage request or response objects. 041 * @throws VonageResponseParseException if the response from the API could not be parsed. 042 */ 043 public void redactTransaction(String id, RedactRequest.Product product) throws VonageResponseParseException, VonageClientException { 044 this.redactTransaction(new RedactRequest(id, product)); 045 } 046 047 /** 048 * Submit a request to the Redact API to redact a transaction. 049 * 050 * @param id The transaction id to redact. 051 * @param product The {@link RedactRequest.Product} which corresponds to the transaction. 052 * @param type The {@link RedactRequest.Type} which is required if redacting SMS data. 053 * 054 * @throws VonageClientException if there was a problem with the Vonage request or response objects. 055 * @throws VonageResponseParseException if the response from the API could not be parsed. 056 */ 057 public void redactTransaction(String id, RedactRequest.Product product, RedactRequest.Type type) throws VonageResponseParseException, VonageClientException { 058 RedactRequest request = new RedactRequest(id, product); 059 request.setType(type); 060 061 this.redactTransaction(request); 062 } 063 064 /** 065 * Submit a request to the Redact API to redact a transaction. 066 * 067 * @param redactRequest a {@link RedactRequest} object which contains the request parameters. 068 * 069 * @throws VonageClientException if there was a problem with the Vonage request or response objects. 070 * @throws VonageResponseParseException if the response from the API could not be parsed. 071 */ 072 public void redactTransaction(RedactRequest redactRequest) throws VonageResponseParseException, VonageClientException { 073 this.redactEndpoint.redactTransaction(redactRequest); 074 } 075}