This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomProactiveSubscriptionChangedRequestHandler implements ProactiveSubscriptionChangedRequestHandler { | |
@Override | |
public boolean canHandle(HandlerInput input, ProactiveSubscriptionChangedRequest proactiveSubscriptionChangedRequest) { | |
return true; | |
} | |
@Override | |
public Optional<Response> handle(HandlerInput input, ProactiveSubscriptionChangedRequest proactiveSubscriptionChangedRequest) { | |
//Put Proactive Subscription Changed event handling code here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazon.ask.dispatcher.request.handler.HandlerInput; | |
import com.amazon.ask.dispatcher.request.handler.impl.ProactiveSubscriptionChangedRequestHandler; | |
import com.amazon.ask.model.Response; | |
import com.amazon.ask.model.events.skillevents.ProactiveSubscriptionChangedRequest; | |
import java.util.Optional; | |
/* Skill manifest should contain subscription to the event "SKILL_PROACTIVE_SUBSCRIPTION_CHANGED" (with needed proactive events in "publications") | |
"permissions": [{"name": "alexa::devices:all:notifications:write"}], | |
"events": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"timestamp": "2019-06-08T10:12:01.00Z", | |
"referenceId": "unique-id-of-this-event-instance-abc123456789", | |
"expiryTime": "2019-06-08T14:00:00.00Z", | |
"event": { | |
"name": "AMAZON.MediaContent.Available", | |
"payload": { | |
"availability": { | |
"startTime": "2019-06-08T20:00:00Z", | |
"provider": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"events": { | |
"publications": [ | |
{ "eventName": "AMAZON.OrderStatus.Updated" }, | |
{ "eventName": "AMAZON.MediaContent.Available" } | |
], | |
"endpoint": { | |
"uri": "YOUR-AWS-LAMBDA-FUNCTION-ARN" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
testCompile group: 'junit', name: 'junit', version: '4.12' | |
compile group: 'com.amazon.alexa', name: 'ask-sdk', version:'2.17.2' | |
compile group: 'com.amazonaws', name: 'aws-lambda-java-log4j2', version:'1.1.0' | |
} | |
jar { | |
from { | |
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://github.com/FasterXML/jackson | |
Grade.build | |
dependencies { | |
compile group:'com.fasterxml.jackson', name:'jackson-bom', version: '2.9.8' | |
} | |
Input: | |
{ "first_name" : "John", "last_name" : "Smith" } | |
{ "first_name" : "John" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"string_value": "some text", | |
"int_value": "123", | |
"float_value":"12.345", | |
"bool_value": "true", | |
"date_value": "2019-05-10T10:20:35.000+0", | |
"array_value": [1,2,3,4,5], | |
"object_value": { | |
"int_field": "789", | |
"string_field": "object's text" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In the test class | |
import com.amazonaws.services.lambda.runtime.Context; | |
import com.amazonaws.services.lambda.runtime.LambdaLogger; | |
import org.junit.runner.RunWith; | |
import org.mockito.junit.MockitoJUnitRunner; | |
import org.mockito.Mock; | |
import org.junit.Before; | |
import org.junit.Test; | |
import static org.mockito.Mockito.when; | |
import static org.mockito.Mockito.doAnswer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from tensorflow import keras | |
mnist = keras.datasets.mnist | |
(training_images, training_labels), (test_images, test_labels) = mnist.load_data() | |
#plt.imshow(test_images[0]) | |
class FitCallback(tf.keras.callbacks.Callback): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://www.coursera.org/learn/introduction-tensorflow/home/welcome | |
# Course 1 - Part 4 - Lesson 2 - Notebook | |
#https://github.com/zalandoresearch/fashion-mnist | |
import tensorflow as tf | |
from tensorflow import keras | |
mnist = keras.datasets.fashion_mnist | |
(training_images, training_labels), (test_images, test_labels) = mnist.load_data() | |
import matplotlib.pyplot as plt |