com.commercetools.history.models.change_history.ModifiedByBuilder Maven / Gradle / Ivy
Show all versions of commercetools-sdk-java-history Show documentation
package com.commercetools.history.models.change_history;
import java.util.*;
import java.util.function.Function;
import javax.annotation.Nullable;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* ModifiedByBuilder
*
* Example to create an instance using the builder pattern
*
*
* ModifiedBy modifiedBy = ModifiedBy.builder()
* .id("{id}")
* .type("{type}")
* .isPlatformClient(true)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ModifiedByBuilder implements Builder {
private String id;
private String type;
@Nullable
private String clientId;
@Nullable
private String anonymousId;
@Nullable
private com.commercetools.history.models.common.Reference customer;
@Nullable
private com.commercetools.history.models.common.Reference associate;
private Boolean isPlatformClient;
/**
* ID of the Merchant Center user who made the change.
* Present only if the change was made in the Merchant Center.
* @param id value to be set
* @return Builder
*/
public ModifiedByBuilder id(final String id) {
this.id = id;
return this;
}
/**
* Indicates who performed the change.
*
* - If the change was made by a user, the value is
"user"
.
* - If the change was made by an API Client with or without an external user ID, the value is
"external-user"
.
* - If the change was made by an Associate, the value is
"associate"
.
*
* @param type value to be set
* @return Builder
*/
public ModifiedByBuilder type(final String type) {
this.type = type;
return this;
}
/**
* ID of the API Client that made the change.
* Present only if the change was made using an API Client.
* @param clientId value to be set
* @return Builder
*/
public ModifiedByBuilder clientId(@Nullable final String clientId) {
this.clientId = clientId;
return this;
}
/**
* Present only if the change was made using a token from an anonymous session.
* @param anonymousId value to be set
* @return Builder
*/
public ModifiedByBuilder anonymousId(@Nullable final String anonymousId) {
this.anonymousId = anonymousId;
return this;
}
/**
* The Customer who made the change.
* Present only if the change was made using a token from the password flow.
* @param builder function to build the customer value
* @return Builder
*/
public ModifiedByBuilder customer(
Function builder) {
this.customer = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
return this;
}
/**
* The Customer who made the change.
* Present only if the change was made using a token from the password flow.
* @param builder function to build the customer value
* @return Builder
*/
public ModifiedByBuilder withCustomer(
Function builder) {
this.customer = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
return this;
}
/**
* The Customer who made the change.
* Present only if the change was made using a token from the password flow.
* @param customer value to be set
* @return Builder
*/
public ModifiedByBuilder customer(@Nullable final com.commercetools.history.models.common.Reference customer) {
this.customer = customer;
return this;
}
/**
* The Associate who made the change in the context of a Business Unit. Present only if the Associate acts on behalf of a company using the associate endpoints.
* @param builder function to build the associate value
* @return Builder
*/
public ModifiedByBuilder associate(
Function builder) {
this.associate = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
return this;
}
/**
* The Associate who made the change in the context of a Business Unit. Present only if the Associate acts on behalf of a company using the associate endpoints.
* @param builder function to build the associate value
* @return Builder
*/
public ModifiedByBuilder withAssociate(
Function builder) {
this.associate = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
return this;
}
/**
* The Associate who made the change in the context of a Business Unit. Present only if the Associate acts on behalf of a company using the associate endpoints.
* @param associate value to be set
* @return Builder
*/
public ModifiedByBuilder associate(@Nullable final com.commercetools.history.models.common.Reference associate) {
this.associate = associate;
return this;
}
/**
* true
if the change was made using the Merchant Center or ImpEx.
* @param isPlatformClient value to be set
* @return Builder
*/
public ModifiedByBuilder isPlatformClient(final Boolean isPlatformClient) {
this.isPlatformClient = isPlatformClient;
return this;
}
/**
* ID of the Merchant Center user who made the change.
* Present only if the change was made in the Merchant Center.
* @return id
*/
public String getId() {
return this.id;
}
/**
* Indicates who performed the change.
*
* - If the change was made by a user, the value is
"user"
.
* - If the change was made by an API Client with or without an external user ID, the value is
"external-user"
.
* - If the change was made by an Associate, the value is
"associate"
.
*
* @return type
*/
public String getType() {
return this.type;
}
/**
* ID of the API Client that made the change.
* Present only if the change was made using an API Client.
* @return clientId
*/
@Nullable
public String getClientId() {
return this.clientId;
}
/**
* Present only if the change was made using a token from an anonymous session.
* @return anonymousId
*/
@Nullable
public String getAnonymousId() {
return this.anonymousId;
}
/**
* The Customer who made the change.
* Present only if the change was made using a token from the password flow.
* @return customer
*/
@Nullable
public com.commercetools.history.models.common.Reference getCustomer() {
return this.customer;
}
/**
* The Associate who made the change in the context of a Business Unit. Present only if the Associate acts on behalf of a company using the associate endpoints.
* @return associate
*/
@Nullable
public com.commercetools.history.models.common.Reference getAssociate() {
return this.associate;
}
/**
* true
if the change was made using the Merchant Center or ImpEx.
* @return isPlatformClient
*/
public Boolean getIsPlatformClient() {
return this.isPlatformClient;
}
/**
* builds ModifiedBy with checking for non-null required values
* @return ModifiedBy
*/
public ModifiedBy build() {
Objects.requireNonNull(id, ModifiedBy.class + ": id is missing");
Objects.requireNonNull(type, ModifiedBy.class + ": type is missing");
Objects.requireNonNull(isPlatformClient, ModifiedBy.class + ": isPlatformClient is missing");
return new ModifiedByImpl(id, type, clientId, anonymousId, customer, associate, isPlatformClient);
}
/**
* builds ModifiedBy without checking for non-null required values
* @return ModifiedBy
*/
public ModifiedBy buildUnchecked() {
return new ModifiedByImpl(id, type, clientId, anonymousId, customer, associate, isPlatformClient);
}
/**
* factory method for an instance of ModifiedByBuilder
* @return builder
*/
public static ModifiedByBuilder of() {
return new ModifiedByBuilder();
}
/**
* create builder for ModifiedBy instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static ModifiedByBuilder of(final ModifiedBy template) {
ModifiedByBuilder builder = new ModifiedByBuilder();
builder.id = template.getId();
builder.type = template.getType();
builder.clientId = template.getClientId();
builder.anonymousId = template.getAnonymousId();
builder.customer = template.getCustomer();
builder.associate = template.getAssociate();
builder.isPlatformClient = template.getIsPlatformClient();
return builder;
}
}