@headwindsimulations/api-client 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,11 @@
1
1
  export declare class SayIntentionsResponse {
2
2
  response: string;
3
3
  }
4
+ export declare class SayIntentionsValidateResponse {
5
+ isValid: boolean;
6
+ flightId: string;
7
+ }
4
8
  export declare class SayIntentions {
5
9
  static sendRequest(body: any): Promise<SayIntentionsResponse>;
10
+ static validateApiKey(apiKey: string): Promise<SayIntentionsValidateResponse>;
6
11
  }
package/dist/index.esm.js CHANGED
@@ -26,6 +26,10 @@ var __assign = function() {
26
26
  return __assign.apply(this, arguments);
27
27
  };
28
28
 
29
+ function get(url, headers) {
30
+ return axios.get(url.href, { headers: headers })
31
+ .then(function (res) { return res.data; });
32
+ }
29
33
  function post(url, body, headers) {
30
34
  var headersToSend = __assign({ 'Content-Type': 'application/json' }, headers);
31
35
  return axios.post(url.href, body, { headers: headersToSend })
@@ -45,7 +49,12 @@ var SayIntentions = /** @class */ (function () {
45
49
  function SayIntentions() {
46
50
  }
47
51
  SayIntentions.sendRequest = function (body) {
48
- return post(new URL('/api/v1/sayintentions', NXApi.url), body);
52
+ return post(new URL("/api/v1/sayintentions", NXApi.url), body);
53
+ };
54
+ SayIntentions.validateApiKey = function (apiKey) {
55
+ var url = new URL("/api/v1/sayintentions/validate", NXApi.url);
56
+ url.searchParams.set("apiKey", apiKey);
57
+ return get(url);
49
58
  };
50
59
  return SayIntentions;
51
60
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../src/apis/Hoppie.ts","../src/apis/SayIntentions.ts","../src/index.ts"],"sourcesContent":["import axios from 'axios';\n\nexport function get<T>(url: URL, headers?: any): Promise<T> {\n return axios.get<T>(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function del(url: URL, headers?: any): Promise<void> {\n return axios.delete(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function post<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.post<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n\nexport function put<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.put<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class HoppieResponse {\n response: string;\n}\n\nexport class Hoppie {\n public static sendRequest(body: any): Promise<HoppieResponse> {\n return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);\n }\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class SayIntentionsResponse {\n response: string;\n}\n\nexport class SayIntentions {\n public static sendRequest(body: any): Promise<SayIntentionsResponse> {\n return post<SayIntentionsResponse>(new URL('/api/v1/sayintentions', NXApi.url), body);\n }\n}\n","export class NXApi {\n public static url = new URL('https://api.headwindsim.net');\n}\n\nexport * from './apis';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;SAYgB,IAAI,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACtD,IAAM,aAAa,cACf,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACb,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SAC3D,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC;;;ICbA;KAIC;IAHiB,kBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAiB,IAAI,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KAC3E;IACL,aAAC;AAAD,CAAC;;;ICJD;KAIC;IAHiB,yBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAwB,IAAI,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KACzF;IACL,oBAAC;AAAD,CAAC;;;ICXD;KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,YAAC;CAFD;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../src/apis/Hoppie.ts","../src/apis/SayIntentions.ts","../src/index.ts"],"sourcesContent":["import axios from 'axios';\n\nexport function get<T>(url: URL, headers?: any): Promise<T> {\n return axios.get<T>(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function del(url: URL, headers?: any): Promise<void> {\n return axios.delete(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function post<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.post<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n\nexport function put<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.put<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class HoppieResponse {\n response: string;\n}\n\nexport class Hoppie {\n public static sendRequest(body: any): Promise<HoppieResponse> {\n return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);\n }\n}\n","import { NXApi } from \"../index\";\nimport { post, get } from \"../utils\";\n\nexport declare class SayIntentionsResponse {\n response: string;\n}\n\nexport declare class SayIntentionsValidateResponse {\n isValid: boolean;\n flightId: string;\n}\n\nexport class SayIntentions {\n public static sendRequest(body: any): Promise<SayIntentionsResponse> {\n return post<SayIntentionsResponse>(\n new URL(\"/api/v1/sayintentions\", NXApi.url),\n body\n );\n }\n\n public static validateApiKey(\n apiKey: string\n ): Promise<SayIntentionsValidateResponse> {\n const url = new URL(\"/api/v1/sayintentions/validate\", NXApi.url);\n url.searchParams.set(\"apiKey\", apiKey);\n\n return get<SayIntentionsValidateResponse>(url);\n }\n}\n","export class NXApi {\n public static url = new URL('https://api.headwindsim.net');\n}\n\nexport * from './apis';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;SAEgB,GAAG,CAAI,GAAQ,EAAE,OAAa;IAC1C,OAAO,KAAK,CAAC,GAAG,CAAI,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC;SACrC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC,CAAC;SAOe,IAAI,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACtD,IAAM,aAAa,cACf,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACb,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SAC3D,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC;;;ICbA;KAIC;IAHiB,kBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAiB,IAAI,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KAC3E;IACL,aAAC;AAAD,CAAC;;;ICCD;KAgBC;IAfe,yBAAW,GAAzB,UAA0B,IAAS;QACjC,OAAO,IAAI,CACT,IAAI,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,EAC3C,IAAI,CACL,CAAC;KACH;IAEa,4BAAc,GAA5B,UACE,MAAc;QAEd,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACjE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAgC,GAAG,CAAC,CAAC;KAChD;IACH,oBAAC;AAAD,CAAC;;;IC5BD;KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,YAAC;CAFD;;;;"}
package/dist/index.js CHANGED
@@ -34,6 +34,10 @@ var __assign = function() {
34
34
  return __assign.apply(this, arguments);
35
35
  };
36
36
 
37
+ function get(url, headers) {
38
+ return axios__default["default"].get(url.href, { headers: headers })
39
+ .then(function (res) { return res.data; });
40
+ }
37
41
  function post(url, body, headers) {
38
42
  var headersToSend = __assign({ 'Content-Type': 'application/json' }, headers);
39
43
  return axios__default["default"].post(url.href, body, { headers: headersToSend })
@@ -53,7 +57,12 @@ var SayIntentions = /** @class */ (function () {
53
57
  function SayIntentions() {
54
58
  }
55
59
  SayIntentions.sendRequest = function (body) {
56
- return post(new URL('/api/v1/sayintentions', NXApi.url), body);
60
+ return post(new URL("/api/v1/sayintentions", NXApi.url), body);
61
+ };
62
+ SayIntentions.validateApiKey = function (apiKey) {
63
+ var url = new URL("/api/v1/sayintentions/validate", NXApi.url);
64
+ url.searchParams.set("apiKey", apiKey);
65
+ return get(url);
57
66
  };
58
67
  return SayIntentions;
59
68
  }());
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils/index.ts","../src/apis/Hoppie.ts","../src/apis/SayIntentions.ts","../src/index.ts"],"sourcesContent":["import axios from 'axios';\n\nexport function get<T>(url: URL, headers?: any): Promise<T> {\n return axios.get<T>(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function del(url: URL, headers?: any): Promise<void> {\n return axios.delete(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function post<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.post<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n\nexport function put<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.put<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class HoppieResponse {\n response: string;\n}\n\nexport class Hoppie {\n public static sendRequest(body: any): Promise<HoppieResponse> {\n return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);\n }\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class SayIntentionsResponse {\n response: string;\n}\n\nexport class SayIntentions {\n public static sendRequest(body: any): Promise<SayIntentionsResponse> {\n return post<SayIntentionsResponse>(new URL('/api/v1/sayintentions', NXApi.url), body);\n }\n}\n","export class NXApi {\n public static url = new URL('https://api.headwindsim.net');\n}\n\nexport * from './apis';\n"],"names":["axios"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAYgB,IAAI,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACtD,IAAM,aAAa,cACf,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACb,CAAC;IAEF,OAAOA,yBAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SAC3D,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC;;;ICbA;KAIC;IAHiB,kBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAiB,IAAI,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KAC3E;IACL,aAAC;AAAD,CAAC;;;ICJD;KAIC;IAHiB,yBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAwB,IAAI,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KACzF;IACL,oBAAC;AAAD,CAAC;;;ICXD;KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,YAAC;CAFD;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/utils/index.ts","../src/apis/Hoppie.ts","../src/apis/SayIntentions.ts","../src/index.ts"],"sourcesContent":["import axios from 'axios';\n\nexport function get<T>(url: URL, headers?: any): Promise<T> {\n return axios.get<T>(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function del(url: URL, headers?: any): Promise<void> {\n return axios.delete(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function post<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.post<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n\nexport function put<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.put<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class HoppieResponse {\n response: string;\n}\n\nexport class Hoppie {\n public static sendRequest(body: any): Promise<HoppieResponse> {\n return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);\n }\n}\n","import { NXApi } from \"../index\";\nimport { post, get } from \"../utils\";\n\nexport declare class SayIntentionsResponse {\n response: string;\n}\n\nexport declare class SayIntentionsValidateResponse {\n isValid: boolean;\n flightId: string;\n}\n\nexport class SayIntentions {\n public static sendRequest(body: any): Promise<SayIntentionsResponse> {\n return post<SayIntentionsResponse>(\n new URL(\"/api/v1/sayintentions\", NXApi.url),\n body\n );\n }\n\n public static validateApiKey(\n apiKey: string\n ): Promise<SayIntentionsValidateResponse> {\n const url = new URL(\"/api/v1/sayintentions/validate\", NXApi.url);\n url.searchParams.set(\"apiKey\", apiKey);\n\n return get<SayIntentionsValidateResponse>(url);\n }\n}\n","export class NXApi {\n public static url = new URL('https://api.headwindsim.net');\n}\n\nexport * from './apis';\n"],"names":["axios"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAEgB,GAAG,CAAI,GAAQ,EAAE,OAAa;IAC1C,OAAOA,yBAAK,CAAC,GAAG,CAAI,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC;SACrC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC,CAAC;SAOe,IAAI,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACtD,IAAM,aAAa,cACf,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACb,CAAC;IAEF,OAAOA,yBAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SAC3D,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC;;;ICbA;KAIC;IAHiB,kBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAiB,IAAI,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KAC3E;IACL,aAAC;AAAD,CAAC;;;ICCD;KAgBC;IAfe,yBAAW,GAAzB,UAA0B,IAAS;QACjC,OAAO,IAAI,CACT,IAAI,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,EAC3C,IAAI,CACL,CAAC;KACH;IAEa,4BAAc,GAA5B,UACE,MAAc;QAEd,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACjE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAgC,GAAG,CAAC,CAAC;KAChD;IACH,oBAAC;AAAD,CAAC;;;IC5BD;KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,YAAC;CAFD;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headwindsimulations/api-client",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Client library for the Headwind Simulations API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",