on e5e005a help sign in
bridge/src/lib/SolarisClient.js
103 lines 2.0 kB history raw
1//
2// Warning: this file is auto-generated.
3//
5export default class SolarisClient {
6 constructor(endpoint) {
7 this.endpoint = endpoint;
8 }
10 getHealthzUrl() {
11 return this.endpoint + '/healthz';
12 }
14 async getHealthz() {
15 return await fetch(this.getHealthzUrl(), {
16 method: 'GET',
17 headers: {
18 Accept: 'application/json',
19 },
20 });
21 }
23 getUrl() {
24 return this.endpoint + '/';
25 }
27 async get() {
28 return await fetch(this.getUrl(), {
29 method: 'GET',
30 headers: {
31 Accept: 'application/json',
32 },
33 });
34 }
36 getImagesUrl() {
37 return this.endpoint + '/images';
38 }
40 async getImages() {
41 return await fetch(this.getImagesUrl(), {
42 method: 'GET',
43 headers: {
44 Accept: 'application/json',
45 },
46 });
47 }
49 getShipsUrl() {
50 return this.endpoint + '/ships';
51 }
53 async getShips() {
54 return await fetch(this.getShipsUrl(), {
55 method: 'GET',
56 headers: {
57 Accept: 'application/json',
58 },
59 });
60 }
62 getShipsByPatpUrl(patp) {
63 return this.endpoint + '/ships/' + encodeURIComponent(patp) + '';
64 }
66 async getShipsByPatp(patp) {
67 return await fetch(this.getShipsByPatpUrl(patp), {
68 method: 'GET',
69 headers: {
70 Accept: 'application/json',
71 },
72 });
73 }
75 getShipsByPatpDetailsUrl(patp) {
76 return this.endpoint + '/ships/' + encodeURIComponent(patp) + '/details';
77 }
79 async getShipsByPatpDetails(patp) {
80 return await fetch(this.getShipsByPatpDetailsUrl(patp), {
81 method: 'GET',
82 headers: {
83 Accept: 'application/json',
84 },
85 });
86 }
88 postShipsUrl() {
89 return this.endpoint + '/ships';
90 }
92 async postShips(data) {
93 return await fetch(this.postShipsUrl(), {
94 method: 'POST',
95 cache: 'no-cache',
96 body: JSON.stringify(data),
97 headers: {
98 Accept: 'application/json',
99 'Content-Type': 'application/json',
100 },
101 });
102 }