on c8e8454 help sign in
bridge/src/lib/SolarisClient.js
105 lines 2.0 kB history raw
1/* eslint-disable prettier/prettier */
3//
4// Warning: this file is auto-generated.
5//
7export default class SolarisClient {
8 constructor(endpoint) {
9 this.endpoint = endpoint;
10 }
12 getHealthzUrl() {
13 return this.endpoint + '/healthz';
14 }
16 async getHealthz() {
17 return await fetch(this.getHealthzUrl(), {
18 method: 'GET',
19 headers: {
20 Accept: 'application/json',
21 },
22 });
23 }
25 getUrl() {
26 return this.endpoint + '/';
27 }
29 async get() {
30 return await fetch(this.getUrl(), {
31 method: 'GET',
32 headers: {
33 Accept: 'application/json',
34 },
35 });
36 }
38 getImagesUrl() {
39 return this.endpoint + '/images';
40 }
42 async getImages() {
43 return await fetch(this.getImagesUrl(), {
44 method: 'GET',
45 headers: {
46 Accept: 'application/json',
47 },
48 });
49 }
51 getShipsUrl() {
52 return this.endpoint + '/ships';
53 }
55 async getShips() {
56 return await fetch(this.getShipsUrl(), {
57 method: 'GET',
58 headers: {
59 Accept: 'application/json',
60 },
61 });
62 }
64 getShipsByPatpUrl(patp) {
65 return this.endpoint + '/ships/' + encodeURIComponent(patp) + '';
66 }
68 async getShipsByPatp(patp) {
69 return await fetch(this.getShipsByPatpUrl(patp), {
70 method: 'GET',
71 headers: {
72 Accept: 'application/json',
73 },
74 });
75 }
77 getShipsByPatpDetailsUrl(patp) {
78 return this.endpoint + '/ships/' + encodeURIComponent(patp) + '/details';
79 }
81 async getShipsByPatpDetails(patp) {
82 return await fetch(this.getShipsByPatpDetailsUrl(patp), {
83 method: 'GET',
84 headers: {
85 Accept: 'application/json',
86 },
87 });
88 }
90 postShipsUrl() {
91 return this.endpoint + '/ships';
92 }
94 async postShips(data) {
95 return await fetch(this.postShipsUrl(), {
96 method: 'POST',
97 cache: 'no-cache',
98 body: JSON.stringify(data),
99 headers: {
100 Accept: 'application/json',
101 'Content-Type': 'application/json',
102 },
103 });
104 }