Skip to content

Commit f36f3ed

Browse files
awsmobilesdkpalpatim
authored andcommitted
[aws-android-sdk-lex] Update models to latest (#1125)
1 parent 920c913 commit f36f3ed

26 files changed

+8137
-61
lines changed

aws-android-sdk-lex/src/main/java/com/amazonaws/services/lexrts/AmazonLexRuntime.java

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,53 @@ public interface AmazonLexRuntime {
9595
*/
9696
public void setRegion(Region region) throws java.lang.IllegalArgumentException;
9797

98+
/**
99+
* <p>
100+
* Removes session information for a specified bot, alias, and user ID.
101+
* </p>
102+
*
103+
* @param deleteSessionRequest
104+
* @return deleteSessionResult The response from the DeleteSession service
105+
* method, as returned by Amazon Lex Runtime Service.
106+
* @throws NotFoundException
107+
* @throws BadRequestException
108+
* @throws LimitExceededException
109+
* @throws InternalFailureException
110+
* @throws ConflictException
111+
* @throws AmazonClientException If any internal errors are encountered
112+
* inside the client while attempting to make the request or
113+
* handle the response. For example if a network connection is
114+
* not available.
115+
* @throws AmazonServiceException If an error response is returned by Amazon
116+
* Lex Runtime Service indicating either a problem with the data
117+
* in the request, or a server side issue.
118+
*/
119+
DeleteSessionResult deleteSession(DeleteSessionRequest deleteSessionRequest)
120+
throws AmazonClientException, AmazonServiceException;
121+
122+
/**
123+
* <p>
124+
* Returns session information for a specified bot, alias, and user ID.
125+
* </p>
126+
*
127+
* @param getSessionRequest
128+
* @return getSessionResult The response from the GetSession service method,
129+
* as returned by Amazon Lex Runtime Service.
130+
* @throws NotFoundException
131+
* @throws BadRequestException
132+
* @throws LimitExceededException
133+
* @throws InternalFailureException
134+
* @throws AmazonClientException If any internal errors are encountered
135+
* inside the client while attempting to make the request or
136+
* handle the response. For example if a network connection is
137+
* not available.
138+
* @throws AmazonServiceException If an error response is returned by Amazon
139+
* Lex Runtime Service indicating either a problem with the data
140+
* in the request, or a server side issue.
141+
*/
142+
GetSessionResult getSession(GetSessionRequest getSessionRequest) throws AmazonClientException,
143+
AmazonServiceException;
144+
98145
/**
99146
* <p>
100147
* Sends user input (text or speech) to Amazon Lex. Clients use this API to
@@ -196,7 +243,7 @@ public interface AmazonLexRuntime {
196243
* <p>
197244
* In addition, Amazon Lex also returns your application-specific
198245
* <code>sessionAttributes</code>. For more information, see <a
199-
* href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
246+
* href="https://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
200247
* >Managing Conversation Context</a>.
201248
* </p>
202249
*
@@ -227,8 +274,8 @@ PostContentResult postContent(PostContentRequest postContentRequest)
227274

228275
/**
229276
* <p>
230-
* Sends user input (text-only) to Amazon Lex. Client applications can use
231-
* this API to send requests to Amazon Lex at runtime. Amazon Lex then
277+
* Sends user input (text or SSML) to Amazon Lex. Client applications can
278+
* use this API to send requests to Amazon Lex at runtime. Amazon Lex then
232279
* interprets the user input using the machine learning model it built for
233280
* the bot.
234281
* </p>
@@ -320,7 +367,7 @@ PostContentResult postContent(PostContentRequest postContentRequest)
320367
* <p>
321368
* In addition, Amazon Lex also returns your application-specific
322369
* <code>sessionAttributes</code>. For more information, see <a
323-
* href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
370+
* href="https://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
324371
* >Managing Conversation Context</a>.
325372
* </p>
326373
*
@@ -346,6 +393,40 @@ PostContentResult postContent(PostContentRequest postContentRequest)
346393
PostTextResult postText(PostTextRequest postTextRequest) throws AmazonClientException,
347394
AmazonServiceException;
348395

396+
/**
397+
* <p>
398+
* Creates a new session or modifies an existing session with an Amazon Lex
399+
* bot. Use this operation to enable your application to set the state of
400+
* the bot.
401+
* </p>
402+
* <p>
403+
* For more information, see <a
404+
* href="https://docs.aws.amazon.com/lex/latest/dg/how-session-api.html"
405+
* >Managing Sessions</a>.
406+
* </p>
407+
*
408+
* @param putSessionRequest
409+
* @return putSessionResult The response from the PutSession service method,
410+
* as returned by Amazon Lex Runtime Service.
411+
* @throws NotFoundException
412+
* @throws BadRequestException
413+
* @throws LimitExceededException
414+
* @throws InternalFailureException
415+
* @throws ConflictException
416+
* @throws NotAcceptableException
417+
* @throws DependencyFailedException
418+
* @throws BadGatewayException
419+
* @throws AmazonClientException If any internal errors are encountered
420+
* inside the client while attempting to make the request or
421+
* handle the response. For example if a network connection is
422+
* not available.
423+
* @throws AmazonServiceException If an error response is returned by Amazon
424+
* Lex Runtime Service indicating either a problem with the data
425+
* in the request, or a server side issue.
426+
*/
427+
PutSessionResult putSession(PutSessionRequest putSessionRequest) throws AmazonClientException,
428+
AmazonServiceException;
429+
349430
/**
350431
* Shuts down this client object, releasing any resources that might be held
351432
* open. This is an optional method, and callers are not expected to call

aws-android-sdk-lex/src/main/java/com/amazonaws/services/lexrts/AmazonLexRuntimeClient.java

Lines changed: 163 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,105 @@ private static ClientConfiguration adjustClientConfiguration(ClientConfiguration
373373
return config;
374374
}
375375

376+
/**
377+
* <p>
378+
* Removes session information for a specified bot, alias, and user ID.
379+
* </p>
380+
*
381+
* @param deleteSessionRequest
382+
* @return deleteSessionResult The response from the DeleteSession service
383+
* method, as returned by Amazon Lex Runtime Service.
384+
* @throws NotFoundException
385+
* @throws BadRequestException
386+
* @throws LimitExceededException
387+
* @throws InternalFailureException
388+
* @throws ConflictException
389+
* @throws AmazonClientException If any internal errors are encountered
390+
* inside the client while attempting to make the request or
391+
* handle the response. For example if a network connection is
392+
* not available.
393+
* @throws AmazonServiceException If an error response is returned by Amazon
394+
* Lex Runtime Service indicating either a problem with the data
395+
* in the request, or a server side issue.
396+
*/
397+
public DeleteSessionResult deleteSession(DeleteSessionRequest deleteSessionRequest)
398+
throws AmazonServiceException, AmazonClientException {
399+
ExecutionContext executionContext = createExecutionContext(deleteSessionRequest);
400+
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
401+
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
402+
Request<DeleteSessionRequest> request = null;
403+
Response<DeleteSessionResult> response = null;
404+
try {
405+
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
406+
try {
407+
request = new DeleteSessionRequestMarshaller().marshall(deleteSessionRequest);
408+
// Binds the request metrics to the current request.
409+
request.setAWSRequestMetrics(awsRequestMetrics);
410+
} finally {
411+
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
412+
}
413+
Unmarshaller<DeleteSessionResult, JsonUnmarshallerContext> unmarshaller = new DeleteSessionResultJsonUnmarshaller();
414+
JsonResponseHandler<DeleteSessionResult> responseHandler = new JsonResponseHandler<DeleteSessionResult>(
415+
unmarshaller);
416+
417+
response = invoke(request, responseHandler, executionContext);
418+
419+
return response.getAwsResponse();
420+
} finally {
421+
awsRequestMetrics.endEvent(Field.ClientExecuteTime);
422+
endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);
423+
}
424+
}
425+
426+
/**
427+
* <p>
428+
* Returns session information for a specified bot, alias, and user ID.
429+
* </p>
430+
*
431+
* @param getSessionRequest
432+
* @return getSessionResult The response from the GetSession service method,
433+
* as returned by Amazon Lex Runtime Service.
434+
* @throws NotFoundException
435+
* @throws BadRequestException
436+
* @throws LimitExceededException
437+
* @throws InternalFailureException
438+
* @throws AmazonClientException If any internal errors are encountered
439+
* inside the client while attempting to make the request or
440+
* handle the response. For example if a network connection is
441+
* not available.
442+
* @throws AmazonServiceException If an error response is returned by Amazon
443+
* Lex Runtime Service indicating either a problem with the data
444+
* in the request, or a server side issue.
445+
*/
446+
public GetSessionResult getSession(GetSessionRequest getSessionRequest)
447+
throws AmazonServiceException, AmazonClientException {
448+
ExecutionContext executionContext = createExecutionContext(getSessionRequest);
449+
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
450+
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
451+
Request<GetSessionRequest> request = null;
452+
Response<GetSessionResult> response = null;
453+
try {
454+
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
455+
try {
456+
request = new GetSessionRequestMarshaller().marshall(getSessionRequest);
457+
// Binds the request metrics to the current request.
458+
request.setAWSRequestMetrics(awsRequestMetrics);
459+
} finally {
460+
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
461+
}
462+
Unmarshaller<GetSessionResult, JsonUnmarshallerContext> unmarshaller = new GetSessionResultJsonUnmarshaller();
463+
JsonResponseHandler<GetSessionResult> responseHandler = new JsonResponseHandler<GetSessionResult>(
464+
unmarshaller);
465+
466+
response = invoke(request, responseHandler, executionContext);
467+
468+
return response.getAwsResponse();
469+
} finally {
470+
awsRequestMetrics.endEvent(Field.ClientExecuteTime);
471+
endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);
472+
}
473+
}
474+
376475
/**
377476
* <p>
378477
* Sends user input (text or speech) to Amazon Lex. Clients use this API to
@@ -474,7 +573,7 @@ private static ClientConfiguration adjustClientConfiguration(ClientConfiguration
474573
* <p>
475574
* In addition, Amazon Lex also returns your application-specific
476575
* <code>sessionAttributes</code>. For more information, see <a
477-
* href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
576+
* href="https://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
478577
* >Managing Conversation Context</a>.
479578
* </p>
480579
*
@@ -531,8 +630,8 @@ public PostContentResult postContent(PostContentRequest postContentRequest)
531630

532631
/**
533632
* <p>
534-
* Sends user input (text-only) to Amazon Lex. Client applications can use
535-
* this API to send requests to Amazon Lex at runtime. Amazon Lex then
633+
* Sends user input (text or SSML) to Amazon Lex. Client applications can
634+
* use this API to send requests to Amazon Lex at runtime. Amazon Lex then
536635
* interprets the user input using the machine learning model it built for
537636
* the bot.
538637
* </p>
@@ -624,7 +723,7 @@ public PostContentResult postContent(PostContentRequest postContentRequest)
624723
* <p>
625724
* In addition, Amazon Lex also returns your application-specific
626725
* <code>sessionAttributes</code>. For more information, see <a
627-
* href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
726+
* href="https://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html"
628727
* >Managing Conversation Context</a>.
629728
* </p>
630729
*
@@ -676,6 +775,66 @@ public PostTextResult postText(PostTextRequest postTextRequest)
676775
}
677776
}
678777

778+
/**
779+
* <p>
780+
* Creates a new session or modifies an existing session with an Amazon Lex
781+
* bot. Use this operation to enable your application to set the state of
782+
* the bot.
783+
* </p>
784+
* <p>
785+
* For more information, see <a
786+
* href="https://docs.aws.amazon.com/lex/latest/dg/how-session-api.html"
787+
* >Managing Sessions</a>.
788+
* </p>
789+
*
790+
* @param putSessionRequest
791+
* @return putSessionResult The response from the PutSession service method,
792+
* as returned by Amazon Lex Runtime Service.
793+
* @throws NotFoundException
794+
* @throws BadRequestException
795+
* @throws LimitExceededException
796+
* @throws InternalFailureException
797+
* @throws ConflictException
798+
* @throws NotAcceptableException
799+
* @throws DependencyFailedException
800+
* @throws BadGatewayException
801+
* @throws AmazonClientException If any internal errors are encountered
802+
* inside the client while attempting to make the request or
803+
* handle the response. For example if a network connection is
804+
* not available.
805+
* @throws AmazonServiceException If an error response is returned by Amazon
806+
* Lex Runtime Service indicating either a problem with the data
807+
* in the request, or a server side issue.
808+
*/
809+
public PutSessionResult putSession(PutSessionRequest putSessionRequest)
810+
throws AmazonServiceException, AmazonClientException {
811+
ExecutionContext executionContext = createExecutionContext(putSessionRequest);
812+
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
813+
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
814+
Request<PutSessionRequest> request = null;
815+
Response<PutSessionResult> response = null;
816+
try {
817+
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
818+
try {
819+
request = new PutSessionRequestMarshaller().marshall(putSessionRequest);
820+
// Binds the request metrics to the current request.
821+
request.setAWSRequestMetrics(awsRequestMetrics);
822+
} finally {
823+
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
824+
}
825+
Unmarshaller<PutSessionResult, JsonUnmarshallerContext> unmarshaller = new PutSessionResultJsonUnmarshaller();
826+
JsonResponseHandler<PutSessionResult> responseHandler = new JsonResponseHandler<PutSessionResult>(
827+
unmarshaller);
828+
829+
response = invoke(request, responseHandler, executionContext);
830+
831+
return response.getAwsResponse();
832+
} finally {
833+
awsRequestMetrics.endEvent(Field.ClientExecuteTime);
834+
endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);
835+
}
836+
}
837+
679838
/**
680839
* Returns additional metadata for a previously executed successful,
681840
* request, typically used for debugging issues where a service isn't acting
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package com.amazonaws.services.lexrts.model;
17+
18+
import java.util.HashMap;
19+
import java.util.Map;
20+
21+
/**
22+
* Confirmation Status
23+
*/
24+
public enum ConfirmationStatus {
25+
26+
None("None"),
27+
Confirmed("Confirmed"),
28+
Denied("Denied");
29+
30+
private String value;
31+
32+
private ConfirmationStatus(String value) {
33+
this.value = value;
34+
}
35+
36+
@Override
37+
public String toString() {
38+
return value;
39+
}
40+
41+
private static final Map<String, ConfirmationStatus> enumMap;
42+
static {
43+
enumMap = new HashMap<String, ConfirmationStatus>();
44+
enumMap.put("None", None);
45+
enumMap.put("Confirmed", Confirmed);
46+
enumMap.put("Denied", Denied);
47+
}
48+
49+
/**
50+
* Use this in place of valueOf.
51+
*
52+
* @param value real value
53+
* @return ConfirmationStatus corresponding to the value
54+
*/
55+
public static ConfirmationStatus fromValue(String value) {
56+
if (value == null || value.isEmpty()) {
57+
throw new IllegalArgumentException("Value cannot be null or empty!");
58+
} else if (enumMap.containsKey(value)) {
59+
return enumMap.get(value);
60+
} else {
61+
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)