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

com.vendasta.accountgroup.v1.internal.ListRequest 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;

/**
 * 
 **/
public final class ListRequest {



	/**
	 * 
	 **/
	public static final class Filters {
	
	
	
	
		private final String partnerId;
		
	
		private Filters (
			final String partnerId)
			
		{
			this.partnerId = partnerId;
			
		}
		
		/**
		 * 
	      * @return The final value of partnerId on the object
		 **/
		public String getPartnerId() {
			return this.partnerId;
		}
		
	
		public static class Builder {
			private String partnerId;
			
			public Builder() {
				this.partnerId = "";
				
			}
			
			/**
			  * 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;
			}
			
			/**
			  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
			  * of the Filters class
			  * @return The instantiated final Filters
			 **/
			public Filters build() {
				return new Filters(
					this.partnerId);
			}
		}
	
		/**
		 * Returns a Builder for Filters, which is a mutable representation of the object.  Once the
		 * client has built up an object they can then create an immutable Filters 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 Filters instance
		 **/
		 public String toString() {
			 String result = "Filters\n";
			 result += "-> partnerId: (String)"
			     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.partnerId).split("\n"))) + "\n"; 
			 
			 return result;
		 }
		/**
		* Allows for simple conversion between the low-level generated protobuf object to
		* Filters, which is much more usable.
		* @return An instance of Filters representing the input proto object
		**/
		public static Filters fromProto(ApiProto.ListRequest.Filters proto) {
			Filters out = null;
			if (proto != null) {
				Filters.Builder outBuilder = Filters.newBuilder()
				.setPartnerId(proto.getPartnerId());
				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 Filters instances representing the input proto objects
		**/
		public static List fromProtos(List protos) {
			List out = new ArrayList();
			for(ApiProto.ListRequest.Filters proto : protos) {
				out.add(Filters.fromProto(proto));
			}
			return out;
		}
	
		/**
		 * Allows for simple conversion of an object to the low-level generated protobuf object.
		 * @return An instance of ApiProto.ListRequest.Filters which is a proto object ready for wire transmission
		 **/
		 public ApiProto.ListRequest.Filters toProto() {
			 Filters obj = this;
			 ApiProto.ListRequest.Filters.Builder outBuilder = ApiProto.ListRequest.Filters.newBuilder();
			 outBuilder.setPartnerId(obj.getPartnerId());
			 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.ListRequest.Filters instances representing the input objects.
		  */
		public static List toProtos(List objects) {
			List out = new ArrayList();
			if(objects != null) {
				for (Filters obj : objects) {
					out.add(obj!=null?obj.toProto():null);
				}
			}
			return out;
		}
	}

	private final ProjectionFilter projectionFilter;
	private final ListRequest.Filters filters;
	private final String cursor;
	private final long pageSize;
	

	private ListRequest (
		final ProjectionFilter projectionFilter,
		final ListRequest.Filters filters,
		final String cursor,
		final long pageSize)
		
	{
		this.projectionFilter = projectionFilter;
		this.filters = filters;
		this.cursor = cursor;
		this.pageSize = pageSize;
		
	}
	
	/**
	 * 
      * @return The final value of projectionFilter on the object
	 **/
	public ProjectionFilter getProjectionFilter() {
		return this.projectionFilter;
	}
	
	/**
	 * 
      * @return The final value of filters on the object
	 **/
	public ListRequest.Filters getFilters() {
		return this.filters;
	}
	
	/**
	 * 
      * @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;
	}
	

	public static class Builder {
		private ProjectionFilter projectionFilter;
		private ListRequest.Filters filters;
		private String cursor;
		private long pageSize;
		
		public Builder() {
			this.projectionFilter = null;
			this.filters = null;
			this.cursor = "";
			this.pageSize = 0;
			
		}
		
		/**
		  * Adds a value to the builder for projectionFilter
		  * @param projectionFilter Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setProjectionFilter(ProjectionFilter projectionFilter) {
			this.projectionFilter = projectionFilter;
			return this;
		}
		
		/**
		  * Adds a value to the builder for filters
		  * @param filters Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setFilters(ListRequest.Filters filters) {
			this.filters = filters;
			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;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the ListRequest class
		  * @return The instantiated final ListRequest
		 **/
		public ListRequest build() {
			return new ListRequest(
				this.projectionFilter,
				this.filters,
				this.cursor,
				this.pageSize);
		}
	}

	/**
	 * Returns a Builder for ListRequest, which is a mutable representation of the object.  Once the
	 * client has built up an object they can then create an immutable ListRequest 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 ListRequest instance
	 **/
	 public String toString() {
		 String result = "ListRequest\n";
		 result += "-> projectionFilter: (ProjectionFilter)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.projectionFilter).split("\n"))) + "\n"; 
		 result += "-> filters: (ListRequest.Filters)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.filters).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"; 
		 
		 return result;
	 }
	/**
	* Allows for simple conversion between the low-level generated protobuf object to
	* ListRequest, which is much more usable.
	* @return An instance of ListRequest representing the input proto object
	**/
	public static ListRequest fromProto(ApiProto.ListRequest proto) {
		ListRequest out = null;
		if (proto != null) {
			ListRequest.Builder outBuilder = ListRequest.newBuilder()
			.setProjectionFilter(ProjectionFilter.fromProto(proto.getProjectionFilter()))
			.setFilters(ListRequest.Filters.fromProto(proto.getFilters()))
			.setCursor(proto.getCursor())
			.setPageSize(proto.getPageSize());
			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 ListRequest instances representing the input proto objects
	**/
	public static List fromProtos(List protos) {
		List out = new ArrayList();
		for(ApiProto.ListRequest proto : protos) {
			out.add(ListRequest.fromProto(proto));
		}
		return out;
	}

	/**
	 * Allows for simple conversion of an object to the low-level generated protobuf object.
	 * @return An instance of ApiProto.ListRequest which is a proto object ready for wire transmission
	 **/
	 public ApiProto.ListRequest toProto() {
		 ListRequest obj = this;
		 ApiProto.ListRequest.Builder outBuilder = ApiProto.ListRequest.newBuilder();
		 if(obj.getProjectionFilter() != null){outBuilder.setProjectionFilter(obj.getProjectionFilter().toProto());}
		 if(obj.getFilters() != null){outBuilder.setFilters(obj.getFilters().toProto());}
		 outBuilder.setCursor(obj.getCursor());
		 outBuilder.setPageSize(obj.getPageSize());
		 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.ListRequest instances representing the input objects.
	  */
	public static List toProtos(List objects) {
		List out = new ArrayList();
		if(objects != null) {
			for (ListRequest obj : objects) {
				out.add(obj!=null?obj.toProto():null);
			}
		}
		return out;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy