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

com.vendasta.accountgroup.v1.internal.CreateAccountGroupRequest 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 CreateAccountGroupRequest {




	private final AccountGroupLocation accountGroupNap;
	private final String socialProfileGroupId;
	private final List updateOperations;
	private final List createOperations;
	

	private CreateAccountGroupRequest (
		final AccountGroupLocation accountGroupNap,
		final String socialProfileGroupId,
		final List updateOperations,
		final List createOperations)
		
	{
		this.accountGroupNap = accountGroupNap;
		this.socialProfileGroupId = socialProfileGroupId;
		this.updateOperations = updateOperations;
		this.createOperations = createOperations;
		
	}
	
	/**
	 * 
      * @return The final value of accountGroupNap on the object
	 **/
	public AccountGroupLocation getAccountGroupNap() {
		return this.accountGroupNap;
	}
	
	/**
	 * ID of the partner's social profile group which the account will be associated with
      * @return The final value of socialProfileGroupId on the object
	 **/
	public String getSocialProfileGroupId() {
		return this.socialProfileGroupId;
	}
	
	/**
	 * The set of update operations to be done to the extended account group data after the create.
      * @return The final value of updateOperations on the object
	 **/
	public List getUpdateOperations() {
		return this.updateOperations;
	}
	
	/**
	 * The set of create operations to be done to the account group on create
      * @return The final value of createOperations on the object
	 **/
	public List getCreateOperations() {
		return this.createOperations;
	}
	

	public static class Builder {
		private AccountGroupLocation accountGroupNap;
		private String socialProfileGroupId;
		private List updateOperations;
		private List createOperations;
		
		public Builder() {
			this.accountGroupNap = null;
			this.socialProfileGroupId = "";
			this.updateOperations = null;
			this.createOperations = null;
			
		}
		
		/**
		  * Adds a value to the builder for accountGroupNap
		  * @param accountGroupNap Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setAccountGroupNap(AccountGroupLocation accountGroupNap) {
			this.accountGroupNap = accountGroupNap;
			return this;
		}
		
		/**
		  * Adds a value to the builder for socialProfileGroupId
		  * @param socialProfileGroupId Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setSocialProfileGroupId(String socialProfileGroupId) {
			this.socialProfileGroupId = socialProfileGroupId;
			return this;
		}
		
		/**
		  * Adds a value to the builder for updateOperations
		  * @param updateOperations Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setUpdateOperations(List updateOperations) {
			this.updateOperations = updateOperations;
			return this;
		}
		
		/**
		  * Adds a value to the builder for createOperations
		  * @param createOperations Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setCreateOperations(List createOperations) {
			this.createOperations = createOperations;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the CreateAccountGroupRequest class
		  * @return The instantiated final CreateAccountGroupRequest
		 **/
		public CreateAccountGroupRequest build() {
			return new CreateAccountGroupRequest(
				this.accountGroupNap,
				this.socialProfileGroupId,
				this.updateOperations,
				this.createOperations);
		}
	}

	/**
	 * Returns a Builder for CreateAccountGroupRequest, which is a mutable representation of the object.  Once the
	 * client has built up an object they can then create an immutable CreateAccountGroupRequest 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 CreateAccountGroupRequest instance
	 **/
	 public String toString() {
		 String result = "CreateAccountGroupRequest\n";
		 result += "-> accountGroupNap: (AccountGroupLocation)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.accountGroupNap).split("\n"))) + "\n"; 
		 result += "-> socialProfileGroupId: (String)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.socialProfileGroupId).split("\n"))) + "\n"; 
		 result += "-> updateOperations: (List)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.updateOperations).split("\n"))) + "\n"; 
		 result += "-> createOperations: (List)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.createOperations).split("\n"))) + "\n"; 
		 
		 return result;
	 }
	/**
	* Allows for simple conversion between the low-level generated protobuf object to
	* CreateAccountGroupRequest, which is much more usable.
	* @return An instance of CreateAccountGroupRequest representing the input proto object
	**/
	public static CreateAccountGroupRequest fromProto(ApiProto.CreateAccountGroupRequest proto) {
		CreateAccountGroupRequest out = null;
		if (proto != null) {
			CreateAccountGroupRequest.Builder outBuilder = CreateAccountGroupRequest.newBuilder()
			.setAccountGroupNap(AccountGroupLocation.fromProto(proto.getAccountGroupNap()))
			.setSocialProfileGroupId(proto.getSocialProfileGroupId())
			.setUpdateOperations(UpdateOperation.fromProtos(proto.getUpdateOperationsList()))
			.setCreateOperations(CreateOperation.fromProtos(proto.getCreateOperationsList()));
			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 CreateAccountGroupRequest instances representing the input proto objects
	**/
	public static List fromProtos(List protos) {
		List out = new ArrayList();
		for(ApiProto.CreateAccountGroupRequest proto : protos) {
			out.add(CreateAccountGroupRequest.fromProto(proto));
		}
		return out;
	}

	/**
	 * Allows for simple conversion of an object to the low-level generated protobuf object.
	 * @return An instance of ApiProto.CreateAccountGroupRequest which is a proto object ready for wire transmission
	 **/
	 public ApiProto.CreateAccountGroupRequest toProto() {
		 CreateAccountGroupRequest obj = this;
		 ApiProto.CreateAccountGroupRequest.Builder outBuilder = ApiProto.CreateAccountGroupRequest.newBuilder();
		 if(obj.getAccountGroupNap() != null){outBuilder.setAccountGroupNap(obj.getAccountGroupNap().toProto());}
		 outBuilder.setSocialProfileGroupId(obj.getSocialProfileGroupId());
		 outBuilder.addAllUpdateOperations(UpdateOperation.toProtos(obj.getUpdateOperations()));
		 outBuilder.addAllCreateOperations(CreateOperation.toProtos(obj.getCreateOperations()));
		 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.CreateAccountGroupRequest instances representing the input objects.
	  */
	public static List toProtos(List objects) {
		List out = new ArrayList();
		if(objects != null) {
			for (CreateAccountGroupRequest obj : objects) {
				out.add(obj!=null?obj.toProto():null);
			}
		}
		return out;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy