GeezerVison is showing github.com — EnvironmentSessionName defaults to draft · Issue #3305 · googleapis/google-cloud-java
EnvironmentSessionName defaults to draft #3305DescriptionWhat is the current default value to EnvironmentSessionName? How can i default to Draft?
It doesnt seem to be possible at the moment to fallback to draft and i cant find any documentation around that. Activityandreamlin commented on May 23, 2018 naderz commented on May 23, 2018 Yes it is and Draft is the draft State as in not pointing to any
environment but just the draft version.
--
Regards,
*Nader Ayyad* andreamlin commented on May 23, 2018 Hello Nader,
One way to instantiate an EnvironmentSessionName is through a static constructor
EnvironmentSessionName.of("project", "environment", "user", "session")
Can you explain what a Draft object is? What are you trying to do with your draft object? naderz commented on May 23, 2018 I know how to initialize an environment and point to one but what if i dont
want to point to any environment? Just the currently being editted agent(
which in dialogflow is being called draft thus im using the term draft) Do
i still need to use just SessionName or i can use EnvironmentSessionName
and not specifiy the environment? My current solution is if else and either
use one of those but id rather use EnvironmentSessionName for both cases
anyways? Is it now clear enough?
--
Regards,
*Nader Ayyad* andreamlin commented on May 24, 2018 It depends on what dialogflow RPC method you are calling. The EnvironmentSessionName will format strings as an endpoint path `projects/{project}/environments/{environment}/users/{user}/sessions/{session}", which points to a specific resource.
What method, and on what resource, are you calling? naderz commented on May 24, 2018 I am calling the EnvironmentSessionName method.
let me try to clarify what I'm trying to do more, I have the following method:
private fun getSessionName(sessionId: String): ResourceName {
return if (DRAFT.equalsTo(dialogFlowConfig.environment)) {
SessionName.newBuilder()
.setProject(dialogFlowConfig.projectId)
.setSession(sessionId).build()
} else {
EnvironmentSessionName.newBuilder()
.setEnvironment(dialogFlowConfig.environment)
.setProject(dialogFlowConfig.projectId)
.setUser(sessionId)
.setSession(sessionId).build()
}
}

As the screenshot depicts i have 2 environments and a draft.
The way we used to connect to the draft prior to introducing the environment feature was via SessionName.NewBuilder()... and now after introducing environments feature we have to use EnvironmentSessionName... what im wondering is can we actually just point to draft in some way via EnvironmentSessionName?
The reason im asking is after reading through the sdk code i found the comment in context.proto
// Required. The unique identifier of the context. Format:
// projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>,
// or
// projects/<Project ID>/agent/environments/<Environment ID>/users/<User // ID>/sessions/<Session ID>/contexts/<Context ID>. Note: Environments and
// users are under construction and will be available soon. The Context ID is
// always converted to lowercase. If is not specified, we
// assume default 'draft' environment. If is not specified, we
// assume default '-' user.
I hope now i made my question clearer. let me know if you need any further clarification. andreamlin commented on Jun 5, 2018 @naderz
Ah thanks for clarifying your question! Yes, not specifying the environment will default to the Draft environment. Alternatively, if you wish to be explicit, you can set the environment to be the string "draft", which does the same thing and points to a draft environment.
I've confirmed this with our internal code, and this is documented in both the proto you mentioned and in the comments for methods in the ContextClient.java class.
Hope that helps!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|