001/* 002 * Copyright (c) 2011-2018 Nexmo Inc 003 * 004 * Permission is hereby granted, free of charge, to any person obtaining a copy 005 * of this software and associated documentation files (the "Software"), to deal 006 * in the Software without restriction, including without limitation the rights 007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 008 * copies of the Software, and to permit persons to whom the Software is 009 * furnished to do so, subject to the following conditions: 010 * 011 * The above copyright notice and this permission notice shall be included in 012 * all copies or substantial portions of the Software. 013 * 014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 020 * THE SOFTWARE. 021 */ 022package com.nexmo.client.redact; 023 024import com.nexmo.client.*; 025 026/** 027 * A client for talking to the Nexmo Redact API. The standard way to obtain an instance of this class is to use {@link 028 * NexmoClient#getRedactClient()}. 029 */ 030public class RedactClient extends AbstractClient { 031 private RedactEndpoint redactEndpoint; 032 033 public RedactClient(HttpWrapper httpWrapper) { 034 super(httpWrapper); 035 036 this.redactEndpoint = new RedactEndpoint(httpWrapper); 037 } 038 039 /** 040 * Submit a request to the Redact API to redact a transaction. 041 * 042 * @param id The transaction id to redact. 043 * @param product The {@link com.nexmo.client.redact.RedactRequest.Product} which corresponds to the transaction. 044 * 045 * @throws NexmoClientException if there was a problem with the Nexmo request or response objects. 046 * @throws NexmoResponseParseException if the response from the API could not be parsed. 047 */ 048 public void redactTransaction(String id, RedactRequest.Product product) throws NexmoResponseParseException, NexmoClientException { 049 this.redactTransaction(new RedactRequest(id, product)); 050 } 051 052 /** 053 * Submit a request to the Redact API to redact a transaction. 054 * 055 * @param id The transaction id to redact. 056 * @param product The {@link com.nexmo.client.redact.RedactRequest.Product} which corresponds to the transaction. 057 * @param type The {@link com.nexmo.client.redact.RedactRequest.Type} which is required if redacting SMS data. 058 * 059 * @throws NexmoClientException if there was a problem with the Nexmo request or response objects. 060 * @throws NexmoResponseParseException if the response from the API could not be parsed. 061 */ 062 public void redactTransaction(String id, RedactRequest.Product product, RedactRequest.Type type) throws NexmoResponseParseException, NexmoClientException { 063 RedactRequest request = new RedactRequest(id, product); 064 request.setType(type); 065 066 this.redactTransaction(request); 067 } 068 069 /** 070 * Submit a request to the Redact API to redact a transaction. 071 * 072 * @param redactRequest a {@link RedactRequest} object which contains the request parameters. 073 * 074 * @throws NexmoClientException if there was a problem with the Nexmo request or response objects. 075 * @throws NexmoResponseParseException if the response from the API could not be parsed. 076 */ 077 public void redactTransaction(RedactRequest redactRequest) throws NexmoResponseParseException, NexmoClientException { 078 this.redactEndpoint.redactTransaction(redactRequest); 079 } 080}