Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add builder pattern #833

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 7 additions & 80 deletions src/main/java/com/twilio/rest/assistants/v1/Assistant.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import lombok.Getter;
import lombok.Setter;
import lombok.Builder;
import lombok.ToString;
import lombok.ToString;

Expand All @@ -46,18 +45,15 @@ public class Assistant extends Resource {
private static final long serialVersionUID = 5177924616338L;

@ToString
@Builder
public static class AssistantsV1ServiceCustomerAi {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("perception_engine_enabled")
@Getter
@Setter
private Boolean perceptionEngineEnabled;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("personalization_engine_enabled")
@Getter
@Setter
private Boolean personalizationEngineEnabled;

public static AssistantsV1ServiceCustomerAi fromJson(
Expand All @@ -72,24 +68,19 @@ public static AssistantsV1ServiceCustomerAi fromJson(
}

@ToString
@Builder
public static class AssistantsV1ServiceSegmentCredential {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("profile_api_key")
@Getter
@Setter
private String profileApiKey;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("space_id")
@Getter
@Setter
private String spaceId;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("write_key")
@Getter
@Setter
private String writeKey;

public static AssistantsV1ServiceSegmentCredential fromJson(
Expand All @@ -104,40 +95,29 @@ public static AssistantsV1ServiceSegmentCredential fromJson(
}

@ToString
@Builder
public static class AssistantsV1ServiceCreateAssistantRequest {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("customer_ai")
@Getter
@Setter
private AssistantsV1ServiceCustomerAi customerAi;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("name")
@Getter
@Setter
private String name;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("owner")
@Getter
@Setter
private String owner;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("personality_prompt")
@Getter
@Setter
private String personalityPrompt;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("segment_credential")
@Getter
@Setter
private AssistantsV1ServiceSegmentCredential segmentCredential;

public AssistantsV1ServiceCreateAssistantRequest() {}

public static AssistantsV1ServiceCreateAssistantRequest fromJson(
String jsonString,
ObjectMapper mapper
Expand All @@ -150,40 +130,29 @@ public static AssistantsV1ServiceCreateAssistantRequest fromJson(
}

@ToString
@Builder
public static class AssistantsV1ServiceUpdateAssistantRequest {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("customer_ai")
@Getter
@Setter
private AssistantsV1ServiceCustomerAi customerAi;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("name")
@Getter
@Setter
private String name;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("owner")
@Getter
@Setter
private String owner;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("personality_prompt")
@Getter
@Setter
private String personalityPrompt;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("segment_credential")
@Getter
@Setter
private AssistantsV1ServiceSegmentCredential segmentCredential;

public AssistantsV1ServiceUpdateAssistantRequest() {}

public static AssistantsV1ServiceUpdateAssistantRequest fromJson(
String jsonString,
ObjectMapper mapper
Expand All @@ -196,30 +165,23 @@ public static AssistantsV1ServiceUpdateAssistantRequest fromJson(
}

@ToString
@Builder
public static class AssistantsV1ServiceKnowledge {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("description")
@Getter
@Setter
private String description;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("id")
@Getter
@Setter
private String id;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("account_sid")
@Getter
@Setter
private String accountSid;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("knowledge_source_details")
@Getter
@Setter
private Map<String, Object> knowledgeSourceDetails;

public String getKnowledgeSourceDetails() {
Expand All @@ -228,38 +190,26 @@ public String getKnowledgeSourceDetails() {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("name")
@Getter
@Setter
private String name;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("status")
@Getter
@Setter
private String status;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("type")
@Getter
@Setter
private String type;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("url")
@Getter
@Setter
private String url;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("embedding_model")
@Getter
@Setter
private String embeddingModel;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("date_created")
@Getter
@Setter
private ZonedDateTime dateCreated;

public String getDateCreated() {
Expand All @@ -268,8 +218,6 @@ public String getDateCreated() {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("date_updated")
@Getter
@Setter
private ZonedDateTime dateUpdated;

public String getDateUpdated() {
Expand All @@ -288,36 +236,27 @@ public static AssistantsV1ServiceKnowledge fromJson(
}

@ToString
@Builder
public static class AssistantsV1ServiceTool {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("account_sid")
@Getter
@Setter
private String accountSid;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("description")
@Getter
@Setter
private String description;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("enabled")
@Getter
@Setter
private Boolean enabled;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("id")
@Getter
@Setter
private String id;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("meta")
@Getter
@Setter
private Map<String, Object> meta;

public String getMeta() {
Expand All @@ -326,32 +265,22 @@ public String getMeta() {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("name")
@Getter
@Setter
private String name;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("requires_auth")
@Getter
@Setter
private Boolean requiresAuth;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("type")
@Getter
@Setter
private String type;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("url")
@Getter
@Setter
private String url;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("date_created")
@Getter
@Setter
private ZonedDateTime dateCreated;

public String getDateCreated() {
Expand All @@ -360,8 +289,6 @@ public String getDateCreated() {

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("date_updated")
@Getter
@Setter
private ZonedDateTime dateUpdated;

public String getDateUpdated() {
Expand Down
Loading
Loading