hcloud-sdk 0.0.12 → 0.0.13

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.
package/lib/Axios.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { AxiosPromise } from 'axios';
2
+ export default class AxiosService {
3
+ get: (url: string) => Promise<AxiosPromise>;
4
+ post: (url: string, body: any) => Promise<AxiosPromise>;
5
+ }
package/lib/Axios.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const axios_1 = require("axios");
13
+ class AxiosService {
14
+ constructor() {
15
+ this.get = (url) => __awaiter(this, void 0, void 0, function* () {
16
+ return axios_1.default.get(url);
17
+ });
18
+ this.post = (url, body) => __awaiter(this, void 0, void 0, function* () {
19
+ return axios_1.default.post(url, body, {});
20
+ });
21
+ }
22
+ }
23
+ exports.default = AxiosService;
@@ -0,0 +1,9 @@
1
+ import AxiosService from './Axios';
2
+ export interface options {
3
+ api: string;
4
+ }
5
+ export default abstract class common {
6
+ protected opts: options;
7
+ protected axios: AxiosService;
8
+ constructor(opts: options);
9
+ }
package/lib/common.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Axios_1 = require("./Axios");
4
+ // tslint:disable-next-line
5
+ class common {
6
+ constructor(opts) {
7
+ this.opts = opts;
8
+ this.axios = new Axios_1.default();
9
+ }
10
+ }
11
+ exports.default = common;
package/lib/dto/IDP.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface Token {
8
8
  token: string;
9
9
  }
10
10
  export interface ErrorMessage {
11
- status: number;
11
+ code: string;
12
+ error: string;
12
13
  message: string;
13
14
  }
@@ -20,7 +20,7 @@ class IDP extends base_1.default {
20
20
  * @returns User object
21
21
  */
22
22
  this.authorize = () => __awaiter(this, void 0, void 0, function* () {
23
- const resp = yield axios_1.default.post(this.getEndpoint("/v1/authorize"), {}, {}).catch((err) => {
23
+ const resp = yield axios_1.default.get(this.getEndpoint("/v1/authorize"), {}).catch((err) => {
24
24
  throw err;
25
25
  });
26
26
  return resp.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -46,6 +46,5 @@
46
46
  "doc:dev": "vuepress dev _docs/src",
47
47
  "doc:export": "vuepress export _docs/src",
48
48
  "build": "tsc"
49
- },
50
- "readme": "# hcloud-sdk\n[![MIT License](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Latest Release](https://img.shields.io/npm/v/hcloud-sdk.svg)](https://www.npmjs.com/package/hcloud-sdk)\n"
49
+ }
51
50
  }
@@ -0,0 +1,14 @@
1
+ export interface User {
2
+ _id: string;
3
+ name: string;
4
+ email: string;
5
+ company: string;
6
+ }
7
+ export interface Token {
8
+ token: string;
9
+ }
10
+ export interface ErrorMessage {
11
+ code: string;
12
+ error: string;
13
+ message: string;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });