Skip to content

Commit

Permalink
feat(assistant-v2): add sessionStartTime & state properties to Messag…
Browse files Browse the repository at this point in the history
…eContextGlobalSystem
  • Loading branch information
kevinkowa committed Sep 9, 2021
1 parent 86b331d commit 6cd0b2e
Showing 1 changed file with 67 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2018, 2021.
* (C) Copyright IBM Corp. 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -72,20 +72,29 @@ public interface Locale {
@SerializedName("reference_time")
protected String referenceTime;

@SerializedName("session_start_time")
protected String sessionStartTime;

protected String state;

/** Builder. */
public static class Builder {
private String timezone;
private String userId;
private Long turnCount;
private String locale;
private String referenceTime;
private String sessionStartTime;
private String state;

private Builder(MessageContextGlobalSystem messageContextGlobalSystem) {
this.timezone = messageContextGlobalSystem.timezone;
this.userId = messageContextGlobalSystem.userId;
this.turnCount = messageContextGlobalSystem.turnCount;
this.locale = messageContextGlobalSystem.locale;
this.referenceTime = messageContextGlobalSystem.referenceTime;
this.sessionStartTime = messageContextGlobalSystem.sessionStartTime;
this.state = messageContextGlobalSystem.state;
}

/** Instantiates a new builder. */
Expand Down Expand Up @@ -154,6 +163,28 @@ public Builder referenceTime(String referenceTime) {
this.referenceTime = referenceTime;
return this;
}

/**
* Set the sessionStartTime.
*
* @param sessionStartTime the sessionStartTime
* @return the MessageContextGlobalSystem builder
*/
public Builder sessionStartTime(String sessionStartTime) {
this.sessionStartTime = sessionStartTime;
return this;
}

/**
* Set the state.
*
* @param state the state
* @return the MessageContextGlobalSystem builder
*/
public Builder state(String state) {
this.state = state;
return this;
}
}

protected MessageContextGlobalSystem(Builder builder) {
Expand All @@ -162,6 +193,8 @@ protected MessageContextGlobalSystem(Builder builder) {
turnCount = builder.turnCount;
locale = builder.locale;
referenceTime = builder.referenceTime;
sessionStartTime = builder.sessionStartTime;
state = builder.state;
}

/**
Expand Down Expand Up @@ -242,7 +275,7 @@ public String locale() {
* testing purposes, or when analyzing documents such as news articles.
*
* <p>This value must be a UTC time value formatted according to ISO 8601 (for example,
* `2019-06-26T12:00:00Z` for noon on 26 June 2019.
* `2021-06-26T12:00:00Z` for noon UTC on 26 June 2021).
*
* <p>This property is included only if the new system entities are enabled for the skill.
*
Expand All @@ -251,4 +284,36 @@ public String locale() {
public String referenceTime() {
return referenceTime;
}

/**
* Gets the sessionStartTime.
*
* <p>The time at which the session started. With the stateful `message` method, the start time is
* always present, and is set by the service based on the time the session was created. With the
* stateless `message` method, the start time is set by the service in the response to the first
* message, and should be returned as part of the context with each subsequent message in the
* session.
*
* <p>This value is a UTC time value formatted according to ISO 8601 (for example,
* `2021-06-26T12:00:00Z` for noon UTC on 26 June 2021).
*
* @return the sessionStartTime
*/
public String sessionStartTime() {
return sessionStartTime;
}

/**
* Gets the state.
*
* <p>An encoded string that represents the configuration state of the assistant at the beginning
* of the conversation. If you are using the stateless `message` method, save this value and then
* send it in the context of the subsequent message request to avoid disruptions if there are
* configuration changes during the conversation (such as a change to a skill the assistant uses).
*
* @return the state
*/
public String state() {
return state;
}
}

0 comments on commit 6cd0b2e

Please sign in to comment.