All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vendasta.accountgroup.v1.internal.ListPotentialDuplicatesRequest Maven / Gradle / Ivy

The newest version!
package com.vendasta.accountgroup.v1.internal;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
import java.util.Arrays;
import java.time.Duration;
import org.apache.commons.lang3.StringUtils;
import com.vendasta.accountgroup.v1.generated.ApiProto;

/**
 * ListPotentialDuplicatesRequest allows listing potential duplicates scoped to a partner by an existing account group,
 *  or by location data. For more info, see the ListPotentialDuplicates RPC comment.
 **/
public final class ListPotentialDuplicatesRequest {




	private final String partnerId;
	private final String accountGroupId;
	private final AccountGroupLocation location;
	private final String cursor;
	private final long pageSize;
	private final String marketId;
	

	private ListPotentialDuplicatesRequest (
		final String partnerId,
		final String accountGroupId,
		final AccountGroupLocation location,
		final String cursor,
		final long pageSize,
		final String marketId)
		
	{
		this.partnerId = partnerId;
		this.accountGroupId = accountGroupId;
		this.location = location;
		this.cursor = cursor;
		this.pageSize = pageSize;
		this.marketId = marketId;
		
	}
	
	/**
	 * 
      * @return The final value of partnerId on the object
	 **/
	public String getPartnerId() {
		return this.partnerId;
	}
	
	/**
	 * 
      * @return The final value of accountGroupId on the object
	 **/
	public String getAccountGroupId() {
		return this.accountGroupId;
	}
	
	/**
	 * 
      * @return The final value of location on the object
	 **/
	public AccountGroupLocation getLocation() {
		return this.location;
	}
	
	/**
	 * 
      * @return The final value of cursor on the object
	 **/
	public String getCursor() {
		return this.cursor;
	}
	
	/**
	 * 
      * @return The final value of pageSize on the object
	 **/
	public long getPageSize() {
		return this.pageSize;
	}
	
	/**
	 * 
      * @return The final value of marketId on the object
	 **/
	public String getMarketId() {
		return this.marketId;
	}
	

	public static class Builder {
		private String partnerId;
		private String accountGroupId;
		private AccountGroupLocation location;
		private String cursor;
		private long pageSize;
		private String marketId;
		
		public Builder() {
			this.partnerId = "";
			this.accountGroupId = "";
			this.location = null;
			this.cursor = "";
			this.pageSize = 0;
			this.marketId = "";
			
		}
		
		/**
		  * Adds a value to the builder for partnerId
		  * @param partnerId Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setPartnerId(String partnerId) {
			this.partnerId = partnerId;
			return this;
		}
		
		/**
		  * Adds a value to the builder for accountGroupId
		  * @param accountGroupId Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setAccountGroupId(String accountGroupId) {
			this.accountGroupId = accountGroupId;
			return this;
		}
		
		/**
		  * Adds a value to the builder for location
		  * @param location Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setLocation(AccountGroupLocation location) {
			this.location = location;
			return this;
		}
		
		/**
		  * Adds a value to the builder for cursor
		  * @param cursor Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setCursor(String cursor) {
			this.cursor = cursor;
			return this;
		}
		
		/**
		  * Adds a value to the builder for pageSize
		  * @param pageSize Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setPageSize(long pageSize) {
			this.pageSize = pageSize;
			return this;
		}
		
		/**
		  * Adds a value to the builder for marketId
		  * @param marketId Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setMarketId(String marketId) {
			this.marketId = marketId;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the ListPotentialDuplicatesRequest class
		  * @return The instantiated final ListPotentialDuplicatesRequest
		 **/
		public ListPotentialDuplicatesRequest build() {
			return new ListPotentialDuplicatesRequest(
				this.partnerId,
				this.accountGroupId,
				this.location,
				this.cursor,
				this.pageSize,
				this.marketId);
		}
	}

