Initial commit

This commit is contained in:
2023-02-11 17:29:12 -08:00
commit cdc58cd438
13 changed files with 3793 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
var moment = require('moment');
export interface ApiConfigs {
weather_url: string;
city_name: string;
tz: string;
}
export var getApiConfigs:ApiConfigs = function(params:Array<string,string>) {
var first_number = "+12225551212";
var second_number = "+13335554343";
var now = moment().format('Y-m-d');
var out:ApiConfigs = {};
if (params['To'] == first_number || params['city'] == "first") {
out.weather_url = "https://forecast.weather.gov/MapClick.php?lat=34.052&lon=-118.243&unit=0&lg=english&FcstType=json";
out.city_name = "Los Angeles";
out.tz = "America/Los_Angeles";
} else if (params['To'] == second_number || params['city'] == "second") {
out.weather_url = "https://forecast.weather.gov/MapClick.php?lat=39.739&lon=-104.984&unit=0&lg=english&FcstType=json";
out.city_name = "Denver";
out.tz = "America/Denver";
} else {
out.weather_url = "https://forecast.weather.gov/MapClick.php?lat=40.7146&lon=-74.0071&unit=0&lg=english&FcstType=json";
out.city_name = "New York";
out.tz = "America/New_York";
}
return out;
}
export var getCompassDirection = function(bearing:number) {
var direction:string;
const tmp = Math.round(bearing / 22.5);
switch(tmp) {
case 1:
direction = "North Northeast";
break;
case 2:
direction = "North East";
break;
case 3:
direction = "East Northeast";
break;
case 4:
direction = "East";
break;
case 5:
direction = "East Southeast";
break;
case 6:
direction = "South East";
break;
case 7:
direction = "South Southeast";
break;
case 8:
direction = "South";
break;
case 9:
direction = "South Southwest";
break;
case 10:
direction = "South West";
break;
case 11:
direction = "West Southwest";
break;
case 12:
direction = "West";
break;
case 13:
direction = "West Northwest";
break;
case 14:
direction = "North West";
break;
case 15:
direction = "North Northwest";
break;
default:
direction = "North";
}
return direction;
}
+123
View File
@@ -0,0 +1,123 @@
{
"body": "dG89JTJCMTIyMjU1NTEyMTI",
"resource": "/{proxy+}",
"path": "/path/to/resource",
"httpMethod": "POST",
"isBase64Encoded": true,
"queryStringParameters": {
"foo": "bar"
},
"multiValueQueryStringParameters": {
"foo": [
"bar"
]
},
"pathParameters": {
"proxy": "/path/to/resource"
},
"stageVariables": {
"baz": "qux"
},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, sdch",
"Accept-Language": "en-US,en;q=0.8",
"Cache-Control": "max-age=0",
"CloudFront-Forwarded-Proto": "https",
"CloudFront-Is-Desktop-Viewer": "true",
"CloudFront-Is-Mobile-Viewer": "false",
"CloudFront-Is-SmartTV-Viewer": "false",
"CloudFront-Is-Tablet-Viewer": "false",
"CloudFront-Viewer-Country": "US",
"Host": "1234567890.execute-api.us-east-1.amazonaws.com",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Custom User Agent String",
"Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
"X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
"X-Forwarded-For": "127.0.0.1, 127.0.0.2",
"X-Forwarded-Port": "443",
"X-Forwarded-Proto": "https"
},
"multiValueHeaders": {
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
],
"Accept-Encoding": [
"gzip, deflate, sdch"
],
"Accept-Language": [
"en-US,en;q=0.8"
],
"Cache-Control": [
"max-age=0"
],
"CloudFront-Forwarded-Proto": [
"https"
],
"CloudFront-Is-Desktop-Viewer": [
"true"
],
"CloudFront-Is-Mobile-Viewer": [
"false"
],
"CloudFront-Is-SmartTV-Viewer": [
"false"
],
"CloudFront-Is-Tablet-Viewer": [
"false"
],
"CloudFront-Viewer-Country": [
"US"
],
"Host": [
"0123456789.execute-api.us-east-1.amazonaws.com"
],
"Upgrade-Insecure-Requests": [
"1"
],
"User-Agent": [
"Custom User Agent String"
],
"Via": [
"1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)"
],
"X-Amz-Cf-Id": [
"cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA=="
],
"X-Forwarded-For": [
"127.0.0.1, 127.0.0.2"
],
"X-Forwarded-Port": [
"443"
],
"X-Forwarded-Proto": [
"https"
]
},
"requestContext": {
"accountId": "123456789012",
"resourceId": "123456",
"stage": "prod",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"requestTime": "09/Apr/2015:12:34:56 +0000",
"requestTimeEpoch": 1428582896000,
"identity": {
"cognitoIdentityPoolId": null,
"accountId": null,
"cognitoIdentityId": null,
"caller": null,
"accessKey": null,
"sourceIp": "127.0.0.1",
"cognitoAuthenticationType": null,
"cognitoAuthenticationProvider": null,
"userArn": null,
"userAgent": "Custom User Agent String",
"user": null
},
"path": "/prod/path/to/resource",
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"apiId": "1234567890",
"protocol": "HTTP/1.1"
}
}