commit 384eec43fa6aa79ad2cb49a7bbec15f4f3491206 Author: Julien Lengrand-Lambert Date: Fri Mar 5 15:17:18 2021 +0100 Create repository diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..41a7ed9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,88 @@ +############################## +## Java +############################## +.mtj.tmp/ +*.class +*.jar +*.war +*.ear +*.nar +hs_err_pid* + +############################## +## Maven +############################## +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +pom.xml.bak +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +############################## +## Gradle +############################## +bin/ +build/ +.gradle +.gradletasknamecache +gradle-app.setting +!gradle-wrapper.jar + +############################## +## IntelliJ +############################## +out/ +.idea/ +.idea_modules/ +*.iml +*.ipr +*.iws + +############################## +## Eclipse +############################## +.settings/ +bin/ +tmp/ +.metadata +.classpath +.project +*.tmp +*.bak +*.swp +*~.nib +local.properties +.loadpath +.factorypath + +############################## +## NetBeans +############################## +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml + +############################## +## Visual Studio Code +############################## +.vscode/ +.code-workspace + +############################## +## OS X +############################## +.DS_Store + +.githubconfig +.ask +.github/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..44b3db7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,96 @@ +Amazon Software License 1.0 + +This Amazon Software License ("License") governs your use, reproduction, and +distribution of the accompanying software as specified below. + +1. Definitions + + "Licensor" means any person or entity that distributes its Work. + + "Software" means the original work of authorship made available under this + License. + + "Work" means the Software and any additions to or derivative works of the + Software that are made available under this License. + + The terms "reproduce," "reproduction," "derivative works," and + "distribution" have the meaning as provided under U.S. copyright law; + provided, however, that for the purposes of this License, derivative works + shall not include works that remain separable from, or merely link (or bind + by name) to the interfaces of, the Work. + + Works, including the Software, are "made available" under this License by + including in or with the Work either (a) a copyright notice referencing the + applicability of this License to the Work, or (b) a copy of this License. + +2. License Grants + + 2.1 Copyright Grant. Subject to the terms and conditions of this License, + each Licensor grants to you a perpetual, worldwide, non-exclusive, + royalty-free, copyright license to reproduce, prepare derivative works of, + publicly display, publicly perform, sublicense and distribute its Work and + any resulting derivative works in any form. + + 2.2 Patent Grant. Subject to the terms and conditions of this License, each + Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free + patent license to make, have made, use, sell, offer for sale, import, and + otherwise transfer its Work, in whole or in part. The foregoing license + applies only to the patent claims licensable by Licensor that would be + infringed by Licensor's Work (or portion thereof) individually and + excluding any combinations with any other materials or technology. + +3. Limitations + + 3.1 Redistribution. You may reproduce or distribute the Work only if + (a) you do so under this License, (b) you include a complete copy of this + License with your distribution, and (c) you retain without modification + any copyright, patent, trademark, or attribution notices that are present + in the Work. + + 3.2 Derivative Works. You may specify that additional or different terms + apply to the use, reproduction, and distribution of your derivative works + of the Work ("Your Terms") only if (a) Your Terms provide that the use + limitation in Section 3.3 applies to your derivative works, and (b) you + identify the specific derivative works that are subject to Your Terms. + Notwithstanding Your Terms, this License (including the redistribution + requirements in Section 3.1) will continue to apply to the Work itself. + + 3.3 Use Limitation. The Work and any derivative works thereof only may be + used or intended for use with the web services, computing platforms or + applications provided by Amazon.com, Inc. or its affiliates, including + Amazon Web Services, Inc. + + 3.4 Patent Claims. If you bring or threaten to bring a patent claim against + any Licensor (including any claim, cross-claim or counterclaim in a + lawsuit) to enforce any patents that you allege are infringed by any Work, + then your rights under this License from such Licensor (including the + grants in Sections 2.1 and 2.2) will terminate immediately. + + 3.5 Trademarks. This License does not grant any rights to use any + Licensor's or its affiliates' names, logos, or trademarks, except as + necessary to reproduce the notices described in this License. + + 3.6 Termination. If you violate any term of this License, then your rights + under this License (including the grants in Sections 2.1 and 2.2) will + terminate immediately. + +4. Disclaimer of Warranty. + + THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR + NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER + THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN + IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU. + +5. Limitation of Liability. + + EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL + THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE + SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, + INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR + RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK (INCLUDING + BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS + OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER COMM ERCIAL DAMAGES + OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF + SUCH DAMAGES. diff --git a/ask-resources.json b/ask-resources.json new file mode 100644 index 0000000..d16882b --- /dev/null +++ b/ask-resources.json @@ -0,0 +1,23 @@ +{ + "askcliResourcesVersion": "2020-03-31", + "profiles": { + "default": { + "skillMetadata": { + "src": "./skill-package" + }, + "code": { + "default": { + "src": "./lambda" + } + }, + "skillInfrastructure": { + "userConfig": { + "runtime": "java11", + "handler": "com.amazon.ask.githubtemplates.GithubTemplatesStreamHandler", + "awsRegion": "eu-west-1" + }, + "type": "@ask-cli/lambda-deployer" + } + } + } +} \ No newline at end of file diff --git a/lambda/pom.xml b/lambda/pom.xml new file mode 100644 index 0000000..014469f --- /dev/null +++ b/lambda/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + alexa-skills-kit-samples + helloworld + jar + 1.0 + helloworld + http://developer.amazon.com/ask + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + Alexa Skills Kit + ask-sdk-java@amazon.com + Alexa + http://developer.amazon.com/ask + + + + scm:git:https://github.com/amzn/alexa-skills-kit-java.git + scm:git:https://github.com/amzn/alexa-skills-kit-java.git + https://github.com/amzn/alexa-skills-kit-java.git + + + + + com.amazon.alexa + ask-sdk + 2.20.2 + + + org.kohsuke + github-api + 1.122 + + + + + src + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 11 + 11 + true + + + + + + + diff --git a/lambda/src/com/amazon/ask/githubtemplates/GithubTemplatesStreamHandler.java b/lambda/src/com/amazon/ask/githubtemplates/GithubTemplatesStreamHandler.java new file mode 100644 index 0000000..5caa6c8 --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/GithubTemplatesStreamHandler.java @@ -0,0 +1,40 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates; + +import com.amazon.ask.Skill; +import com.amazon.ask.Skills; +import com.amazon.ask.SkillStreamHandler; +import com.amazon.ask.githubtemplates.handlers.*; + +public class GithubTemplatesStreamHandler extends SkillStreamHandler { + + private static Skill getSkill() { + return Skills.standard() + .addRequestHandlers( + new CancelandStopIntentHandler(), + new HelloWorldIntentHandler(), + new LoggedInIntentHandler(), + new HelpIntentHandler(), + new LaunchRequestHandler(), + new SessionEndedRequestHandler(), + new FallbackIntentHandler(), + new CreateRepositoryIntentHandler() + ) + .withSkillId("amzn1.ask.skill.e88f24da-5860-4ff8-a674-338c62768016") + .build(); + } + + public GithubTemplatesStreamHandler() { + super(getSkill()); + } + +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java b/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java new file mode 100644 index 0000000..e83f77c --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/data/GithubDataGrabber.java @@ -0,0 +1,72 @@ +package com.amazon.ask.githubtemplates.data; + +import org.kohsuke.github.*; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +public class GithubDataGrabber { + + private Map languagesAndTemplates = + Map.of( + "java", "https://github.com/Spring-Boot-Framework/Spring-Boot-Application-Template", + "typescript", "https://github.com/carsonfarmer/ts-template" + ); + + private GitHub githubApi; + + public GithubDataGrabber(GitHub gitHub){ + this.githubApi = gitHub; + } + +// public static void main(String[] args) throws IOException { +// System.out.println("Grabbing data from your GitHub profile!"); +// +// Path githubConfigPath = Paths.get(Paths.get(System.getProperty("user.dir")).toString(), ".github"); +// if(!new File(githubConfigPath.toString()).exists()){ +// System.out.println("No GitHub config file found, exiting."); +// System.exit(0); +// } +// +// GitHub github = GitHubBuilder.fromPropertyFile(githubConfigPath.toString()).build(); +// +// GithubDataGrabber githubHello = new GithubDataGrabber(github); +// +// githubHello.getLanguages("jlengrand").forEach(System.out::println); +// System.out.println("------"); +// githubHello.getRepositories("jlengrand").forEach(System.out::println); +// } + + public Set getLanguages(String username) throws IOException { + PagedIterable repos = this.githubApi.getUser(username).listRepositories(); + + return StreamSupport.stream(repos.spliterator(), false) + .map(repo -> repo.getLanguage()) + .filter(s -> s != null) + .collect(Collectors.toSet()); + } + + public List getRepositories(String username) throws IOException { + PagedIterable repos = this.githubApi.getUser(username).listRepositories(); + + return StreamSupport.stream(repos.spliterator(), false) + .map(repo -> sanitize(repo.getName())) + .filter(s -> s != null) + .collect(Collectors.toList()); + } + + public String sanitize(String value) { + return value + .replace("-", " ") + .replace("_", " "); + } + +} \ No newline at end of file diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/CancelandStopIntentHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/CancelandStopIntentHandler.java new file mode 100644 index 0000000..4175b56 --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/CancelandStopIntentHandler.java @@ -0,0 +1,35 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class CancelandStopIntentHandler implements RequestHandler { + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("AMAZON.StopIntent").or(intentName("AMAZON.CancelIntent"))); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Got you. Till next time!"; + return input.getResponseBuilder() + .withSpeech(speechText) + .build(); + } +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/CreateRepositoryIntentHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/CreateRepositoryIntentHandler.java new file mode 100644 index 0000000..f9a6df4 --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/CreateRepositoryIntentHandler.java @@ -0,0 +1,62 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.IntentRequest; +import com.amazon.ask.model.Response; +import com.amazon.ask.model.Slot; + +import java.util.Map; +import java.util.Optional; +import java.util.logging.Level; +import java.util.logging.Logger; + +import static com.amazon.ask.request.Predicates.intentName; + +public class CreateRepositoryIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("CreateRepositoryIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + Logger logger = Logger.getAnonymousLogger(); + + String username = System.getenv("GH_USERNAME"); + String key = System.getenv("GH_APIKEY"); + + IntentRequest intentRequest = (IntentRequest) input.getRequestEnvelope().getRequest(); + Map slots = intentRequest.getIntent().getSlots(); + + for (Map.Entry entry : slots.entrySet()) { + logger.log(Level.SEVERE, entry.getKey() + ":" + entry.getValue().getValue() + ":" + entry.getValue().getName()); + } + String speechText; + if(username != null && key != null) { + String language = slots.get("language").getValue(); + String title = slots.get("title").getValue(); + + speechText = "Let's go with " + language + " and " + title + " !"; + } + else{ + speechText = "Sorry, you are not logged in! I cannot create new repositories"; + } + + return input.getResponseBuilder() + .withSpeech(speechText) + .build(); + } + +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/FallbackIntentHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/FallbackIntentHandler.java new file mode 100644 index 0000000..8b97ae4 --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/FallbackIntentHandler.java @@ -0,0 +1,31 @@ +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +// 2018-July-09: AMAZON.FallackIntent is only currently available in en-US locale. +// This handler will not be triggered except in that locale, so it can be +// safely deployed for any locale. +public class FallbackIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("AMAZON.FallbackIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Sorry, I didn't get that. Care to try again ?"; + String repromptText = "Still didn' get that, sorry."; + return input.getResponseBuilder() + .withSpeech(speechText) + .withReprompt(repromptText) + .build(); + } + +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/HelloWorldIntentHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/HelloWorldIntentHandler.java new file mode 100644 index 0000000..8436650 --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/HelloWorldIntentHandler.java @@ -0,0 +1,36 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class HelloWorldIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("HelloWorldIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Hey there! Looking forward what you're going to ask me!"; + return input.getResponseBuilder() + .withSpeech(speechText) + .build(); + } + +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/HelpIntentHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/HelpIntentHandler.java new file mode 100644 index 0000000..ee15f78 --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/HelpIntentHandler.java @@ -0,0 +1,37 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class HelpIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("AMAZON.HelpIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Hey there. Try asking me to create a Java repository!"; + String repromptText = "You can also ask me if you are still logged in Github!"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withReprompt(repromptText) + .build(); + } +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/LaunchRequestHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/LaunchRequestHandler.java new file mode 100644 index 0000000..80bdadd --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/LaunchRequestHandler.java @@ -0,0 +1,38 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.LaunchRequest; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.requestType; + +public class LaunchRequestHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(requestType(LaunchRequest.class)); + } + + @Override + public Optional handle(HandlerInput input) { + String speechText = "Welcome to GitHub templates! Let's create a repository!"; + return input.getResponseBuilder() + .withSpeech(speechText) + .withReprompt(speechText) + .build(); + } + +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/LoggedInIntentHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/LoggedInIntentHandler.java new file mode 100644 index 0000000..1012b7b --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/LoggedInIntentHandler.java @@ -0,0 +1,39 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.intentName; + +public class LoggedInIntentHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(intentName("LoggedInIntent")); + } + + @Override + public Optional handle(HandlerInput input) { + String username = System.getenv("GH_USERNAME"); + String key = System.getenv("GH_APIKEY"); + + String speechText = username == null || key == null ? "Sorry, you are not logged in!" : "Logged in as " + username; + return input.getResponseBuilder() + .withSpeech(speechText) + .build(); + } + +} diff --git a/lambda/src/com/amazon/ask/githubtemplates/handlers/SessionEndedRequestHandler.java b/lambda/src/com/amazon/ask/githubtemplates/handlers/SessionEndedRequestHandler.java new file mode 100644 index 0000000..cea266a --- /dev/null +++ b/lambda/src/com/amazon/ask/githubtemplates/handlers/SessionEndedRequestHandler.java @@ -0,0 +1,35 @@ +/* + Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + http://aws.amazon.com/apache2.0/ + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. +*/ + +package com.amazon.ask.githubtemplates.handlers; + +import com.amazon.ask.dispatcher.request.handler.HandlerInput; +import com.amazon.ask.dispatcher.request.handler.RequestHandler; +import com.amazon.ask.model.Response; +import com.amazon.ask.model.SessionEndedRequest; + +import java.util.Optional; + +import static com.amazon.ask.request.Predicates.requestType; + +public class SessionEndedRequestHandler implements RequestHandler { + + @Override + public boolean canHandle(HandlerInput input) { + return input.matches(requestType(SessionEndedRequest.class)); + } + + @Override + public Optional handle(HandlerInput input) { + // any cleanup logic goes here + return input.getResponseBuilder().build(); + } + +} diff --git a/skill-package/assets/en-GB_largeIcon.png b/skill-package/assets/en-GB_largeIcon.png new file mode 100644 index 0000000..28ee1aa Binary files /dev/null and b/skill-package/assets/en-GB_largeIcon.png differ diff --git a/skill-package/assets/en-GB_smallIcon.png b/skill-package/assets/en-GB_smallIcon.png new file mode 100644 index 0000000..2d1e0da Binary files /dev/null and b/skill-package/assets/en-GB_smallIcon.png differ diff --git a/skill-package/interactionModels/custom/en-GB.json b/skill-package/interactionModels/custom/en-GB.json new file mode 100644 index 0000000..2f82060 --- /dev/null +++ b/skill-package/interactionModels/custom/en-GB.json @@ -0,0 +1,725 @@ +{ + "interactionModel": { + "languageModel": { + "invocationName": "github templates", + "intents": [ + { + "name": "AMAZON.CancelIntent", + "samples": [] + }, + { + "name": "AMAZON.HelpIntent", + "samples": [] + }, + { + "name": "AMAZON.StopIntent", + "samples": [] + }, + { + "name": "HelloWorldIntent", + "slots": [], + "samples": [ + "say hello", + "say hello world", + "hello", + "say hi", + "say hi world", + "hi", + "how are you" + ] + }, + { + "name": "AMAZON.FallbackIntent", + "samples": [] + }, + { + "name": "AMAZON.NavigateHomeIntent", + "samples": [] + }, + { + "name": "LoggedInIntent", + "slots": [], + "samples": [ + "please tell me my username", + "what s my github username", + "am i in github", + "what is my username", + "am i logged in" + ] + }, + { + "name": "CreateRepositoryIntent", + "slots": [ + { + "name": "language", + "type": "GITHUB_LANGUAGE", + "samples": [ + "I want {language}", + "I need {language}", + "{language}" + ] + }, + { + "name": "title", + "type": "GITHUB_TITLE" + } + ], + "samples": [ + "make me a repo called {title}", + "I want a new {language} repo called {title}", + "new {language} repo with name {title}", + "new {language} repository please", + "Create a new repo", + "I need a new repo", + "Create a {language} repository called title in Github", + "I want a new {language} repository in GitHub.", + "Create title and I want it to be a {language} repository", + "I need a new {language} repo. Call it title", + "Create a {language} repository called title" + ] + } + ], + "types": [ + { + "name": "GITHUB_LANGUAGE", + "values": [ + { + "name": { + "value": "CSS" + } + }, + { + "name": { + "value": "Shell" + } + }, + { + "name": { + "value": "Typescript" + } + }, + { + "name": { + "value": "Kotlin" + } + }, + { + "name": { + "value": "HTML" + } + }, + { + "name": { + "value": "Elm" + } + }, + { + "name": { + "value": "Scala" + } + }, + { + "name": { + "value": "c" + } + }, + { + "name": { + "value": "java" + } + } + ] + }, + { + "name": "GITHUB_TITLE", + "values": [ + { + "name": { + "value": "advent of code 2018" + } + }, + { + "name": { + "value": "advent of code 2020" + } + }, + { + "name": { + "value": "alpine node rethinkdb" + } + }, + { + "name": { + "value": "assistant conversation java" + } + }, + { + "name": { + "value": "baker" + } + }, + { + "name": { + "value": "baker recipe tuto" + } + }, + { + "name": { + "value": "batchWaterMarking" + } + }, + { + "name": { + "value": "carbon" + } + }, + { + "name": { + "value": "cellar" + } + }, + { + "name": { + "value": "cellar driver" + } + }, + { + "name": { + "value": "check html links action" + } + }, + { + "name": { + "value": "check html links action test" + } + }, + { + "name": { + "value": "check html links netlify plugin" + } + }, + { + "name": { + "value": "closeme" + } + }, + { + "name": { + "value": "Coding4Interviews" + } + }, + { + "name": { + "value": "coffee voyance" + } + }, + { + "name": { + "value": "conversations" + } + }, + { + "name": { + "value": "create" + } + }, + { + "name": { + "value": "create elm app" + } + }, + { + "name": { + "value": "d3 progress meter" + } + }, + { + "name": { + "value": "design patterns" + } + }, + { + "name": { + "value": "design patterns drawio" + } + }, + { + "name": { + "value": "dialogflow fun" + } + }, + { + "name": { + "value": "dolfijn2.0" + } + }, + { + "name": { + "value": "dotfiles" + } + }, + { + "name": { + "value": "elm dungeon" + } + }, + { + "name": { + "value": "elm firebase" + } + }, + { + "name": { + "value": "elm issues" + } + }, + { + "name": { + "value": "elm language client vscode" + } + }, + { + "name": { + "value": "elm memory" + } + }, + { + "name": { + "value": "elm plural rules" + } + }, + { + "name": { + "value": "elm ports" + } + }, + { + "name": { + "value": "elm webgl playground" + } + }, + { + "name": { + "value": "epaper dashboard blog" + } + }, + { + "name": { + "value": "epaper.js" + } + }, + { + "name": { + "value": "EssentialScala" + } + }, + { + "name": { + "value": "Exposed" + } + }, + { + "name": { + "value": "exposed imdb" + } + }, + { + "name": { + "value": "FaceMovie" + } + }, + { + "name": { + "value": "fortnoxovertime" + } + }, + { + "name": { + "value": "functional programming scala" + } + }, + { + "name": { + "value": "FunctionalProgrammingScalaCoursera" + } + }, + { + "name": { + "value": "fuzzy date" + } + }, + { + "name": { + "value": "github project" + } + }, + { + "name": { + "value": "gitignore" + } + }, + { + "name": { + "value": "gitlab recipes" + } + }, + { + "name": { + "value": "google send money talk" + } + }, + { + "name": { + "value": "hackerrank" + } + }, + { + "name": { + "value": "helidon" + } + }, + { + "name": { + "value": "homemade products" + } + }, + { + "name": { + "value": "image processing" + } + }, + { + "name": { + "value": "ing psd2 test" + } + }, + { + "name": { + "value": "isochrone with google map" + } + }, + { + "name": { + "value": "Ivolution" + } + }, + { + "name": { + "value": "IvolutionWebsite" + } + }, + { + "name": { + "value": "jenkinsArduinoNotification" + } + }, + { + "name": { + "value": "jlengrand.github.io" + } + }, + { + "name": { + "value": "keep a changelog" + } + }, + { + "name": { + "value": "KnowMySize" + } + }, + { + "name": { + "value": "kotlin spring boot elm starter" + } + }, + { + "name": { + "value": "ktor" + } + }, + { + "name": { + "value": "LAFF" + } + }, + { + "name": { + "value": "Leaflet 1" + } + }, + { + "name": { + "value": "linux conf" + } + }, + { + "name": { + "value": "locator" + } + }, + { + "name": { + "value": "MachineLearningCoursera" + } + }, + { + "name": { + "value": "map web component example" + } + }, + { + "name": { + "value": "native utils" + } + }, + { + "name": { + "value": "Observer" + } + }, + { + "name": { + "value": "open wc" + } + }, + { + "name": { + "value": "picasa" + } + }, + { + "name": { + "value": "picocli" + } + }, + { + "name": { + "value": "picocli jfall bitesize 2020" + } + }, + { + "name": { + "value": "pluxml theme darkFuture" + } + }, + { + "name": { + "value": "polymer 3 example" + } + }, + { + "name": { + "value": "polymer array bubble up example" + } + }, + { + "name": { + "value": "polymer dashboard pluralsight" + } + }, + { + "name": { + "value": "polymer hot reloading example" + } + }, + { + "name": { + "value": "polymer summit whose flag" + } + }, + { + "name": { + "value": "polymer summit whose flag polymer 3" + } + }, + { + "name": { + "value": "Programming Tips" + } + }, + { + "name": { + "value": "project euler" + } + }, + { + "name": { + "value": "quarkus" + } + }, + { + "name": { + "value": "quarkus workshop" + } + }, + { + "name": { + "value": "redirectsJekyllToGhost" + } + }, + { + "name": { + "value": "RoBottle" + } + }, + { + "name": { + "value": "rocket" + } + }, + { + "name": { + "value": "scala intro for java guys" + } + }, + { + "name": { + "value": "schopenhauer jfall ignite 2020" + } + }, + { + "name": { + "value": "sheepgame" + } + }, + { + "name": { + "value": "ShowMeYourBigSatellite" + } + }, + { + "name": { + "value": "simpleFoodDiary" + } + }, + { + "name": { + "value": "soundcloud web component application" + } + }, + { + "name": { + "value": "swacli" + } + }, + { + "name": { + "value": "tailwind app" + } + }, + { + "name": { + "value": "therobottle" + } + }, + { + "name": { + "value": "Tippy" + } + }, + { + "name": { + "value": "toggl button" + } + }, + { + "name": { + "value": "twiderboard client" + } + }, + { + "name": { + "value": "twidersite" + } + }, + { + "name": { + "value": "twitterboard" + } + }, + { + "name": { + "value": "undercover" + } + }, + { + "name": { + "value": "vert.x" + } + }, + { + "name": { + "value": "vscode elm signature" + } + }, + { + "name": { + "value": "web components workshop" + } + }, + { + "name": { + "value": "web components workshop deprecated" + } + }, + { + "name": { + "value": "web components workshop polymer" + } + }, + { + "name": { + "value": "webcomponentsjs" + } + }, + { + "name": { + "value": "xuggle xuggler" + } + } + ] + } + ] + }, + "dialog": { + "intents": [ + { + "name": "CreateRepositoryIntent", + "confirmationRequired": false, + "prompts": {}, + "slots": [ + { + "name": "language", + "type": "GITHUB_LANGUAGE", + "confirmationRequired": false, + "elicitationRequired": true, + "prompts": { + "elicitation": "Elicit.Slot.1247776455707.488691447960" + } + }, + { + "name": "title", + "type": "GITHUB_TITLE", + "confirmationRequired": false, + "elicitationRequired": false, + "prompts": {} + } + ] + } + ], + "delegationStrategy": "ALWAYS" + }, + "prompts": [ + { + "id": "Elicit.Slot.1247776455707.488691447960", + "variations": [ + { + "type": "PlainText", + "value": "Which language do you need" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/skill-package/skill.json b/skill-package/skill.json new file mode 100644 index 0000000..b63f5d1 --- /dev/null +++ b/skill-package/skill.json @@ -0,0 +1,29 @@ +{ + "manifest": { + "publishingInformation": { + "locales": { + "en-GB": { + "summary": "Sample Short Description", + "examplePhrases": [ + "Alexa open github templates", + "github templates please" + ], + "name": "github-templates", + "description": "A skill to create new GitHub repositories from templates" + } + }, + "isAvailableWorldwide": true, + "testingInstructions": "Sample Testing Instructions.", + "category": "KNOWLEDGE_AND_TRIVIA", + "distributionCountries": [] + }, + "apis": { + "custom": { + "endpoint": { + "uri": "arn:aws:lambda:eu-west-1:618362251982:function:ask-github-templates-default-default-1614862691817" + } + } + }, + "manifestVersion": "1.0" + } +} \ No newline at end of file