	/**
	 * Returns a Builder for ListPotentialDuplicatesRequest, which is a mutable representation of the object.  Once the
	 * client has built up an object they can then create an immutable ListPotentialDuplicatesRequest object using the
	 * build function.
	 * @return A fresh Builder instance with no values set
	 **/
	public static Builder newBuilder() {
		return new Builder();
	}

	/**
	 * Provides a human-readable representation of this object.  Useful for debugging.
	 * @return A string representation of the ListPotentialDuplicatesRequest instance
	 **/
	 public String toString() {
		 String result = "ListPotentialDuplicatesRequest\n";
		 result += "-> partnerId: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.partnerId).split("\n"))) + "\n"; 
		 result += "-> accountGroupId: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.accountGroupId).split("\n"))) + "\n"; 
		 result += "-> location: (AccountGroupLocation)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.location).split("\n"))) + "\n"; 
		 result += "-> cursor: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.cursor).split("\n"))) + "\n"; 
		 result += "-> pageSize: (long)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.pageSize).split("\n"))) + "\n"; 
		 result += "-> marketId: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.marketId).split("\n"))) + "\n"; 
		 
		 return result;
	 }
	/**
	* Allows for simple conversion between the low-level generated protobuf object to
	* ListPotentialDuplicatesRequest, which is much more usable.
	* @return An instance of ListPotentialDuplicatesRequest representing the input proto object
	**/
	public static ListPotentialDuplicatesRequest fromProto(ApiProto.ListPotentialDuplicatesRequest proto) {
		ListPotentialDuplicatesRequest out = null;
		if (proto != null) {
			ListPotentialDuplicatesRequest.Builder outBuilder = ListPotentialDuplicatesRequest.newBuilder()
			.setPartnerId(proto.getPartnerId())
			.setAccountGroupId(proto.getAccountGroupId())
			.setLocation(AccountGroupLocation.fromProto(proto.getLocation()))
			.setCursor(proto.getCursor())
			.setPageSize(proto.getPageSize())
			.setMarketId(proto.getMarketId());
			out = outBuilder.build();
		}
		return out;
	}

	/**
	* Convenience method for handling lists of proto objects.  It calls .fromProto on each one
	* and returns a list of the converted results.
	* @return A list of ListPotentialDuplicatesRequest instances representing the input proto objects
	**/
	public static List fromProtos(List protos) {
		List out = new ArrayList();
		for(ApiProto.ListPotentialDuplicatesRequest proto : protos) {
			out.add(ListPotentialDuplicatesRequest.fromProto(proto));
		}
		return out;
	}

	/**
	 * Allows for simple conversion of an object to the low-level generated protobuf object.
	 * @return An instance of ApiProto.ListPotentialDuplicatesRequest which is a proto object ready for wire transmission
	 **/
	 public ApiProto.ListPotentialDuplicatesRequest toProto() {
		 ListPotentialDuplicatesRequest obj = this;
		 ApiProto.ListPotentialDuplicatesRequest.Builder outBuilder = ApiProto.ListPotentialDuplicatesRequest.newBuilder();
		 outBuilder.setPartnerId(obj.getPartnerId());
		 outBuilder.setAccountGroupId(obj.getAccountGroupId());
		 if(obj.getLocation() != null){outBuilder.setLocation(obj.getLocation().toProto());}
		 outBuilder.setCursor(obj.getCursor());
		 outBuilder.setPageSize(obj.getPageSize());
		 outBuilder.setMarketId(obj.getMarketId());
		 return outBuilder.build();
	 }

	 /**
	  * Convenience method for handling lists of objects.  It calls .toProto on each one and
	  * returns a list of the converted results.
	  * @return A list of ApiProto.ListPotentialDuplicatesRequest instances representing the input objects.
	  */
	public static List toProtos(List objects) {
		List out = new ArrayList();
		if(objects != null) {
			for (ListPotentialDuplicatesRequest obj : objects) {
				out.add(obj!=null?obj.toProto():null);
			}
		}
		return out;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy