{
    "Amplify Analytics Automated Setup": {
        "prefix": "Amplify Automated Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { Analytics } from 'aws-amplify';",
            "import aws_exports from './aws-exports';",
            "",
            "Amplify.configure(aws_exports);",
        ]
    },
    "Amplify Analytics Manual Setup": {
        "prefix": "Amplify Manual Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "Analytics.configure({",
            "\t// OPTIONAL - disable Analytics if true",
            "\tdisabled: false,",
            "\t// OPTIONAL - Allow recording session events. Default is true.",
            "\tautoSessionRecord: true,",
            "",
            "\tAWSPinpoint: {",
            "\t\t// OPTIONAL -  Amazon Pinpoint App Client ID",
            "\t\tappId: 'XXXXXXXXXXabcdefghij1234567890ab',",
            "\t\t// OPTIONAL -  Amazon service region",
            "\t\tregion: 'XX-XXXX-X',",
            "\t\t// OPTIONAL -  Customized endpoint",
            "\t\tendpointId: 'XXXXXXXXXXXX',",
            "\t\t// OPTIONAL - client context",
            "\t\tclientContext: {",
            "\t\t\tclientId: 'xxxxx',",
            "\t\t\tappTitle: 'xxxxx',",
            "\t\t\tappVersionName: 'xxxxx',",
            "\t\t\tappVersionCode: 'xxxxx',",
            "\t\t\tappPackageName: 'xxxxx',",
            "\t\t\tplatform: 'xxxxx',",
            "\t\t\tplatformVersion: 'xxxxx',",
            "\t\t\tmodel: 'xxxxx',",
            "\t\t\tmake: 'xxxxx',",
            "\t\t\tlocale: 'xxxxx'",
            "\t\t},",
            "",
            "\t\t// Buffer settings used for reporting analytics events.",
            "",
            "\t\t// OPTIONAL - The buffer size for events in number of items.",
            "\t\tbufferSize: 1000,",
            "",
            "\t\t// OPTIONAL - The interval in milliseconds to perform a buffer check and flush if necessary.",
            "\t\tflushInterval: 5000, // 5s ",
            "",
            "\t\t// OPTIONAL - The number of events to be deleted from the buffer when flushed.",
            "\t\tflushSize: 100,",
            "",
            "\t\t// OPTIONAL - The limit for failed recording retries.",
            "\t\tresendLimit: 5",
            "\t} ",
            "});",
        ]
    },
    "Amplify Analytics Recording A Custom Tracking Event": {
        "prefix": "Amplify Recording A Custom Tracking Event",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "Analytics.record({ name: 'albumVisit' });",
        ]
    },
    "Amplify Analytics Record A Custom Tracking Event With Attributes": {
        "prefix": "Amplify Record A Custom Tracking Event With Attributes",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "Analytics.record({",
            "\tname: 'albumVisit', ",
            "\tattributes: { genre: '', artist: '' }",
            "});",
        ]
    },
    "Amplify Analytics Record Engagement Metrics": {
        "prefix": "Amplify Record Engagement Metrics",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "Analytics.record({",
            "\tname: 'albumVisit', ",
            "\tattributes: {}, ",
            "\tmetrics: { minutesListened: 30 }",
            "});",
        ]
    },
    "Amplify Analytics Disable/Enable Analytics": {
        "prefix": "Amplify Disable/Enable Analytics",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "// to disable Analytics",
            "Analytics.disable();",
            "",
            "// to enable Analytics",
            "Analytics.enable();",
        ]
    },
    "Amplify Analytics Record Authentication Events": {
        "prefix": "Amplify Record Authentication Events",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "// Sign-in event",
            "Analytics.record({",
            "\tname: '_userauth.sign_in'",
            "});",
            "",
            "// Sign-up event",
            "Analytics.record({",
            "\tname: '_userauth.sign_up'",
            "});",
            "",
            "// Authentication failure event",
            "Analytics.record({",
            "\tname: '_userauth.auth_fail'",
            "});",
        ]
    },
    "Amplify Analytics Update User Attributes": {
        "prefix": "Amplify Update User Attributes",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics } from 'aws-amplify';",
            "",
            "Analytics.updateEndpoint({",
            "\t// Customized userId",
            "\tUserId: 'XXXXXXXXXXXX',",
            "\t// User attributes",
            "\tAttributes: {",
            "\t\tinterests: ['football', 'basketball', 'AWS']",
            "\t\t// ...",
            "\t},",
            "\t// Custom user attributes",
            "\tUserAttributes: {",
            "\t\thobbies: ['piano', 'hiking']",
            "\t\t// ...",
            "\t}",
            "})",
        ]
    },
    "Amplify Analytics Installation And Configuration": {
        "prefix": "Amplify Installation And Configuration",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Analytics, AWSKinesisProvider } from 'aws-amplify';",
            "Analytics.addPluggable(new AWSKinesisProvider());",
            "",
        ]
    },
    "Amplify Analytics Installation And Configuration 2": {
        "prefix": "Amplify Installation And Configuration 2",
        "scope": "json",
        "body": [
            "{",
            "\t\"Version\": \"2012-10-17\",",
            "\t\"Statement\": [",
            "\t\t{",
            "\t\t\t\"Effect\": \"Allow\",",
            "\t\t\t\"Action\": [",
            "\t\t\t\t\"kinesis:PutRecord\",",
            "\t\t\t\t\"kinesis:PutRecords\"",
            "\t\t\t],",
            "\t\t\t\"Resource\": \"*\"",
            "\t\t}",
            "\t]",
            "}",
        ]
    },
    "Amplify Analytics Installation And Configuration 3": {
        "prefix": "Amplify Installation And Configuration 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "",
            "// Configure the plugin after adding it to the Analytics module",
            "Analytics.configure({",
            "\tAWSKinesis: {",
            "",
            "\t\t// OPTIONAL -  Amazon Kinesis service region",
            "\t\tregion: 'XX-XXXX-X',",
            "\t\t",
            "\t\t// OPTIONAL - The buffer size for events in number of items.",
            "\t\tbufferSize: 1000,",
            "\t\t",
            "\t\t// OPTIONAL - The number of events to be deleted from the buffer when flushed.",
            "\t\tflushSize: 100,",
            "\t\t",
            "\t\t// OPTIONAL - The interval in milliseconds to perform a buffer check and flush if necessary.",
            "\t\tflushInterval: 5000, // 5s",
            "\t\t",
            "\t\t// OPTIONAL - The limit for failed recording retries.",
            "\t\tresendLimit: 5",
            "\t} ",
            "});",
            "",
        ]
    },
    "Amplify Analytics Working With The Api": {
        "prefix": "Amplify Working With The Api",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Analytics.record({",
            "\tdata: { ",
            "\t\t// The data blob to put into the record",
            "\t},",
            "\t// OPTIONAL",
            "\tpartitionKey: 'myPartitionKey', ",
            "\tstreamName: 'myKinesisStream'",
            "}, 'AWSKinesis');",
        ]
    },
    "Amplify Analytics Using A Custom Plugin": {
        "prefix": "Amplify Using A Custom Plugin",
        "scope": "typescript",
        "body": [
            "import { Analytics, AnalyticsProvider } from 'aws-amplify';",
            "",
            "export default class MyAnalyticsProvider implements AnalyticsProvider {",
            "\t// category and provider name",
            "\tstatic category = 'Analytics';",
            "\tstatic providerName = 'MyAnalytics';",
            "",
            "\t// you need to implement these four methods",
            "\t// configure your provider",
            "\tconfigure(config: object): object;",
            "",
            "\t// record events and returns true if succeeds",
            "\trecord(params: object): Promise<boolean>;",
            "",
            "\t// return 'Analytics';",
            "\tgetCategory(): string;",
            "",
            "\t// return the name of you provider",
            "\tgetProviderName(): string;",
            "}",
        ]
    },
    "Amplify Analytics Using A Custom Plugin 2": {
        "prefix": "Amplify Using A Custom Plugin 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// add the plugin",
            "Analytics.addPluggable(new MyAnalyticsProvider());",
            "",
            "// get the plugin",
            "Analytics.getPluggable(MyAnalyticsProvider.providerName);",
            "",
            "// remove the plulgin",
            "Analytics.removePluggable(MyAnalyticsProvider.providerName);",
            "",
            "// send configuration into Amplify",
            "Analytics.configure({",
            "\tYOUR_PLUGIN_NAME: { ",
            "\t\t// My Analytics provider configuration ",
            "\t}",
            "});",
            "",
        ]
    },
    "Amplify Analytics Using Modularized Module": {
        "prefix": "Amplify Using Modularized Module",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Analytics from '@aws-amplify/analytics';",
            "",
            "Analytics.configure();",
            "",
        ]
    },
    "Amplify Angular Setup": {
        "prefix": "Amplify Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "\"scripts\": {",
            "\t\"start\": \"[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || ng serve; ng serve\",",
            "\t\"build\": \"[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || ng build --prod; ng build --prod\"",
            "}",
        ]
    },
    "Amplify Angular Setup 2": {
        "prefix": "Amplify Setup 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify from 'aws-amplify';",
            "import awsmobile from './aws-exports';",
            "Amplify.configure(awsmobile);",
        ]
    },
    "Amplify Angular Setup 3": {
        "prefix": "Amplify Setup 3",
        "scope": "json",
        "body": [
            "\"compilerOptions\": {",
            "\t\"types\" : [\"node\"]",
            "}",
        ]
    },
    "Amplify Angular Setup 4": {
        "prefix": "Amplify Setup 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "\"defaults\": {",
            "\t\"styleExt\": \"css\",",
            "\t\"component\": {},",
            "\t\"build\": {",
            "\t\t\"preserveSymlinks\": true",
            "\t}",
            "}",
        ]
    },
    "Amplify Angular Importing Amplify": {
        "prefix": "Amplify Importing Amplify",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { AmplifyAngularModule, AmplifyService } from 'aws-amplify-angular';",
            "",
            "@NgModule({",
            "...",
            "imports: [",
            "\t...",
            "\tAmplifyAngularModule",
            "],",
            "...",
            "providers: [",
            "\t...",
            "\tAmplifyService",
            "]",
            "...",
            "});",
        ]
    },
    "Amplify Angular Using Dependency Injection": {
        "prefix": "Amplify Using Dependency Injection",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { AmplifyService } from 'aws-amplify-angular';",
            "",
            "...",
            "constructor(",
            "\tpublic navCtrl:NavController,",
            "\tpublic amplifyService: AmplifyService,",
            "\tpublic modalCtrl: ModalController",
            ") {",
            "\tthis.amplifyService = amplifyService;",
            "}",
            "...",
        ]
    },
    "Amplify Angular Using Aws Amplify Categories": {
        "prefix": "Amplify Using Aws Amplify Categories",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Component } from '@angular/core';",
            "import { AmplifyService }  from 'aws-amplify-angular';",
            "",
            "@Component({",
            "selector: 'app-root',",
            "templateUrl: './app.component.html',",
            "styleUrls: ['./app.component.css']",
            "})",
            "",
            "export class AppComponent {",
            "",
            "constructor( public amplify:AmplifyService ) {",
            "\t",
            "\tthis.amplifyService = amplify;",
            "\t",
            "\t/** now you can access category APIs:",
            "\t* this.amplifyService.auth();          // AWS Amplify Auth",
            "\t* this.amplifyService.analytics();     // AWS Amplify Analytics",
            "\t* this.amplifyService.storage();       // AWS Amplify Storage",
            "\t* this.amplifyService.api();           // AWS Amplify API",
            "\t* this.amplifyService.cache();         // AWS Amplify Cache",
            "\t* this.amplifyService.pubsub();        // AWS Amplify PubSub",
            "\t**/",
            "}",
            "",
            "}",
        ]
    },
    "Amplify Angular Usage Example: Subscribe To Authentication State Changes": {
        "prefix": "Amplify Usage Example: Subscribe To Authentication State Changes",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { AmplifyService }  from 'aws-amplify-angular';",
            "",
            "// ...",
            "constructor( public amplifyService: AmplifyService ) {",
            "",
            "\tthis.amplifyService = amplifyService;",
            "",
            "\tthis.amplifyService.authStateChange\\$",
            "\t\t.subscribe(authState => {",
            "\t\tthis.signedIn = authState.state === 'signedIn';",
            "\t\tif (!authState.user) {",
            "\t\t\tthis.user = null;",
            "\t\t} else {",
            "\t\t\tthis.user = authState.user;",
            "\t\t\tthis.greeting = \"Hello \" + this.user.username;",
            "\t\t}",
            "\t\t});",
            "",
            "}",
        ]
    },
    "Amplify Angular Photo Picker": {
        "prefix": "Amplify Photo Picker",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "onImagePicked( file ) {",
            "",
            "\tlet key = `pics/\\${file.name}`;",
            "\t",
            "\tthis.amplify.storage().put( key, file, {",
            "\t'level': 'private',",
            "\t'contentType': file.type",
            "\t})",
            "\t.then (result => console.log('uploaded: ', result))",
            "\t.catch(err => console.log('upload error: ', err));",
            "",
            "}",
        ]
    },
    "Amplify Angular S3 Album": {
        "prefix": "Amplify S3 Album",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "onAlbumImageSelected( event ) {",
            "\twindow.open( event, '_blank' );",
            "}",
        ]
    },
    "Amplify Api Automated Setup": {
        "prefix": "Amplify Automated Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { API } from 'aws-amplify';",
            "import aws_exports from './aws-exports';",
            "",
            "Amplify.configure(aws_exports);",
        ]
    },
    "Amplify Api Manual Setup": {
        "prefix": "Amplify Manual Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { API } from 'aws-amplify';",
            "",
            "Amplify.configure({",
            "\tAuth: {",
            "\t// REQUIRED - Amazon Cognito Identity Pool ID",
            "\t\tidentityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab',",
            "\t// REQUIRED - Amazon Cognito Region",
            "\t\tregion: 'XX-XXXX-X', ",
            "\t// OPTIONAL - Amazon Cognito User Pool ID",
            "\t\tuserPoolId: 'XX-XXXX-X_abcd1234', ",
            "\t// OPTIONAL - Amazon Cognito Web Client ID",
            "\t\tuserPoolWebClientId: 'XX-XXXX-X_abcd1234',",
            "\t},",
            "\tAPI: {",
            "\t\tendpoints: [",
            "\t\t\t{",
            "\t\t\t\tname: \"MyAPIGatewayAPI\",",
            "\t\t\t\tendpoint: \"https://1234567890-abcdefgh.amazonaws.com\"",
            "\t\t\t},",
            "\t\t\t{",
            "\t\t\t\tname: \"MyCustomCloudFrontApi\",",
            "\t\t\t\tendpoint: \"https://api.my-custom-cloudfront-domain.com\",",
            "",
            "\t\t\t},",
            "\t\t\t{",
            "\t\t\t\tname: \"MyCustomLambdaApi\",",
            "\t\t\t\tendpoint: \"https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/yourFuncName/invocations\",",
            "\t\t\t\tservice: \"lambda\",",
            "\t\t\t\tregion: \"us-east-1\"",
            "\t\t\t}",
            "\t\t]",
            "\t}",
            "});",
        ]
    },
    "Amplify Api Aws Regional Endpoints": {
        "prefix": "Amplify Aws Regional Endpoints",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "API: {",
            "\tendpoints: [",
            "\t\t{",
            "\t\t\tname: \"MyCustomLambdaApi\",",
            "\t\t\tendpoint: \"https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/yourFuncName/invocations\",",
            "\t\t\tservice: \"lambda\",",
            "\t\t\tregion: \"us-east-1\"",
            "\t\t}",
            "\t]",
            "}",
        ]
    },
    "Amplify Api Get**": {
        "prefix": "Amplify Get**",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let apiName = 'MyApiName';",
            "let path = '/path'; ",
            "let myInit = { // OPTIONAL",
            "\theaders: {} // OPTIONAL",
            "\tresponse: true // OPTIONAL (return entire response object instead of response.data)",
            "\tqueryStringParameters: {} // OPTIONAL",
            "}",
            "API.get(apiName, path, myInit).then(response => {",
            "\t// Add your code here",
            "}).catch(error => {",
            "\tconsole.log(error.response)",
            "});",
        ]
    },
    "Amplify Api Get** 2": {
        "prefix": "Amplify Get** 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "async function getData() { ",
            "\tlet apiName = 'MyApiName';",
            "\tlet path = '/path';",
            "\tlet myInit = { // OPTIONAL",
            "\t\theaders: {} // OPTIONAL",
            "\t}",
            "\treturn await API.get(apiName, path, myInit);",
            "}",
            "",
            "getData();",
        ]
    },
    "Amplify Api Get** 3": {
        "prefix": "Amplify Get** 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let items = await API.get('myCloudApi', '/items', {",
            "'queryStringParameters': {",
            "\t'order': 'byPrice'",
            "}",
            "});",
        ]
    },
    "Amplify Api Get** 4": {
        "prefix": "Amplify Get** 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "exports.handler = function(event, context, callback) {",
            "\tconsole.log (event.queryStringParameters);",
            "}",
        ]
    },
    "Amplify Api Get** 5": {
        "prefix": "Amplify Get** 5",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "var awsServerlessExpressMiddleware = require('aws-serverless-express/middleware')",
            "app.use(awsServerlessExpressMiddleware.eventContext())",
        ]
    },
    "Amplify Api Get** 6": {
        "prefix": "Amplify Get** 6",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "app.get('/items', function(req, res) {",
            "// req.apiGateway.event.queryStringParameters",
            "res.json(req.apiGateway.event)",
            "});",
        ]
    },
    "Amplify Api Get** 7": {
        "prefix": "Amplify Get** 7",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "API.get('sampleCloudApi', '/items?q=test');",
        ]
    },
    "Amplify Api Post**": {
        "prefix": "Amplify Post**",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let apiName = 'MyApiName'; // replace this with your api name.",
            "let path = '/path'; //replace this with the path you have configured on your API",
            "let myInit = {",
            "\tbody: {}, // replace this with attributes you need",
            "\theaders: {} // OPTIONAL",
            "}",
            "",
            "API.post(apiName, path, myInit).then(response => {",
            "\t// Add your code here",
            "}).catch(error => {",
            "\tconsole.log(error.response)",
            "});",
        ]
    },
    "Amplify Api Post** 2": {
        "prefix": "Amplify Post** 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "async function postData() { ",
            "\tlet apiName = 'MyApiName';",
            "\tlet path = '/path';",
            "\tlet myInit = { // OPTIONAL",
            "\t\tbody: {}, // replace this with attributes you need",
            "\t\theaders: {} // OPTIONAL",
            "\t}",
            "\treturn await API.post(apiName, path, myInit);",
            "}",
            "",
            "postData();",
        ]
    },
    "Amplify Api Put**": {
        "prefix": "Amplify Put**",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let apiName = 'MyApiName'; // replace this with your api name.",
            "let path = '/path'; // replace this with the path you have configured on your API",
            "let myInit = {",
            "\tbody: {}, // replace this with attributes you need",
            "\theaders: {} // OPTIONAL",
            "}",
            "",
            "API.put(apiName, path, myInit).then(response => {",
            "\t// Add your code here",
            "}).catch(error => {",
            "\tconsole.log(error.response)",
            "});",
        ]
    },
    "Amplify Api Put** 2": {
        "prefix": "Amplify Put** 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "async function putData() { ",
            "\tlet apiName = 'MyApiName';",
            "\tlet path = '/path';",
            "\tlet myInit = { // OPTIONAL",
            "\t\tbody: {}, // replace this with attributes you need",
            "\t\theaders: {} // OPTIONAL",
            "\t}",
            "\treturn await API.put(apiName, path, myInit);",
            "}",
            "",
            "putData();",
        ]
    },
    "Amplify Api Put** 3": {
        "prefix": "Amplify Put** 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const params = {",
            "\tbody: {",
            "\t\titemId: '12345',",
            "\t\titemDesc: ' update description'",
            "\t}",
            "}",
            "const apiResponse = await API.put('MyTableCRUD', '/manage-items', params);",
        ]
    },
    "Amplify Api Delete**": {
        "prefix": "Amplify Delete**",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let apiName = 'MyApiName'; // replace this with your api name.",
            "let path = '/path'; //replace this with the path you have configured on your API",
            "let myInit = { // OPTIONAL",
            "\theaders: {} // OPTIONAL",
            "}",
            "",
            "API.del(apiName, path, myInit).then(response => {",
            "\t// Add your code here",
            "}).catch(error => {",
            "\tconsole.log(error.response)",
            "});",
        ]
    },
    "Amplify Api Delete** 2": {
        "prefix": "Amplify Delete** 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "async function deleteData() { ",
            "\tlet apiName = 'MyApiName';",
            "\tlet path = '/path';",
            "\tlet myInit = { // OPTIONAL",
            "\t\theaders: {} // OPTIONAL",
            "\t}",
            "\treturn await API.del(apiName, path, myInit);",
            "}",
            "",
            "deleteData();",
        ]
    },
    "Amplify Api Head**": {
        "prefix": "Amplify Head**",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let apiName = 'MyApiName'; // replace this with your api name.",
            "let path = '/path'; //replace this with the path you have configured on your API",
            "let myInit = { // OPTIONAL",
            "\theaders: {} // OPTIONAL",
            "}",
            "API.head(apiName, path, myInit).then(response => {",
            "\t// Add your code here",
            "});",
        ]
    },
    "Amplify Api Head** 2": {
        "prefix": "Amplify Head** 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "async function head() { ",
            "\tlet apiName = 'MyApiName';",
            "\tlet path = '/path';",
            "\tlet myInit = { // OPTIONAL",
            "\t\theaders: {} // OPTIONAL",
            "\t}",
            "\treturn await API.head(apiName, path, myInit);",
            "}",
            "",
            "head();",
        ]
    },
    "Amplify Api Custom Request Headers": {
        "prefix": "Amplify Custom Request Headers",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Amplify.configure({",
            "API: {",
            "\tendpoints: [",
            "\t{",
            "\t\tname: \"sampleCloudApi\",",
            "\t\tendpoint: \"https://xyz.execute-api.us-east-1.amazonaws.com/Development\",",
            "\t\tcustom_header: async () => { ",
            "\t\treturn { Authorization : 'token' } ",
            "\t\t// Alternatively, with Cognito User Pools use this:",
            "\t\t// return { Authorization: (await Auth.currentSession()).idToken.jwtToken } ",
            "\t\t}",
            "\t}",
            "\t]",
            "}",
            "});",
        ]
    },
    "Amplify Api Configuration For Graphql Server": {
        "prefix": "Amplify Configuration For Graphql Server",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "",
            "import Amplify, { API } from \"aws-amplify\";",
            "import aws_config from \"./aws-exports\";",
            "",
            "// Considering you have an existing aws-exports.js configuration file ",
            "Amplify.configure(aws_config);",
            "",
            "// Configure a custom GraphQL endpoint",
            "Amplify.configure({",
            "API: {",
            "\tgraphql_endpoint: 'https:/www.example.com/my-graphql-endpoint'",
            "}",
            "});",
            "",
        ]
    },
    "Amplify Api Set Custom Request Headers For Graphql ": {
        "prefix": "Amplify Set Custom Request Headers For Graphql ",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Amplify.configure({",
            "API: {",
            "\tgraphql_headers: async () => ({",
            "\t'My-Custom-Header': 'my value'",
            "\t})",
            "}",
            "});",
        ]
    },
    "Amplify Api Automated Configuration With Cli": {
        "prefix": "Amplify Automated Configuration With Cli",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import aws_config from \"./aws-exports\";",
            "Amplify.configure(aws_config);",
        ]
    },
    "Amplify Api Using Api_Key": {
        "prefix": "Amplify Using Api_Key",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let myAppConfig = {",
            "\t// ...",
            "\t'aws_appsync_graphqlEndpoint': 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',",
            "\t'aws_appsync_region': 'us-east-1',",
            "\t'aws_appsync_authenticationType': 'API_KEY',",
            "\t'aws_appsync_apiKey': 'da2-xxxxxxxxxxxxxxxxxxxxxxxxxx',",
            "\t// ...",
            "}",
            "",
            "Amplify.configure(myAppConfig);",
        ]
    },
    "Amplify Api Using Aws_Iam": {
        "prefix": "Amplify Using Aws_Iam",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let myAppConfig = {",
            "\t// ...",
            "\t'aws_appsync_graphqlEndpoint': 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',",
            "\t'aws_appsync_region': 'us-east-1',",
            "\t'aws_appsync_authenticationType': 'AWS_IAM',",
            "\t// ...",
            "}",
            "",
            "Amplify.configure(myAppConfig);",
        ]
    },
    "Amplify Api Using Amazon_Cognito_User_Pools": {
        "prefix": "Amplify Using Amazon_Cognito_User_Pools",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let myAppConfig = {",
            "\t// ...",
            "\t'aws_appsync_graphqlEndpoint': 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',",
            "\t'aws_appsync_region': 'us-east-1',",
            "\t'aws_appsync_authenticationType': 'AMAZON_COGNITO_USER_POOLS', // You have configured Auth with Amazon Cognito User Pool ID and Web Client Id",
            "\t// ...",
            "}",
            "",
            "Amplify.configure(myAppConfig);",
        ]
    },
    "Amplify Api Using Openid_Connect": {
        "prefix": "Amplify Using Openid_Connect",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let myAppConfig = {",
            "\t// ...",
            "\t'aws_appsync_graphqlEndpoint': 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',",
            "\t'aws_appsync_region': 'us-east-1',",
            "\t'aws_appsync_authenticationType': 'OPENID_CONNECT', // Before calling API.graphql(...) is required to do Auth.federatedSignIn(...) check authentication guide for details.",
            "\t// ...",
            "}",
            "",
            "Amplify.configure(myAppConfig);",
        ]
    },
    "Amplify Api Query Declarations": {
        "prefix": "Amplify Query Declarations",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const ListEvents = `query ListEvents {",
            "listEvents {",
            "\titems {",
            "\tid",
            "\twhere",
            "\tdescription",
            "\t}",
            "}",
            "}`;",
        ]
    },
    "Amplify Api Query Declarations 2": {
        "prefix": "Amplify Query Declarations 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const GetEvent = `query GetEvent(\\$id: ID! \\$nextToken: String) {",
            "\tgetEvent(id: \\$id) {",
            "\t\tid",
            "\t\tname",
            "\t\tdescription",
            "\t\tcomments(nextToken: \\$nextToken) {",
            "\t\t\titems {",
            "\t\t\t\tcontent",
            "\t\t\t}",
            "\t\t}",
            "\t}",
            "}`;",
        ]
    },
    "Amplify Api Simple Query": {
        "prefix": "Amplify Simple Query",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { API, graphqlOperation } from \"aws-amplify\";",
            "",
            "const ListEvents = `query ListEvents {",
            "listEvents {",
            "\titems {",
            "\tid",
            "\twhere",
            "\tdescription",
            "\t}",
            "}",
            "}`;",
            "",
            "const GetEvent = `query GetEvent(\\$id: ID! \\$nextToken: String) {",
            "\tgetEvent(id: \\$id) {",
            "\t\tid",
            "\t\tname",
            "\t\tdescription",
            "\t\tcomments(nextToken: \\$nextToken) {",
            "\t\t\titems {",
            "\t\t\t\tcontent",
            "\t\t\t}",
            "\t\t}",
            "\t}",
            "}`;",
            "",
            "// Simple query",
            "const allEvents = await API.graphql(graphqlOperation(ListEvents));",
            "",
            "// Query using a parameter",
            "const oneEvent = await API.graphql(graphqlOperation(GetEvent, { id: 'some id' }));",
            "console.log(oneEvent);",
            "",
        ]
    },
    "Amplify Api Mutations": {
        "prefix": "Amplify Mutations",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { API, graphqlOperation } from \"aws-amplify\";",
            "",
            "const CreateEvent = `mutation CreateEvent(\\$name: String!, \\$when: String!, \\$where: String!, \\$description: String!) {",
            "createEvent(name: \\$name, when: \\$when, where: \\$where, description: \\$description) {",
            "\tid",
            "\tname",
            "\twhere",
            "\twhen",
            "\tdescription",
            "}",
            "}`;",
            "",
            "// Mutation",
            "const eventDetails = {",
            "\tname: 'Party tonight!',",
            "\twhen: '8:00pm',",
            "\twhere: 'Ballroom',",
            "\tdescription: 'Coming together as a team!'",
            "};",
            "",
            "const newEvent = await API.graphql(graphqlOperation(CreateEvent, eventDetails));",
            "console.log(newEvent);",
        ]
    },
    "Amplify Api Subscriptions": {
        "prefix": "Amplify Subscriptions",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { API, graphqlOperation } from \"aws-amplify\";",
            "",
            "const SubscribeToEventComments = `subscription SubscribeToEventComments(\\$eventId: String!) {",
            "subscribeToEventComments(eventId: \\$eventId) {",
            "\teventId",
            "\tcommentId",
            "\tcontent",
            "}",
            "}`;",
            "",
            "// Subscribe with eventId 123",
            "const subscription = API.graphql(",
            "\tgraphqlOperation(SubscribeToEventComments, { eventId: '123' })",
            ").subscribe({",
            "\tnext: (eventData) => console.log(eventData)",
            "});",
            "",
            "// Stop receiving data updates from the subscription",
            "subscription.unsubscribe();",
            "",
        ]
    },
    "Amplify Api Subscriptions 2": {
        "prefix": "Amplify Subscriptions 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Amplify.configure({",
            "Auth: {",
            "\tidentityPoolId: 'xxx',",
            "\tregion: 'xxx' ,",
            "\tcookieStorage: {",
            "\tdomain: 'xxx',",
            "\tpath: 'xxx',",
            "\tsecure: true",
            "\t}",
            "},",
            "aws_appsync_graphqlEndpoint: 'xxxx',",
            "aws_appsync_region: 'xxxx',",
            "aws_appsync_authenticationType: 'xxxx',",
            "aws_appsync_apiKey: 'xxxx'",
            "});",
        ]
    },
    "Amplify Api Signing Request With Iam": {
        "prefix": "Amplify Signing Request With Iam",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Amplify.configure({",
            "API: {",
            "\tgraphql_endpoint: 'https://www.example.com/my-graphql-endpoint',",
            "\tgraphql_endpoint_iam_region: 'my_graphql_apigateway_region'",
            "}",
            "});",
        ]
    },
    "Amplify Api Connect": {
        "prefix": "Amplify Connect",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import React from 'react';",
            "import Amplify, { graphqlOperation }  from \"aws-amplify\";",
            "import { Connect } from \"aws-amplify-react\";",
            "",
            "class App extends React.Component {",
            "",
            "\trender() {",
            "",
            "\t\tconst ListView = ({ events }) => (",
            "\t\t\t<div>",
            "\t\t\t\t<h3>All events</h3>",
            "\t\t\t\t<ul>",
            "\t\t\t\t\t{events.map(event => <li key={event.id}>{event.name} ({event.id})</li>)}",
            "\t\t\t\t</ul>",
            "\t\t\t</div>",
            "\t\t);",
            "",
            "\t\tconst ListEvents = `query ListEvents {",
            "\t\t\tlistEvents {",
            "\t\t\t\titems {",
            "\t\t\t\tid",
            "\t\t\t\tname",
            "\t\t\t\tdescription",
            "\t\t\t\t}",
            "\t\t\t}",
            "\t\t}`;",
            "",
            "\t\treturn (",
            "\t\t\t<Connect query={graphqlOperation(ListEvents)}>",
            "\t\t\t\t{({ data: { listEvents } }) => (",
            "\t\t\t\t\t<ListView events={listEvents.items} />",
            "\t\t\t\t)}",
            "\t\t\t</Connect>",
            "\t\t)",
            "\t}",
            "} ",
            "",
            "export default App;",
            "",
        ]
    },
    "Amplify Api Connect 2": {
        "prefix": "Amplify Connect 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "",
            "<Connect  query={graphqlOperation(GetEvent, { id: currEventId })}",
            "\t\tsubscription={graphqlOperation(SubscribeToEventComments, { eventId: currEventId })}",
            "\t\tonSubscriptionMsg={(prev, { subscribeToEventComments }) => {",
            "\t\t\tconsole.log ( subscribeToEventComments);",
            "\t\t\treturn prev; }}>",
            "\t{({ data: { listEvents } }) => (",
            "\t\t<AllEvents events={listEvents ? listEvents.items : []} />",
            "\t)}",
            "</Connect>",
            "",
        ]
    },
    "Amplify Api Connect 3": {
        "prefix": "Amplify Connect 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "class CreateEvent extends React.Component {",
            "// ...",
            "// This component calls its onCreate prop to trigger the mutation",
            "// ...",
            "}",
            "<Connect mutation={graphqlOperation(Operations.CreateEvent)}>",
            "{({ mutation }) => (",
            "\t<CreateEvent onCreate={mutation} />",
            ")}",
            "</Connect>",
        ]
    },
    "Amplify Api Using Modularized Module": {
        "prefix": "Amplify Using Modularized Module",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import API from '@aws-amplify/api';",
            "",
            "API.configure();",
            "",
        ]
    },
    "Amplify Authentication Automated Setup": {
        "prefix": "Amplify Automated Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { Auth } from 'aws-amplify';",
            "import aws_exports from './aws-exports'; // specify the location of aws-exports.js file on your project",
            "Amplify.configure(aws_exports);",
        ]
    },
    "Amplify Authentication Manual Setup": {
        "prefix": "Amplify Manual Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify from 'aws-amplify';",
            "",
            "Amplify.configure({",
            "\tAuth: {",
            "",
            "\t\t// REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID",
            "\t\tidentityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab',",
            "\t\t",
            "\t\t// REQUIRED - Amazon Cognito Region",
            "\t\tregion: 'XX-XXXX-X',",
            "",
            "\t\t// OPTIONAL - Amazon Cognito Federated Identity Pool Region ",
            "\t\t// Required only if it's different from Amazon Cognito Region",
            "\t\tidentityPoolRegion: 'XX-XXXX-X',",
            "",
            "\t\t// OPTIONAL - Amazon Cognito User Pool ID",
            "\t\tuserPoolId: 'XX-XXXX-X_abcd1234',",
            "",
            "\t\t// OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)",
            "\t\tuserPoolWebClientId: 'a1b2c3d4e5f6g7h8i9j0k1l2m3',",
            "",
            "\t\t// OPTIONAL - Enforce user authentication prior to accessing AWS resources or not",
            "\t\tmandatorySignIn: false,",
            "",
            "\t\t// OPTIONAL - Configuration for cookie storage",
            "\t\tcookieStorage: {",
            "\t\t// REQUIRED - Cookie domain (only required if cookieStorage is provided)",
            "\t\t\tdomain: '.yourdomain.com',",
            "\t\t// OPTIONAL - Cookie path",
            "\t\t\tpath: '/',",
            "\t\t// OPTIONAL - Cookie expiration in days",
            "\t\t\texpires: 365,",
            "\t\t// OPTIONAL - Cookie secure flag",
            "\t\t\tsecure: true",
            "\t\t},",
            "",
            "\t\t// OPTIONAL - customized storage object",
            "\t\tstorage: new MyStorage(),",
            "\t\t",
            "\t\t// OPTIONAL - Manually set the authentication flow type. Default is 'USER_SRP_AUTH'",
            "\t\tauthenticationFlowType: 'USER_PASSWORD_AUTH'",
            "\t}",
            "});",
        ]
    },
    "Amplify Authentication Node.Js Support": {
        "prefix": "Amplify Node.Js Support",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "global.fetch = require('node-fetch');",
        ]
    },
    "Amplify Authentication Sign In": {
        "prefix": "Amplify Sign In",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "Auth.signIn(username, password)",
            "\t.then(user => console.log(user))",
            "\t.catch(err => console.log(err));",
            "",
            "// If MFA is enabled, sign-in should be confirmed with the congirmation code",
            "// `user` : Return object from Auth.signIn()",
            "// `code` : Confirmation code  ",
            "// `mfaType` : MFA Type e.g. SMS, TOTP.",
            "Auth.confirmSignIn(user, code, mfaType)",
            "\t.then(data => console.log(data))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Authentication Sign Up": {
        "prefix": "Amplify Sign Up",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "Auth.signUp({",
            "\tusername,",
            "\tpassword,",
            "\tattributes: {",
            "\t\temail,          // optional",
            "\t\tphone_number,   // optional - E.164 number convention",
            "\t\t// other custom attributes ",
            "\t},",
            "\tvalidationData: []  //optional",
            "\t})",
            "\t.then(data => console.log(data))",
            "\t.catch(err => console.log(err));",
            "",
            "// After retrieveing the confirmation code from the user",
            "Auth.confirmSignUp(username, code, {",
            "\t// Optional. Force user confirmation irrespective of existing alias. By default set to True.",
            "\tforceAliasCreation: true    ",
            "}).then(data => console.log(data))",
            ".catch(err => console.log(err));",
        ]
    },
    "Amplify Authentication Sign Out": {
        "prefix": "Amplify Sign Out",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "Auth.signOut()",
            "\t.then(data => console.log(data))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Authentication Change Password": {
        "prefix": "Amplify Change Password",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "Auth.currentAuthenticatedUser()",
            "\t.then(user => {",
            "\t\treturn Auth.changePassword(user, 'oldPassword', 'newPassword');",
            "\t})",
            "\t.then(data => console.log(data))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Authentication Forgot Password": {
        "prefix": "Amplify Forgot Password",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "Auth.forgotPassword(username)",
            "\t.then(data => console.log(data))",
            "\t.catch(err => console.log(err));",
            "",
            "// Collect confirmation code and new password, then",
            "Auth.forgotPasswordSubmit(username, code, new_password)",
            "\t.then(data => console.log(data))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Authentication Retrieve Current Session": {
        "prefix": "Amplify Retrieve Current Session",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let session = Auth.currentSession();",
            "// CognitoUserSession => { idToken, refreshToken, accessToken }",
        ]
    },
    "Amplify Authentication Managing Security Tokens": {
        "prefix": "Amplify Managing Security Tokens",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "var data = { UserPoolId : 'us-east-1_resgd', ClientId : 'xyz' };",
            "var userPool = new AmazonCognitoIdentity.CognitoUserPool(data);",
            "var cognitoUser = userPool.getCurrentUser();",
            "",
            "if (cognitoUser != null) {",
            "\tcognitoUser.getSession(function(err, session) {",
            "\t\tif (err) { alert(err); return; }",
            "",
            "\t\t// Get refresh token before refreshing session",
            "\t\trefresh_token = session.getRefreshToken();",
            "",
            "\t\tif (AWS.config.credentials.needsRefresh()) {",
            "\t\t\tcognitoUser.refreshSession(refresh_token, (err, session) => {",
            "\t\t\t\tif(err) { console.log(err); } ",
            "\t\t\t\telse {",
            "\t\t\t\t\tAWS.config.credentials.params.Logins['cognito-idp.<YOUR-REGION>.amazonaws.com/<YOUR_USER_POOL_ID>']  = session.getIdToken().getJwtToken();",
            "\t\t\t\t\tAWS.config.credentials.refresh((err)=> {",
            "\t\t\t\t\t\tif(err)  { console.log(err); }",
            "\t\t\t\t\t\telse{",
            "\t\t\t\t\t\t\tconsole.log(\"TOKEN SUCCESSFULLY UPDATED\");",
            "\t\t\t\t\t\t}",
            "\t\t\t\t\t});",
            "\t\t\t\t}",
            "\t\t\t});",
            "\t\t}",
            "\t});",
            "}",
        ]
    },
    "Amplify Authentication Using Withauthenticator Hoc": {
        "prefix": "Amplify Using Withauthenticator Hoc",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { withAuthenticator } from 'aws-amplify-react'; // or 'aws-amplify-react-native';",
            "...",
            "export default withAuthenticator(App);",
        ]
    },
    "Amplify Authentication Enabling Federated Identities": {
        "prefix": "Amplify Enabling Federated Identities",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const AppWithAuth = withAuthenticator(App);",
            "",
            "const federated = {",
            "\tgoogle_client_id: '',",
            "\tfacebook_app_id: '',",
            "\tamazon_client_id: ''",
            "};",
            "",
            "ReactDOM.render(<AppWithAuth federated={federated}/>, document.getElementById('root'));",
        ]
    },
    "Amplify Authentication Enabling Federated Identities 2": {
        "prefix": "Amplify Enabling Federated Identities 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "// Retrieve active Google user session",
            "const ga = window.gapi.auth2.getAuthInstance();",
            "ga.signIn().then(googleUser => {",
            "\tconst { id_token, expires_at } = googleUser.getAuthResponse();",
            "\tconst profile = googleUser.getBasicProfile();",
            "\tconst user = {",
            "\t\temail: profile.getEmail(),",
            "\t\tname: profile.getName()",
            "\t};",
            "",
            "\treturn Auth.federatedSignIn(",
            "\t\t// Initiate federated sign-in with Google identity provider ",
            "\t\t'google',",
            "\t\t{ ",
            "\t\t\t// the JWT token",
            "\t\t\ttoken: id_token, ",
            "\t\t\t// the expiration time",
            "\t\t\texpires_at ",
            "\t\t},",
            "\t\t// a user object",
            "\t\tuser",
            "\t).then(() => {",
            "\t\t// ...",
            "\t});",
            "});",
        ]
    },
    "Amplify Authentication Enabling Federated Identities 3": {
        "prefix": "Amplify Enabling Federated Identities 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Cache } from 'aws-amplify';",
            "",
            "// Run this after the sign-in",
            "Cache.getItem('federatedInfo').then(federatedInfo => {",
            "\tconst { token } = federatedInfo;",
            "});",
        ]
    },
    "Amplify Authentication Enabling Federated Identities 4": {
        "prefix": "Amplify Enabling Federated Identities 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "function refreshToken() {",
            "\t// refresh the token here and get the new token info",
            "\t// ......",
            "",
            "\treturn new Promise(res, rej => {",
            "\t\tconst data = {",
            "\t\t\ttoken, // the token from the provider",
            "\t\t\texpires_at, // the timestamp for the expiration",
            "\t\t\tidentity_id, // optional, the identityId for the credentials",
            "\t\t}",
            "\t\tres(data);",
            "\t});",
            "}",
            "",
            "Auth.configure({",
            "\trefreshHandlers: {",
            "\t\t'developer': refreshToken",
            "\t}",
            "})",
        ]
    },
    "Amplify Authentication Rendering A Sign Out Button": {
        "prefix": "Amplify Rendering A Sign Out Button",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "export default withAuthenticator(App, { includeGreetings: true });",
        ]
    },
    "Amplify Authentication Wrapping Your Component": {
        "prefix": "Amplify Wrapping Your Component",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Authenticator } from 'aws-amplify-react'; // or 'aws-amplify-react-native'",
            "...",
            "",
            "class AppWithAuth extends Component {",
            "render(){",
            "\treturn (",
            "\t<div>",
            "\t<Authenticator>",
            "\t\t<App />",
            "\t</Authenticator>",
            "\t</div>",
            "\t);",
            "}",
            "}",
            "",
            "export default AppWithAuth;",
        ]
    },
    "Amplify Authentication Show Your App After Sign-In": {
        "prefix": "Amplify Show Your App After Sign-In",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "this._validAuthStates = ['signedIn'];",
        ]
    },
    "Amplify Authentication Federated Identities (Social Sign-In)": {
        "prefix": "Amplify Federated Identities (Social Sign-In)",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Expo from 'expo';",
            "import Amplify, { Auth } from 'aws-amplify';",
            "import { Authenticator } from 'aws-amplify-react-native';",
            "",
            "export default class App extends React.Component {",
            "async signIn() {",
            "\tconst { type, token, expires } = await Expo.Facebook.logInWithReadPermissionsAsync('YOUR_FACEBOOK_APP_ID', {",
            "\t\tpermissions: ['public_profile'],",
            "\t});",
            "\tif (type === 'success') {",
            "\t// sign in with federated identity",
            "\tAuth.federatedSignIn('facebook', { token, expires_at: expires}, { name: 'USER_NAME' })",
            "\t\t.then(credentials => {",
            "\t\tconsole.log('get aws credentials', credentials);",
            "\t\t}).catch(e => {",
            "\t\tconsole.log(e);",
            "\t\t});",
            "\t}",
            "}",
            "",
            "// ...",
            "",
            "render() {",
            "\treturn (",
            "\t<View style={styles.container}>",
            "\t\t<Authenticator>",
            "\t\t</Authenticator>",
            "\t\t<Button title=\"FBSignIn\" onPress={this.signIn.bind(this)} />",
            "\t</View>",
            "\t);",
            "}",
            "}",
        ]
    },
    "Amplify Authentication Configuring The Hosted Ui": {
        "prefix": "Amplify Configuring The Hosted Ui",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify from 'aws-amplify';",
            "",
            "const oauth = {",
            "\t// Domain name",
            "\tdomain : 'your-domain-prefix.auth.us-east-1.amazoncognito.com', ",
            "\t",
            "\t// Authorized scopes",
            "\tscope : ['phone', 'email', 'profile', 'openid','aws.cognito.signin.user.admin'], ",
            "",
            "\t// Callback URL",
            "\tredirectSignIn : 'http://www.example.com/signin', ",
            "\t",
            "\t// Sign out URL",
            "\tredirectSignOut : 'http://www.example.com/signout',",
            "",
            "\t// 'code' for Authorization code grant, ",
            "\t// 'token' for Implicit grant",
            "\tresponseType: 'code'",
            "",
            "\t// optional, for Cognito hosted ui specified options",
            "\toptions: {",
            "\t\t// Indicates if the data collection is enabled to support Cognito advanced security features. By default, this flag is set to true.",
            "\t\tAdvancedSecurityDataCollectionFlag : true",
            "\t}",
            "}",
            "",
            "Amplify.configure({",
            "\tAuth: {",
            "\t\t// other configurations...",
            "\t\t// ....",
            "\t\toauth: oauth",
            "\t},",
            "\t// ...",
            "});",
        ]
    },
    "Amplify Authentication Launching The Hosted Ui": {
        "prefix": "Amplify Launching The Hosted Ui",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const config = Auth.configure();",
            "const { ",
            "\tdomain,  ",
            "\tredirectSignIn, ",
            "\tredirectSignOut,",
            "\tresponseType } = config.oauth;",
            "",
            "const clientId = config.userPoolWebClientId;",
            "const url = 'https://' + domain + '/login?redirect_uri=' + redirectSignIn + '&response_type=' + responseType + '&client_id=' + clientId;",
            "",
            "// Launch hosted UI",
            "window.location.assign(url);",
        ]
    },
    "Amplify Authentication Launching The Hosted Ui In React ": {
        "prefix": "Amplify Launching The Hosted Ui In React ",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { withOAuth } from 'aws-amplify-react';",
            "",
            "class MyApp extends React.Component {",
            "\t// ...",
            "\trender() {",
            "\t\treturn(",
            "\t\t\t<button onClick={this.props.OAuthSignIn}>",
            "\t\t\t\tSign in with AWS",
            "\t\t\t</button>",
            "\t\t)",
            "\t}",
            "}",
            "",
            "export default withOAuth(MyApp);",
        ]
    },
    "Amplify Authentication Enabling Totp": {
        "prefix": "Amplify Enabling Totp",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "// To setup TOTP, first you need to get a `authorization code` from Amazon Cognito",
            "// `user` is the current Authenticated user",
            "Auth.setupTOTP(user).then((code) => {",
            "\t// You can directly display the `code` to the user or convert it to a QR code to be scanned.",
            "\t// E.g., use following code sample to render a QR code with `qrcode.react` component:  ",
            "\t//      import QRCode from 'qrcode.react';",
            "\t//      const str = \"otpauth://totp/AWSCognito:\"+ username + \"?secret=\" + code + \"&issuer=\" + issuer;",
            "\t//      <QRCode value={str}/>",
            "});",
            "",
            "// ...",
            "",
            "// Then you will have your TOTP account in your TOTP-generating app (like Google Authenticator)",
            "// Use the generated one-time password to verify the setup",
            "Auth.verifyTotpToken(user, challengeAnswer).then(() => {",
            "",
            "\t// don't forget to set TOTP as the preferred MFA method",
            "\tAuth.setPreferredMFA(user, 'TOTP');",
            "\t// ...",
            "}).catch( e => {",
            "\t// Token is not verified",
            "});",
        ]
    },
    "Amplify Authentication Setup Mfa Type": {
        "prefix": "Amplify Setup Mfa Type",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "// You can select preferred mfa type, for example:",
            "// Select TOTP as preferred",
            "Auth.setPreferredMFA(user, 'TOTP').then((data) => {",
            "\tconsole.log(data);",
            "\t// ...",
            "}).catch(e => {});",
            "",
            "// Select SMS as preferred",
            "Auth.setPreferredMFA(user, 'SMS');",
            "",
            "// Select no-mfa",
            "Auth.setPreferredMFA(user, 'NOMFA');",
        ]
    },
    "Amplify Authentication Retrieving Current Preferred Mfa Type": {
        "prefix": "Amplify Retrieving Current Preferred Mfa Type",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "",
            "Auth.getPreferredMFA(user).then((data) => {",
            "\tconsole.log('Current prefered MFA type is: ' + data);",
            "})",
        ]
    },
    "Amplify Authentication Letting User Select Mfa Type": {
        "prefix": "Amplify Letting User Select Mfa Type",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify from 'aws-amplify';",
            "import awsmobile from './aws-exports';",
            "import { SelectMFAType } from 'aws-amplify-react';",
            "",
            "Amplify.configure(awsmobile);",
            "",
            "// Please have at least TWO types",
            "// Please make sure you set it properly according to your Cognito User pool",
            "const MFATypes = {",
            "\tSMS: true, // if SMS enabled in your user pool",
            "\tTOTP: true, // if TOTP enabled in your user pool",
            "\tOptional: true, // if MFA is set to optional in your user pool",
            "}",
            "",
            "class App extends Component {",
            "\t// ...",
            "\trender() {",
            "\t\treturn (",
            "\t\t\t// ...",
            "\t\t\t<SelectMFAType authData={this.props.authData} MFATypes={MFATypes}>",
            "\t\t)",
            "\t}",
            "}",
            "",
            "export default withAuthenticator(App, true);",
        ]
    },
    "Amplify Authentication Switching Authentication Flow Type": {
        "prefix": "Amplify Switching Authentication Flow Type",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Auth.configure({",
            "\t// other configurations...",
            "\t// ...",
            "\tauthenticationFlowType: 'USER_PASSWORD_AUTH',",
            "})",
        ]
    },
    "Amplify Authentication Creating A Captcha": {
        "prefix": "Amplify Creating A Captcha",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "export const handler = async (event) => {",
            "\tif (!event.request.session || event.request.session.length === 0) {",
            "\t\tevent.response.publicChallengeParameters = {",
            "\t\t\tcaptchaUrl: \"url/123.jpg\",",
            "\t\t};",
            "\t\tevent.response.privateChallengeParameters = {",
            "\t\t\tanswer: \"5\",",
            "\t\t};",
            "\t\tevent.response.challengeMetadata = \"CAPTCHA_CHALLENGE\";",
            "\t}",
            "\treturn event;",
            "};",
        ]
    },
    "Amplify Authentication Defining A Custom Challenge": {
        "prefix": "Amplify Defining A Custom Challenge",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "export const handler = async (event) => {",
            "\tif (!event.request.session || event.request.session.length === 0) {",
            "\t\t// If we don't have a session or it is empty then send a CUSTOM_CHALLENGE",
            "\t\tevent.response.challengeName = \"CUSTOM_CHALLENGE\";",
            "\t\tevent.response.failAuthentication = false;",
            "\t\tevent.response.issueTokens = false;",
            "\t} else if (event.request.session.length === 1 && event.request.session[0].challengeResult === true) {",
            "\t\t// If we passed the CUSTOM_CHALLENGE then issue token",
            "\t\tevent.response.failAuthentication = false;",
            "\t\tevent.response.issueTokens = true;",
            "\t} else {",
            "\t\t// Something is wrong. Fail authentication",
            "\t\tevent.response.failAuthentication = true;",
            "\t\tevent.response.issueTokens = false;",
            "\t}",
            "",
            "\treturn event;",
            "};",
        ]
    },
    "Amplify Authentication Defining A Custom Challenge 2": {
        "prefix": "Amplify Defining A Custom Challenge 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "export const handler = async (event, context) => {",
            "\tif (event.request.privateChallengeParameters.answer === event.request.challengeAnswer) {",
            "\t\tevent.response.answerCorrect = true;",
            "\t} else {",
            "\t\tevent.response.answerCorrect = false;",
            "\t}",
            "",
            "\treturn event;",
            "};",
        ]
    },
    "Amplify Authentication Using A Custom Challenge": {
        "prefix": "Amplify Using A Custom Challenge",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Auth } from 'aws-amplify';",
            "let challengeResponse = \"the answer for the challenge\";",
            "",
            "Auth.signIn(username)",
            "\t.then(user => {",
            "\t\tif (user.challengeName === 'CUSTOM_CHALLENGE') {",
            "\t\t\tAuth.sendCustomChallengeAnswer(user, challengeResponse)",
            "\t\t\t\t.then(user => console.log(user))",
            "\t\t\t\t.catch(err => console.log(err));",
            "\t\t} else {",
            "\t\t\tconsole.log(user);",
            "\t\t}",
            "\t})",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Authentication Working With User Attributes": {
        "prefix": "Amplify Working With User Attributes",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Auth.signUp({",
            "\t'username': 'jdoe',",
            "\t'password': 'mysecurerandompassword#123',",
            "\t'attributes': {",
            "\t\t'email': 'me@domain.com',",
            "\t\t'phone_number': '+12128601234', // E.164 number convention",
            "\t\t'given_name': 'Jane',",
            "\t\t'family_name': 'Doe',",
            "\t\t'nickname': 'Jane'",
            "\t}",
            "});",
        ]
    },
    "Amplify Authentication Working With User Attributes 2": {
        "prefix": "Amplify Working With User Attributes 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let user = await Auth.currentAuthenticatedUser();",
        ]
    },
    "Amplify Authentication Working With User Attributes 3": {
        "prefix": "Amplify Working With User Attributes 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let result = await Auth.updateUserAttributes(user, {",
            "\t'email': 'me@anotherdomain.com',",
            "\t'family_name': 'Lastname'",
            "});",
            "console.log(result); // SUCCESS",
        ]
    },
    "Amplify Authentication Working With User Attributes 4": {
        "prefix": "Amplify Working With User Attributes 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "let result = await Auth.verifyCurrentUserAttributeSubmit('email', 'abc123');",
        ]
    },
    "Amplify Authentication Working With Aws Service Objects": {
        "prefix": "Amplify Working With Aws Service Objects",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Route53 from 'aws-sdk/clients/route53';",
            "",
            "Auth.currentCredentials()",
            ".then(credentials => {",
            "\tconst route53 = new Route53({",
            "\tapiVersion: '2013-04-01',",
            "\tcredentials: Auth.essentialCredentials(credentials)",
            "\t});",
            "",
            "\t// more code working with route53 object",
            "\t// route53.changeResourceRecordSets();",
            "})",
        ]
    },
    "Amplify Authentication Customize `Withauthenticator`": {
        "prefix": "Amplify Customize `Withauthenticator`",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import React, { Component } from 'react';",
            "import { ConfirmSignIn, ConfirmSignUp, ForgotPassword, SignIn, SignUp, VerifyContact, withAuthenticator } from 'aws-amplify-react';",
            "",
            "class App extends Component {",
            "render() {",
            "\t...",
            "}",
            "}",
            "",
            "// This is my custom Sign in component",
            "class MySignIn extends SignIn {",
            "render() {",
            "\t...",
            "}",
            "}",
            "",
            "export default withAuthenticator(App, false, [",
            "<MySignIn/>,",
            "<ConfirmSignIn/>,",
            "<VerifyContact/>,",
            "<SignUp/>,",
            "<ConfirmSignUp/>,",
            "<ForgotPassword/>",
            "]);",
        ]
    },
    "Amplify Authentication Using Modular Imports": {
        "prefix": "Amplify Using Modular Imports",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Auth from '@aws-amplify/auth';",
            "",
            "Auth.configure();",
        ]
    },
    "Amplify Cache Working With The Api": {
        "prefix": "Amplify Working With The Api",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Cache } from 'aws-amplify';",
        ]
    },
    "Amplify Cache Setitem()": {
        "prefix": "Amplify Setitem()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Cache.setItem(key, value, [options]);",
        ]
    },
    "Amplify Cache Setitem() 2": {
        "prefix": "Amplify Setitem() 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// Standard case",
            "Cache.setItem('key', 'value');",
            "",
            "// Set item with priority. Priority should be between 1 and 5.",
            "Cache.setItem('key', 'value', { priority: 3 });",
            "",
            "// Set item with an expiration time",
            "const expiration = new Date(2018, 1, 1);",
            "Cache.setItem('key', 'value', { expires: expiration.getTime() });",
        ]
    },
    "Amplify Cache Setitem() 3": {
        "prefix": "Amplify Setitem() 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Cache.setItem('mothersBirthday', 'July 18th', { priority: 1 });",
            "Cache.setItem('breakfastFoodOrder', 'Pancakes', { priority: 3 });",
        ]
    },
    "Amplify Cache Getitem()": {
        "prefix": "Amplify Getitem()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Cache.getItem(key[, options]);",
        ]
    },
    "Amplify Cache Getitem() 2": {
        "prefix": "Amplify Getitem() 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// Standard case",
            "Cache.getItem('key');",
            "",
            "// Get item with callback function.",
            "// The callback function will be called if the item is not in the cache.",
            "// After the callback function returns, the value will be set into cache.",
            "Cache.getItem('key', { callback: callback });",
        ]
    },
    "Amplify Cache Removeitem()": {
        "prefix": "Amplify Removeitem()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Cache.removeItem(key);",
        ]
    },
    "Amplify Cache Clear()": {
        "prefix": "Amplify Clear()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Cache.clear();",
        ]
    },
    "Amplify Cache Getallkeys()": {
        "prefix": "Amplify Getallkeys()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Cache.getAllKeys();",
        ]
    },
    "Amplify Cache Getcachecursize()": {
        "prefix": "Amplify Getcachecursize()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const size = Cache.getCacheCurSize();",
        ]
    },
    "Amplify Cache Configure()": {
        "prefix": "Amplify Configure()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const config = {",
            "itemMaxSize: 3000, // 3000 bytes",
            "defaultPriority: 4",
            "// ...",
            "};",
            "const myCacheConfig = Cache.configure(config);",
            "",
            "// You can modify parameters such as cache size, item default ttl and etc.",
            "// But don't try to modify keyPrefix which is the identifier of Cache.",
        ]
    },
    "Amplify Cache Createinstance()": {
        "prefix": "Amplify Createinstance()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const config = {",
            "itemMaxSize: 3000, // 3000 bytes",
            "storage: window.sessionStorage // switch to sessionStorage",
            "// ...",
            "};",
            "const newCache = Cache.createInstance(config);",
            "// Please provide a new keyPrefix which is the identifier of Cache.",
        ]
    },
    "Amplify Cache Using Modularized Module": {
        "prefix": "Amplify Using Modularized Module",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Cache from '@aws-amplify/cache';",
            "",
            "Cache.configure();",
            "",
        ]
    },
    "Amplify Hub Installation": {
        "prefix": "Amplify Installation",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Hub } from 'aws-amplify';",
        ]
    },
    "Amplify Hub Dispatch()": {
        "prefix": "Amplify Dispatch()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Hub.dispatch('auth', { event: 'signIn', data: user }, 'Auth');",
        ]
    },
    "Amplify Hub Listen()": {
        "prefix": "Amplify Listen()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Hub, Logger } from 'aws-amplify';",
            "",
            "const logger = new Logger('MyClass');",
            "",
            "class MyClass {",
            "\tconstructor() {",
            "\t\tHub.listen('auth', this, 'MyListener');",
            "\t}",
            "",
            "\t// Default handler for listening events",
            "\tonHubCapsule(capsule) {",
            "\t\tconst { channel, payload } = capsule;",
            "\t\tif (channel === 'auth') { onAuthEvent(payload); }",
            "\t}",
            "}",
        ]
    },
    "Amplify Hub Listening Authentication Events": {
        "prefix": "Amplify Listening Authentication Events",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Hub, Logger } from 'aws-amplify';",
            "",
            "const alex = new Logger('Alexander_the_auth_watcher');",
            "",
            "alex.onHubCapsule = (capsule) => {",
            "",
            "\tswitch (capsule.payload.event) {",
            "\t",
            "\t\tcase 'signIn':",
            "\t\t\talex.error('user signed in'); //[ERROR] Alexander_the_auth_watcher - user signed in",
            "\t\t\tbreak;",
            "\t\tcase 'signUp':",
            "\t\t\talex.error('user signed up');",
            "\t\t\tbreak;",
            "\t\tcase 'signOut':",
            "\t\t\talex.error('user signed out');",
            "\t\t\tbreak;",
            "\t\tcase 'signIn_failure':",
            "\t\t\talex.error('user sign in failed');",
            "\t\t\tbreak;",
            "\t\t\t",
            "\t}",
            "}",
            "",
            "Hub.listen('auth', alex);",
        ]
    },
    "Amplify I18N Installation": {
        "prefix": "Amplify Installation",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { I18n } from 'aws-amplify';",
        ]
    },
    "Amplify I18N Setlanguage()": {
        "prefix": "Amplify Setlanguage()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "I18n.setLanguage('fr');",
        ]
    },
    "Amplify I18N Putvocabularies()": {
        "prefix": "Amplify Putvocabularies()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const dict = {",
            "\t'fr': {",
            "\t\t'Sign In': \"Se connecter\",",
            "\t\t'Sign Up': \"S'inscrire\"",
            "\t},",
            "\t'es': {",
            "\t\t'Sign In': \"Registrarse\",",
            "\t\t'Sign Up': \"Regístrate\"",
            "\t}",
            "};",
            "",
            "I18n.putVocabularies(dict);",
        ]
    },
    "Amplify I18N Get()": {
        "prefix": "Amplify Get()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "I18n.get('Sign In');",
        ]
    },
    "Amplify Interactions Automated Setup": {
        "prefix": "Amplify Automated Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { Auth } from 'aws-amplify';",
            "import aws_exports from './aws-exports'; // specify the location of aws-exports.js file on your project",
            "Amplify.configure(aws_exports);",
        ]
    },
    "Amplify Interactions Manual Setup": {
        "prefix": "Amplify Manual Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify from 'aws-amplify';",
            "",
            "Amplify.configure({",
            "Auth: {",
            "\tidentityPoolId: 'us-east-1:xxx-xxx-xxx-xxx-xxx',",
            "\tregion: 'us-east-1'",
            "},",
            "Interactions: {",
            "\tbots: {",
            "\t\"BookTripMOBILEHUB\": {",
            "\t\t\"name\": \"BookTripMOBILEHUB\",",
            "\t\t\"alias\": \"\\$LATEST\",",
            "\t\t\"region\": \"us-east-1\",",
            "\t},",
            "\t}",
            "}",
            "});",
        ]
    },
    "Amplify Interactions Working With The Api": {
        "prefix": "Amplify Working With The Api",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Interactions } from 'aws-amplify';",
        ]
    },
    "Amplify Interactions Send() Method": {
        "prefix": "Amplify Send() Method",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Interactions } from 'aws-amplify';",
            "",
            "let userInput = \"I want to reserve a hotel for tonight\";",
            "",
            "// Provide a bot name and user input",
            "const response = await Interactions.send(\"BookTripMOBILEHUB\", userInput);",
            "",
            "// Log chatbot response",
            "console.log (response.message);",
        ]
    },
    "Amplify Interactions Oncomplete() Method": {
        "prefix": "Amplify Oncomplete() Method",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "",
            "var handleComplete = function (err, confirmation) {",
            "\tif (err) {",
            "\t\talert('bot conversation failed')",
            "\t\treturn;",
            "\t}",
            "\talert('done: ' + JSON.stringify(confirmation, null, 2));",
            "",
            "\treturn 'Trip booked. Thank you! what would you like to do next?';",
            "}",
            "",
            "Interactions.onComplete(botName, handleComplete );",
        ]
    },
    "Amplify Interactions Using With React": {
        "prefix": "Amplify Using With React",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import React, { Component } from 'react';",
            "import Amplify, { Interactions } from 'aws-amplify';",
            "import { ChatBot, AmplifyTheme } from 'aws-amplify-react';",
            "",
            "// Imported default theme can be customized by overloading attributes",
            "const myTheme = {",
            "...AmplifyTheme,",
            "sectionHeader: {",
            "\t...AmplifyTheme.sectionHeader,",
            "\tbackgroundColor: '#ff6600'",
            "}",
            "};",
            "",
            "Amplify.configure({",
            "Auth: {",
            "\t// Use your Amazon Cognito Identity Pool Id",
            "\tidentityPoolId: 'us-east-1:xxx-xxx-xxx-xxx-xxx',",
            "\tregion: 'us-east-1'",
            "},",
            "Interactions: {",
            "\tbots: {",
            "\t\"BookTripMOBILEHUB\": {",
            "\t\t\"name\": \"BookTripMOBILEHUB\",",
            "\t\t\"alias\": \"\\$LATEST\",",
            "\t\t\"region\": \"us-east-1\",",
            "\t},",
            "\t}",
            "}",
            "});",
            "",
            "class App extends Component {",
            "",
            "handleComplete(err, confirmation) {",
            "\tif (err) {",
            "\talert('Bot conversation failed')",
            "\treturn;",
            "\t}",
            "",
            "\talert('Success: ' + JSON.stringify(confirmation, null, 2));",
            "\treturn 'Trip booked. Thank you! what would you like to do next?';",
            "}",
            "",
            "render() {",
            "\treturn (",
            "\t<div className=\"App\">",
            "\t\t<header className=\"App-header\">",
            "\t\t<h1 className=\"App-title\">Welcome to ChatBot Demo</h1>",
            "\t\t</header>",
            "\t\t<ChatBot",
            "\t\ttitle=\"My Bot\"",
            "\t\ttheme={myTheme}",
            "\t\tbotName=\"BookTripMOBILEHUB\"",
            "\t\twelcomeMessage=\"Welcome, how can I help you today?\"",
            "\t\tonComplete={this.handleComplete.bind(this)}",
            "\t\tclearOnComplete={true}",
            "\t\t/>",
            "\t</div>",
            "\t);",
            "}",
            "}",
            "",
            "export default App;",
        ]
    },
    "Amplify Interactions Using With React Native": {
        "prefix": "Amplify Using With React Native",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import React from 'react';",
            "import { StyleSheet, Text, SafeAreaView, Alert, StatusBar } from 'react-native';",
            "import Amplify from 'aws-amplify';",
            "import { ChatBot } from 'aws-amplify-react-native';",
            "",
            "Amplify.configure({",
            "Auth: {",
            "\tidentityPoolId: 'us-east-1:xxx-xxx-xxx-xxx-xxx',",
            "\tregion: 'us-east-1'",
            "},",
            "Interactions: {",
            "\tbots: {",
            "\t\"BookTripMOBILEHUB\": {",
            "\t\t\"name\": \"BookTripMOBILEHUB\",",
            "\t\t\"alias\": \"\\$LATEST\",",
            "\t\t\"region\": \"us-east-1\",",
            "\t},",
            "\t}",
            "}",
            "});",
            "",
            "const styles = StyleSheet.create({",
            "container: {",
            "\tflex: 1,",
            "\tbackgroundColor: '#fff',",
            "\talignItems: 'center',",
            "\tjustifyContent: 'center',",
            "\tpaddingTop: StatusBar.currentHeight,",
            "},",
            "});",
            "",
            "export default class App extends React.Component {",
            "",
            "\tstate = {",
            "\t\tbotName: 'BookTripMOBILEHUB',",
            "\t\twelcomeMessage: 'Welcome, what would you like to do today?',",
            "\t};",
            "",
            "\tconstructor(props) {",
            "\t\tsuper(props);",
            "\t\tthis.handleComplete = this.handleComplete.bind(this);",
            "\t}",
            "",
            "\thandleComplete(err, confirmation) {",
            "\t\tif (err) {",
            "\t\tAlert.alert('Error', 'Bot conversation failed', [{ text: 'OK' }]);",
            "\t\treturn;",
            "\t\t}",
            "",
            "\t\tAlert.alert('Done', JSON.stringify(confirmation, null, 2), [{ text: 'OK' }]);",
            "",
            "\t\tthis.setState({",
            "\t\tbotName: 'BookTripMOBILEHUB',",
            "\t\t});",
            "",
            "\t\treturn 'Trip booked. Thank you! what would you like to do next?';",
            "\t}",
            "",
            "\trender() {",
            "\t\tconst { botName, showChatBot, welcomeMessage } = this.state;",
            "",
            "\t\treturn (",
            "\t\t<SafeAreaView style={styles.container}>",
            "\t\t\t<ChatBot",
            "\t\t\tbotName={botName}",
            "\t\t\twelcomeMessage={welcomeMessage}",
            "\t\t\tonComplete={this.handleComplete}",
            "\t\t\tclearOnComplete={false}",
            "\t\t\tstyles={StyleSheet.create({",
            "\t\t\t\titemMe: {",
            "\t\t\t\tcolor: 'red'",
            "\t\t\t\t}",
            "\t\t\t})}",
            "\t\t\t/>",
            "\t\t</SafeAreaView>",
            "\t\t);",
            "\t}",
            "",
            "}",
        ]
    },
    "Amplify Logger Installation": {
        "prefix": "Amplify Installation",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Logger } from 'aws-amplify';",
            "",
        ]
    },
    "Amplify Logger Working With The Api": {
        "prefix": "Amplify Working With The Api",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "",
            "const logger = new Logger('foo');",
            "",
            "logger.info('info bar');",
            "logger.debug('debug bar');",
            "logger.warn('warn bar');",
            "logger.error('error bar');",
        ]
    },
    "Amplify Logger Working With The Api 2": {
        "prefix": "Amplify Working With The Api 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "try {",
            "\t...",
            "} catch(e) {",
            "\tlogger.error('error happened', e);",
            "}",
        ]
    },
    "Amplify Logger Setting Logging Levels": {
        "prefix": "Amplify Setting Logging Levels",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const logger = new Logger('foo', 'INFO');",
            "",
            "logger.debug('callback data', data); // this will not write the message",
        ]
    },
    "Amplify Logger Setting Logging Levels 2": {
        "prefix": "Amplify Setting Logging Levels 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Amplify.Logger.LOG_LEVEL = 'DEBUG';",
            "",
            "const logger = new Logger('foo', 'INFO');",
            "",
            "logger.debug('callback data', data); //  this will write the message since the global log level is 'DEBUG'",
        ]
    },
    "Amplify Logger Setting Logging Levels 3": {
        "prefix": "Amplify Setting Logging Levels 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "window.LOG_LEVEL = 'DEBUG';",
        ]
    },
    "Amplify Pub_Sub Aws Iot": {
        "prefix": "Amplify Aws Iot",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { PubSub } from 'aws-amplify';",
            "import { AWSIoTProvider } from 'aws-amplify/lib/PubSub/Providers';",
        ]
    },
    "Amplify Pub_Sub Aws Iot 2": {
        "prefix": "Amplify Aws Iot 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// Apply plugin with configuration",
            "Amplify.addPluggable(new AWSIoTProvider({",
            "\taws_pubsub_region: '<YOUR-AWS-REGION>',",
            "\taws_pubsub_endpoint: 'wss://xxxxxxxxxxxxx.iot.<YOUR-AWS-REGION>.amazonaws.com/mqtt',",
            "}));",
        ]
    },
    "Amplify Pub_Sub Aws Iot 3": {
        "prefix": "Amplify Aws Iot 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "\tAuth.currentCredentials().then((info) => {",
            "\tconst cognitoIdentityId = info._identityId;",
            "\t});",
        ]
    },
    "Amplify Pub_Sub Third Party Mqtt Providers": {
        "prefix": "Amplify Third Party Mqtt Providers",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { PubSub } from 'aws-amplify';",
            "import { MqttOverWSProvider } from \"aws-amplify/lib/PubSub/Providers\";",
        ]
    },
    "Amplify Pub_Sub Third Party Mqtt Providers 2": {
        "prefix": "Amplify Third Party Mqtt Providers 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// Apply plugin with configuration",
            "Amplify.addPluggable(new MqttOverWSProvider({",
            "\taws_pubsub_endpoint: 'wss://iot.eclipse.org:443/mqtt',",
            "}));",
        ]
    },
    "Amplify Pub_Sub Subscribe To A Topic": {
        "prefix": "Amplify Subscribe To A Topic",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "PubSub.subscribe('myTopic').subscribe({",
            "\tnext: data => console.log('Message received', data),",
            "\terror: error => console.error(error),",
            "\tclose: () => console.log('Done'),",
            "});",
        ]
    },
    "Amplify Pub_Sub Subscribe To Multiple Topics": {
        "prefix": "Amplify Subscribe To Multiple Topics",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "PubSub.subscribe(['myTopic1','myTopic1']).subscribe({",
            "\t// ...",
            "});",
        ]
    },
    "Amplify Pub_Sub Publish To A Topic": {
        "prefix": "Amplify Publish To A Topic",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "await PubSub.publish('myTopic1', { msg: 'Hello to all subscribers!' });",
        ]
    },
    "Amplify Pub_Sub Publish To A Topic 2": {
        "prefix": "Amplify Publish To A Topic 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "await PubSub.publish(['myTopic1','myTopic2'], { msg: 'Hello to all subscribers!' });",
        ]
    },
    "Amplify Pub_Sub Unsubscribe From A Topic": {
        "prefix": "Amplify Unsubscribe From A Topic",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const sub1 = PubSub.subscribe('myTopicA').subscribe({",
            "\tnext: data => console.log('Message received', data),",
            "\terror: error => console.error(error),",
            "\tclose: () => console.log('Done'),",
            "});",
            "",
            "sub1.unsubscribe();",
            "// You will no longer get messages for 'myTopicA'",
        ]
    },
    "Amplify Pub_Sub Using Modularized Module": {
        "prefix": "Amplify Using Modularized Module",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Pubsub from '@aws-amplify/pubsub';",
            "",
            "Pubsub.configure();",
            "",
        ]
    },
    "Amplify Push_Notifications_Setup.M Setup For Ios": {
        "prefix": "Amplify Setup For Ios",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "\\$ react-native init myapp",
            "\\$ cd myapp",
            "\\$ npm install",
            "\\$ npm install aws-amplify --save",
            "\\$ npm install aws-amplify-react-native --save",
            "\\$ react-native link aws-amplify-react-native",
        ]
    },
    "Amplify Push_Notifications_Setup.M Configure Your App": {
        "prefix": "Amplify Configure Your App",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { PushNotificationIOS } from 'react-native';",
            "import Analytics from '@aws-amplify/analytics';",
            "import PushNotification from '@aws-amplify/pushnotification';",
            "",
            "// PushNotification need to work with Analytics",
            "Analytics.configure({",
            "\t// You configuration will come here...",
            "});",
            "",
            "PushNotification.configure({",
            "\tappId: 'XXXXXXXXXXabcdefghij1234567890ab',",
            "});",
        ]
    },
    "Amplify Push_Notifications_Setup.M Configure Your App 2": {
        "prefix": "Amplify Configure Your App 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { PushNotificationIOS } from 'react-native';",
            "import Analytics from '@aws-amplify/analytics';",
            "import PushNotification from '@aws-amplify/pushnotification';",
            "import aws_exports from './aws_exports';",
            "",
            "// PushNotification need to work with Analytics",
            "Analytics.configure(aws_exports);",
            "",
            "PushNotification.configure(aws_exports);",
        ]
    },
    "Amplify Push_Notifications_Setup.M Working With The Api": {
        "prefix": "Amplify Working With The Api",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// get the notification data",
            "PushNotification.onNotification((notification) => {",
            "// Note that the notification object structure is different from Android and IOS",
            "console.log('in app notification', notification);",
            "",
            "// required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html)",
            "notification.finish(PushNotificationIOS.FetchResult.NoData);",
            "});",
            "",
            "// get the registration token",
            "PushNotification.onRegister((token) => {",
            "console.log('in app registration', token);",
            "});",
        ]
    },
    "Amplify Service_Workers Installation": {
        "prefix": "Amplify Installation",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { ServiceWorker } from 'aws-amplify';",
            "const myServiceWorker = new ServiceWorker();",
        ]
    },
    "Amplify Service_Workers Register()": {
        "prefix": "Amplify Register()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "// Register the service worker with `service-worker.js` with service worker scope `/`.",
            "myServiceWorker = await this.serviceWorker.register('/service-worker.js', '/');",
        ]
    },
    "Amplify Service_Workers Register() 2": {
        "prefix": "Amplify Register() 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "\tmyServiceWorker.enablePush('BLx__NGvdasMNkjd6VYPdzQJVBkb2qafh')",
        ]
    },
    "Amplify Service_Workers Handling A Push Notification": {
        "prefix": "Amplify Handling A Push Notification",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "/**",
            "* Listen for incoming Push events",
            "*/",
            "",
            "addEventListener('push', (event) => {",
            "\tvar data = {};",
            "\tconsole.log('[Service Worker] Push Received.');",
            "\tconsole.log(`[Service Worker] Push had this data: \"\\${event.data.text()}\"`);",
            "",
            "\tif (!(self.Notification && self.Notification.permission === 'granted')) ",
            "\t\treturn;",
            "\t",
            "\tif (event.data) ",
            "\t\tdata = event.data.json();",
            "\t",
            "\t// Customize the UI for the message box ",
            "\tvar title = data.title || \"Web Push Notification\";",
            "\tvar message = data.message || \"New Push Notification Received\";",
            "\tvar icon = \"images/notification-icon.png\";",
            "\tvar badge = 'images/notification-badge.png';",
            "\tvar options = {",
            "\t\tbody: message,",
            "\t\ticon: icon,",
            "\t\tbadge: badge",
            "\t};",
            "",
            "\tevent.waitUntil(self.registration.showNotification(title,options));",
            "",
            "});",
        ]
    },
    "Amplify Service_Workers Send()": {
        "prefix": "Amplify Send()",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "",
            "\tmyServiceWorker.send({",
            "\t'message': 'CleanAllCache'",
            "\t});",
            "",
        ]
    },
    "Amplify Service_Workers Receiving Messages ": {
        "prefix": "Amplify Receiving Messages ",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "\t/**",
            "\t* The message will receive messages sent from the application.",
            "\t* This can be useful for updating a service worker or messaging",
            "\t* other clients (browser restrictions currently exist)",
            "\t* https://developer.mozilla.org/en-US/docs/Web/API/Client/postMessage",
            "\t*/",
            "\taddEventListener('message', (event) => {",
            "\t\tconsole.log('[Service Worker] Message Event: ', event.data)",
            "\t})",
            "\t",
        ]
    },
    "Amplify Service_Workers Using Modularized Module": {
        "prefix": "Amplify Using Modularized Module",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { ServiceWorker } from '@aws-amplify/core';",
            "",
        ]
    },
    "Amplify Storage Automated Setup": {
        "prefix": "Amplify Automated Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify, { Storage } from 'aws-amplify';",
            "import aws_exports from './aws-exports';",
            "Amplify.configure(aws_exports);",
        ]
    },
    "Amplify Storage Manual Setup": {
        "prefix": "Amplify Manual Setup",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Amplify from 'aws-amplify';",
            "",
            "Amplify.configure({",
            "\tAuth: {",
            "\t\tidentityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', //REQUIRED - Amazon Cognito Identity Pool ID",
            "\t\tregion: 'XX-XXXX-X', // REQUIRED - Amazon Cognito Region",
            "\t\tuserPoolId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito User Pool ID",
            "\t\tuserPoolWebClientId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito Web Client ID",
            "\t},",
            "\tStorage: {",
            "\t\tbucket: '', //REQUIRED -  Amazon S3 bucket",
            "\t\tregion: 'XX-XXXX-X', //OPTIONAL -  Amazon service region",
            "\t}",
            "});",
            "",
        ]
    },
    "Amplify Storage File Access Levels": {
        "prefix": "Amplify File Access Levels",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.configure({ level: 'private' });",
            "",
            "Storage.get('welcome.png'); // Gets the welcome.png belongs to current user",
        ]
    },
    "Amplify Storage File Access Levels 2": {
        "prefix": "Amplify File Access Levels 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('welcome.png', { level: 'public' }); // Gets welcome.png in public space",
        ]
    },
    "Amplify Storage File Access Levels 3": {
        "prefix": "Amplify File Access Levels 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('welcome.png'); // Get welcome.png in public space",
        ]
    },
    "Amplify Storage File Access Levels 4": {
        "prefix": "Amplify File Access Levels 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.vault.get('welcome.png'); // Get the welcome.png belonging to current user",
        ]
    },
    "Amplify Storage Working With The Api": {
        "prefix": "Amplify Working With The Api",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import { Storage } from 'aws-amplify';",
        ]
    },
    "Amplify Storage Working With The Api 2": {
        "prefix": "Amplify Working With The Api 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.configure({",
            "\tbucket: //Your bucket ARN;",
            "\tregion: //Specify the region your bucket was created in;",
            "\tidentityPoolId: //Specify your identityPoolId for Auth and Unauth access to your bucket;",
            "});",
        ]
    },
    "Amplify Storage Put": {
        "prefix": "Amplify Put",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.put('test.txt', 'Hello')",
            "\t.then (result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Put 2": {
        "prefix": "Amplify Put 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.put('test.txt', 'Protected Content', {",
            "\tlevel: 'protected',",
            "\tcontentType: 'text/plain'",
            "})",
            ".then (result => console.log(result))",
            ".catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Put 3": {
        "prefix": "Amplify Put 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.put('test.txt', 'Private Content', {",
            "\tlevel: 'private',",
            "\tcontentType: 'text/plain'",
            "})",
            ".then (result => console.log(result))",
            ".catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Put 4": {
        "prefix": "Amplify Put 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "class S3ImageUpload extends React.Component {",
            "onChange(e) {",
            "\tconst file = e.target.files[0];",
            "\tStorage.put('example.png', file, {",
            "\t\tcontentType: 'image/png'",
            "\t})",
            "\t.then (result => console.log(result))",
            "\t.catch(err => console.log(err));",
            "}",
            "",
            "render() {",
            "\treturn (",
            "\t\t<input",
            "\t\t\ttype=\"file\" accept='image/png'",
            "\t\t\tonChange={(e) => this.onChange(e)}",
            "\t\t/>",
            "\t)",
            "}",
            "}",
        ]
    },
    "Amplify Storage Put 5": {
        "prefix": "Amplify Put 5",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import RNFetchBlob from 'react-native-fetch-blob';",
            "",
            "readFile(filePath) {",
            "\treturn RNFetchBlob.fs.readFile(filePath, 'base64').then(data => new Buffer(data, 'base64'));",
            "}",
            "",
            "readFile(imagePath).then(buffer => {",
            "\tStorage.put(key, buffer, {",
            "\t\tcontentType: imageType",
            "\t})",
            "}).catch(e => {",
            "\tconsole.log(e);",
            "});",
        ]
    },
    "Amplify Storage Get": {
        "prefix": "Amplify Get",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('test.txt')",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Get 2": {
        "prefix": "Amplify Get 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('test.txt', { level: 'protected' })",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Get 3": {
        "prefix": "Amplify Get 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('test.txt', { ",
            "\tlevel: 'protected', ",
            "\tidentityId: 'xxxxxxx' // the identityId of that user",
            "})",
            ".then(result => console.log(result))",
            ".catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Get 4": {
        "prefix": "Amplify Get 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('test.txt', {level: 'private'})",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Get 5": {
        "prefix": "Amplify Get 5",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('test.txt', {expires: 60})",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Remove": {
        "prefix": "Amplify Remove",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.remove('test.txt')",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Remove 2": {
        "prefix": "Amplify Remove 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.remove('test.txt', {level: 'protected'})",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Remove 3": {
        "prefix": "Amplify Remove 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.remove('test.txt', {level: 'private'})",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage List": {
        "prefix": "Amplify List",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.list('photos/')",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage List 2": {
        "prefix": "Amplify List 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.list('photos/', { level: 'protected' })",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage List 3": {
        "prefix": "Amplify List 3",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.list('photos/', { ",
            "\tlevel: 'protected', ",
            "\tidentityId: 'xxxxxxx' // the identityId of that user",
            "})",
            ".then(result => console.log(result))",
            ".catch(err => console.log(err));",
        ]
    },
    "Amplify Storage List 4": {
        "prefix": "Amplify List 4",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.list('photos/', {level: 'private'})",
            "\t.then(result => console.log(result))",
            "\t.catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Tracking Events": {
        "prefix": "Amplify Tracking Events",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.configure({ track: true })",
        ]
    },
    "Amplify Storage Tracking Events 2": {
        "prefix": "Amplify Tracking Events 2",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "Storage.get('welcome.png', { track: true });",
        ]
    },
    "Amplify Storage Customize Upload Path ": {
        "prefix": "Amplify Customize Upload Path ",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "const customPrefix: {",
            "\tpublic: 'myPublicPrefix/',",
            "\tprotected: 'myProtectedPrefix/',",
            "\tprivate: 'myPrivatePrefix/'",
            "};",
            "",
            "Storage.put('test.txt', 'Hello', {",
            "\tcustomPrefix: customPrefix,",
            "\t// ...",
            "})",
            ".then (result => console.log(result))",
            ".catch(err => console.log(err));",
        ]
    },
    "Amplify Storage Using Modularized Module": {
        "prefix": "Amplify Using Modularized Module",
        "scope": "javascript,javascriptreact,typescript",
        "body": [
            "import Storage from '@aws-amplify/storage';",
            "",
            "Storage.configure();",
            "",
        ]
    },
}