@reor/tripper-api-client 0.0.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.
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/client.gen.js +239 -0
- package/dist/generated/client/index.d.ts +8 -0
- package/dist/generated/client/index.js +17 -0
- package/dist/generated/client/types.gen.d.ts +117 -0
- package/dist/generated/client/types.gen.js +3 -0
- package/dist/generated/client/utils.gen.d.ts +33 -0
- package/dist/generated/client/utils.gen.js +239 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/client.gen.js +6 -0
- package/dist/generated/core/auth.gen.d.ts +18 -0
- package/dist/generated/core/auth.gen.js +18 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/bodySerializer.gen.js +60 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/params.gen.js +104 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/pathSerializer.gen.js +115 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/queryKeySerializer.gen.js +98 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/serverSentEvents.gen.js +137 -0
- package/dist/generated/core/types.gen.d.ts +78 -0
- package/dist/generated/core/types.gen.js +3 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/core/utils.gen.js +93 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +8 -0
- package/dist/generated/sdk.gen.d.ts +28 -0
- package/dist/generated/sdk.gen.js +37 -0
- package/dist/generated/types.gen.d.ts +94 -0
- package/dist/generated/types.gen.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -0
- package/package.json +18 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createSseClient = void 0;
|
|
5
|
+
const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
6
|
+
let lastEventId;
|
|
7
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
8
|
+
const createStream = async function* () {
|
|
9
|
+
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
10
|
+
let attempt = 0;
|
|
11
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
12
|
+
while (true) {
|
|
13
|
+
if (signal.aborted)
|
|
14
|
+
break;
|
|
15
|
+
attempt++;
|
|
16
|
+
const headers = options.headers instanceof Headers
|
|
17
|
+
? options.headers
|
|
18
|
+
: new Headers(options.headers);
|
|
19
|
+
if (lastEventId !== undefined) {
|
|
20
|
+
headers.set('Last-Event-ID', lastEventId);
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const requestInit = {
|
|
24
|
+
redirect: 'follow',
|
|
25
|
+
...options,
|
|
26
|
+
body: options.serializedBody,
|
|
27
|
+
headers,
|
|
28
|
+
signal,
|
|
29
|
+
};
|
|
30
|
+
let request = new Request(url, requestInit);
|
|
31
|
+
if (onRequest) {
|
|
32
|
+
request = await onRequest(url, requestInit);
|
|
33
|
+
}
|
|
34
|
+
// fetch must be assigned here, otherwise it would throw the error:
|
|
35
|
+
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
36
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
37
|
+
const response = await _fetch(request);
|
|
38
|
+
if (!response.ok)
|
|
39
|
+
throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
40
|
+
if (!response.body)
|
|
41
|
+
throw new Error('No body in SSE response');
|
|
42
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
43
|
+
let buffer = '';
|
|
44
|
+
const abortHandler = () => {
|
|
45
|
+
try {
|
|
46
|
+
reader.cancel();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// noop
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
signal.addEventListener('abort', abortHandler);
|
|
53
|
+
try {
|
|
54
|
+
while (true) {
|
|
55
|
+
const { done, value } = await reader.read();
|
|
56
|
+
if (done)
|
|
57
|
+
break;
|
|
58
|
+
buffer += value;
|
|
59
|
+
// Normalize line endings: CRLF -> LF, then CR -> LF
|
|
60
|
+
buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
61
|
+
const chunks = buffer.split('\n\n');
|
|
62
|
+
buffer = chunks.pop() ?? '';
|
|
63
|
+
for (const chunk of chunks) {
|
|
64
|
+
const lines = chunk.split('\n');
|
|
65
|
+
const dataLines = [];
|
|
66
|
+
let eventName;
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
if (line.startsWith('data:')) {
|
|
69
|
+
dataLines.push(line.replace(/^data:\s*/, ''));
|
|
70
|
+
}
|
|
71
|
+
else if (line.startsWith('event:')) {
|
|
72
|
+
eventName = line.replace(/^event:\s*/, '');
|
|
73
|
+
}
|
|
74
|
+
else if (line.startsWith('id:')) {
|
|
75
|
+
lastEventId = line.replace(/^id:\s*/, '');
|
|
76
|
+
}
|
|
77
|
+
else if (line.startsWith('retry:')) {
|
|
78
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
|
|
79
|
+
if (!Number.isNaN(parsed)) {
|
|
80
|
+
retryDelay = parsed;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let data;
|
|
85
|
+
let parsedJson = false;
|
|
86
|
+
if (dataLines.length) {
|
|
87
|
+
const rawData = dataLines.join('\n');
|
|
88
|
+
try {
|
|
89
|
+
data = JSON.parse(rawData);
|
|
90
|
+
parsedJson = true;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
data = rawData;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (parsedJson) {
|
|
97
|
+
if (responseValidator) {
|
|
98
|
+
await responseValidator(data);
|
|
99
|
+
}
|
|
100
|
+
if (responseTransformer) {
|
|
101
|
+
data = await responseTransformer(data);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
onSseEvent?.({
|
|
105
|
+
data,
|
|
106
|
+
event: eventName,
|
|
107
|
+
id: lastEventId,
|
|
108
|
+
retry: retryDelay,
|
|
109
|
+
});
|
|
110
|
+
if (dataLines.length) {
|
|
111
|
+
yield data;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
signal.removeEventListener('abort', abortHandler);
|
|
118
|
+
reader.releaseLock();
|
|
119
|
+
}
|
|
120
|
+
break; // exit loop on normal completion
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
// connection failed or aborted; retry after delay
|
|
124
|
+
onSseError?.(error);
|
|
125
|
+
if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
|
|
126
|
+
break; // stop after firing error
|
|
127
|
+
}
|
|
128
|
+
// exponential backoff: double retry each attempt, cap at 30s
|
|
129
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
|
|
130
|
+
await sleep(backoff);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const stream = createStream();
|
|
135
|
+
return { stream };
|
|
136
|
+
};
|
|
137
|
+
exports.createSseClient = createSseClient;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Auth, AuthToken } from './auth.gen';
|
|
2
|
+
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen';
|
|
3
|
+
export type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
4
|
+
export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
5
|
+
/**
|
|
6
|
+
* Returns the final request URL.
|
|
7
|
+
*/
|
|
8
|
+
buildUrl: BuildUrlFn;
|
|
9
|
+
getConfig: () => Config;
|
|
10
|
+
request: RequestFn;
|
|
11
|
+
setConfig: (config: Config) => Config;
|
|
12
|
+
} & {
|
|
13
|
+
[K in HttpMethod]: MethodFn;
|
|
14
|
+
} & ([SseFn] extends [never] ? {
|
|
15
|
+
sse?: never;
|
|
16
|
+
} : {
|
|
17
|
+
sse: {
|
|
18
|
+
[K in HttpMethod]: SseFn;
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
export interface Config {
|
|
22
|
+
/**
|
|
23
|
+
* Auth token or a function returning auth token. The resolved value will be
|
|
24
|
+
* added to the request payload as defined by its `security` array.
|
|
25
|
+
*/
|
|
26
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
27
|
+
/**
|
|
28
|
+
* A function for serializing request body parameter. By default,
|
|
29
|
+
* {@link JSON.stringify()} will be used.
|
|
30
|
+
*/
|
|
31
|
+
bodySerializer?: BodySerializer | null;
|
|
32
|
+
/**
|
|
33
|
+
* An object containing any HTTP headers that you want to pre-populate your
|
|
34
|
+
* `Headers` object with.
|
|
35
|
+
*
|
|
36
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
37
|
+
*/
|
|
38
|
+
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* The request method.
|
|
41
|
+
*
|
|
42
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
43
|
+
*/
|
|
44
|
+
method?: Uppercase<HttpMethod>;
|
|
45
|
+
/**
|
|
46
|
+
* A function for serializing request query parameters. By default, arrays
|
|
47
|
+
* will be exploded in form style, objects will be exploded in deepObject
|
|
48
|
+
* style, and reserved characters are percent-encoded.
|
|
49
|
+
*
|
|
50
|
+
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
51
|
+
* API function is used.
|
|
52
|
+
*
|
|
53
|
+
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
54
|
+
*/
|
|
55
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
56
|
+
/**
|
|
57
|
+
* A function validating request data. This is useful if you want to ensure
|
|
58
|
+
* the request conforms to the desired shape, so it can be safely sent to
|
|
59
|
+
* the server.
|
|
60
|
+
*/
|
|
61
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* A function transforming response data before it's returned. This is useful
|
|
64
|
+
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
65
|
+
*/
|
|
66
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* A function validating response data. This is useful if you want to ensure
|
|
69
|
+
* the response conforms to the desired shape, so it can be safely passed to
|
|
70
|
+
* the transformers and returned to the user.
|
|
71
|
+
*/
|
|
72
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
73
|
+
}
|
|
74
|
+
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] ? true : [T] extends [never | undefined] ? [undefined] extends [T] ? false : true : false;
|
|
75
|
+
export type OmitNever<T extends Record<string, unknown>> = {
|
|
76
|
+
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
|
|
77
|
+
};
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
|
|
2
|
+
export interface PathSerializer {
|
|
3
|
+
path: Record<string, unknown>;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const PATH_PARAM_RE: RegExp;
|
|
7
|
+
export declare const defaultPathSerializer: ({ path, url: _url }: PathSerializer) => string;
|
|
8
|
+
export declare const getUrl: ({ baseUrl, path, query, querySerializer, url: _url, }: {
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
path?: Record<string, unknown>;
|
|
11
|
+
query?: Record<string, unknown>;
|
|
12
|
+
querySerializer: QuerySerializer;
|
|
13
|
+
url: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
export declare function getValidRequestBody(options: {
|
|
16
|
+
body?: unknown;
|
|
17
|
+
bodySerializer?: BodySerializer | null;
|
|
18
|
+
serializedBody?: unknown;
|
|
19
|
+
}): unknown;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getUrl = exports.defaultPathSerializer = exports.PATH_PARAM_RE = void 0;
|
|
5
|
+
exports.getValidRequestBody = getValidRequestBody;
|
|
6
|
+
const pathSerializer_gen_1 = require("./pathSerializer.gen");
|
|
7
|
+
exports.PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
8
|
+
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
9
|
+
let url = _url;
|
|
10
|
+
const matches = _url.match(exports.PATH_PARAM_RE);
|
|
11
|
+
if (matches) {
|
|
12
|
+
for (const match of matches) {
|
|
13
|
+
let explode = false;
|
|
14
|
+
let name = match.substring(1, match.length - 1);
|
|
15
|
+
let style = 'simple';
|
|
16
|
+
if (name.endsWith('*')) {
|
|
17
|
+
explode = true;
|
|
18
|
+
name = name.substring(0, name.length - 1);
|
|
19
|
+
}
|
|
20
|
+
if (name.startsWith('.')) {
|
|
21
|
+
name = name.substring(1);
|
|
22
|
+
style = 'label';
|
|
23
|
+
}
|
|
24
|
+
else if (name.startsWith(';')) {
|
|
25
|
+
name = name.substring(1);
|
|
26
|
+
style = 'matrix';
|
|
27
|
+
}
|
|
28
|
+
const value = path[name];
|
|
29
|
+
if (value === undefined || value === null) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
url = url.replace(match, (0, pathSerializer_gen_1.serializeArrayParam)({ explode, name, style, value }));
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (typeof value === 'object') {
|
|
37
|
+
url = url.replace(match, (0, pathSerializer_gen_1.serializeObjectParam)({
|
|
38
|
+
explode,
|
|
39
|
+
name,
|
|
40
|
+
style,
|
|
41
|
+
value: value,
|
|
42
|
+
valueOnly: true,
|
|
43
|
+
}));
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (style === 'matrix') {
|
|
47
|
+
url = url.replace(match, `;${(0, pathSerializer_gen_1.serializePrimitiveParam)({
|
|
48
|
+
name,
|
|
49
|
+
value: value,
|
|
50
|
+
})}`);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
54
|
+
url = url.replace(match, replaceValue);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return url;
|
|
58
|
+
};
|
|
59
|
+
exports.defaultPathSerializer = defaultPathSerializer;
|
|
60
|
+
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
61
|
+
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
62
|
+
let url = (baseUrl ?? '') + pathUrl;
|
|
63
|
+
if (path) {
|
|
64
|
+
url = (0, exports.defaultPathSerializer)({ path, url });
|
|
65
|
+
}
|
|
66
|
+
let search = query ? querySerializer(query) : '';
|
|
67
|
+
if (search.startsWith('?')) {
|
|
68
|
+
search = search.substring(1);
|
|
69
|
+
}
|
|
70
|
+
if (search) {
|
|
71
|
+
url += `?${search}`;
|
|
72
|
+
}
|
|
73
|
+
return url;
|
|
74
|
+
};
|
|
75
|
+
exports.getUrl = getUrl;
|
|
76
|
+
function getValidRequestBody(options) {
|
|
77
|
+
const hasBody = options.body !== undefined;
|
|
78
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
79
|
+
if (isSerializedBody) {
|
|
80
|
+
if ('serializedBody' in options) {
|
|
81
|
+
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';
|
|
82
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
83
|
+
}
|
|
84
|
+
// not all clients implement a serializedBody property (i.e., client-axios)
|
|
85
|
+
return options.body !== '' ? options.body : null;
|
|
86
|
+
}
|
|
87
|
+
// plain/text body
|
|
88
|
+
if (hasBody) {
|
|
89
|
+
return options.body;
|
|
90
|
+
}
|
|
91
|
+
// no body was provided
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createLocation, get, getLocationsWithinBoundingBox, type Options } from './sdk.gen';
|
|
2
|
+
export type { ClientOptions, CreateLocationData, CreateLocationError, CreateLocationErrors, CreateLocationRequest, CreateLocationResponse, CreateLocationResponses, GetData, GetLocationsWithinBoundingBoxData, GetLocationsWithinBoundingBoxError, GetLocationsWithinBoundingBoxErrors, GetLocationsWithinBoundingBoxResponse, GetLocationsWithinBoundingBoxResponses, GetResponse, GetResponses, JsonElement, LocationResponse, ProblemDetails } from './types.gen';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getLocationsWithinBoundingBox = exports.get = exports.createLocation = void 0;
|
|
5
|
+
var sdk_gen_1 = require("./sdk.gen");
|
|
6
|
+
Object.defineProperty(exports, "createLocation", { enumerable: true, get: function () { return sdk_gen_1.createLocation; } });
|
|
7
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return sdk_gen_1.get; } });
|
|
8
|
+
Object.defineProperty(exports, "getLocationsWithinBoundingBox", { enumerable: true, get: function () { return sdk_gen_1.getLocationsWithinBoundingBox; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
+
import type { CreateLocationData, CreateLocationErrors, CreateLocationResponses, GetData, GetLocationsWithinBoundingBoxData, GetLocationsWithinBoundingBoxErrors, GetLocationsWithinBoundingBoxResponses, GetResponses } from './types.gen';
|
|
3
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
|
+
/**
|
|
5
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
6
|
+
* individual options. This might be also useful if you want to implement a
|
|
7
|
+
* custom client.
|
|
8
|
+
*/
|
|
9
|
+
client?: Client;
|
|
10
|
+
/**
|
|
11
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
12
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
13
|
+
*/
|
|
14
|
+
meta?: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
export declare const get: <ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) => import("./client").RequestResult<GetResponses, unknown, ThrowOnError, "fields">;
|
|
17
|
+
/**
|
|
18
|
+
* Get locations within a bounding box
|
|
19
|
+
*
|
|
20
|
+
* Returns locations owned by the authenticated user that intersect the supplied WGS84 bounding box.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getLocationsWithinBoundingBox: <ThrowOnError extends boolean = false>(options: Options<GetLocationsWithinBoundingBoxData, ThrowOnError>) => import("./client").RequestResult<GetLocationsWithinBoundingBoxResponses, GetLocationsWithinBoundingBoxErrors, ThrowOnError, "fields">;
|
|
23
|
+
/**
|
|
24
|
+
* Create a location
|
|
25
|
+
*
|
|
26
|
+
* Creates a location owned by the authenticated user from a GeoJSON geometry.
|
|
27
|
+
*/
|
|
28
|
+
export declare const createLocation: <ThrowOnError extends boolean = false>(options: Options<CreateLocationData, ThrowOnError>) => import("./client").RequestResult<CreateLocationResponses, CreateLocationErrors, ThrowOnError, "fields">;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createLocation = exports.getLocationsWithinBoundingBox = exports.get = void 0;
|
|
5
|
+
const client_gen_1 = require("./client.gen");
|
|
6
|
+
const get = (options) => (options?.client ?? client_gen_1.client).get({
|
|
7
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
8
|
+
url: '/',
|
|
9
|
+
...options
|
|
10
|
+
});
|
|
11
|
+
exports.get = get;
|
|
12
|
+
/**
|
|
13
|
+
* Get locations within a bounding box
|
|
14
|
+
*
|
|
15
|
+
* Returns locations owned by the authenticated user that intersect the supplied WGS84 bounding box.
|
|
16
|
+
*/
|
|
17
|
+
const getLocationsWithinBoundingBox = (options) => (options.client ?? client_gen_1.client).get({
|
|
18
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
19
|
+
url: '/location',
|
|
20
|
+
...options
|
|
21
|
+
});
|
|
22
|
+
exports.getLocationsWithinBoundingBox = getLocationsWithinBoundingBox;
|
|
23
|
+
/**
|
|
24
|
+
* Create a location
|
|
25
|
+
*
|
|
26
|
+
* Creates a location owned by the authenticated user from a GeoJSON geometry.
|
|
27
|
+
*/
|
|
28
|
+
const createLocation = (options) => (options.client ?? client_gen_1.client).post({
|
|
29
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
30
|
+
url: '/location',
|
|
31
|
+
...options,
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
...options.headers
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.createLocation = createLocation;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export type ClientOptions = {
|
|
2
|
+
baseUrl: `${string}://${string}` | (string & {});
|
|
3
|
+
};
|
|
4
|
+
export type CreateLocationRequest = {
|
|
5
|
+
name: string;
|
|
6
|
+
geometry: JsonElement;
|
|
7
|
+
parentLocationId?: null | string;
|
|
8
|
+
};
|
|
9
|
+
export type JsonElement = unknown;
|
|
10
|
+
export type LocationResponse = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
geometry: JsonElement;
|
|
14
|
+
parentLocationId: null | string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
};
|
|
18
|
+
export type ProblemDetails = {
|
|
19
|
+
type?: null | string;
|
|
20
|
+
title?: null | string;
|
|
21
|
+
status?: null | number | string;
|
|
22
|
+
detail?: null | string;
|
|
23
|
+
instance?: null | string;
|
|
24
|
+
};
|
|
25
|
+
export type GetData = {
|
|
26
|
+
body?: never;
|
|
27
|
+
path?: never;
|
|
28
|
+
query?: never;
|
|
29
|
+
url: '/';
|
|
30
|
+
};
|
|
31
|
+
export type GetResponses = {
|
|
32
|
+
/**
|
|
33
|
+
* OK
|
|
34
|
+
*/
|
|
35
|
+
200: string;
|
|
36
|
+
};
|
|
37
|
+
export type GetResponse = GetResponses[keyof GetResponses];
|
|
38
|
+
export type GetLocationsWithinBoundingBoxData = {
|
|
39
|
+
body?: never;
|
|
40
|
+
path?: never;
|
|
41
|
+
query: {
|
|
42
|
+
minLongitude: number | string;
|
|
43
|
+
minLatitude: number | string;
|
|
44
|
+
maxLongitude: number | string;
|
|
45
|
+
maxLatitude: number | string;
|
|
46
|
+
};
|
|
47
|
+
url: '/location';
|
|
48
|
+
};
|
|
49
|
+
export type GetLocationsWithinBoundingBoxErrors = {
|
|
50
|
+
/**
|
|
51
|
+
* Bad Request
|
|
52
|
+
*/
|
|
53
|
+
400: ProblemDetails;
|
|
54
|
+
/**
|
|
55
|
+
* Unauthorized
|
|
56
|
+
*/
|
|
57
|
+
401: unknown;
|
|
58
|
+
};
|
|
59
|
+
export type GetLocationsWithinBoundingBoxError = GetLocationsWithinBoundingBoxErrors[keyof GetLocationsWithinBoundingBoxErrors];
|
|
60
|
+
export type GetLocationsWithinBoundingBoxResponses = {
|
|
61
|
+
/**
|
|
62
|
+
* OK
|
|
63
|
+
*/
|
|
64
|
+
200: Array<LocationResponse>;
|
|
65
|
+
};
|
|
66
|
+
export type GetLocationsWithinBoundingBoxResponse = GetLocationsWithinBoundingBoxResponses[keyof GetLocationsWithinBoundingBoxResponses];
|
|
67
|
+
export type CreateLocationData = {
|
|
68
|
+
body: CreateLocationRequest;
|
|
69
|
+
path?: never;
|
|
70
|
+
query?: never;
|
|
71
|
+
url: '/location';
|
|
72
|
+
};
|
|
73
|
+
export type CreateLocationErrors = {
|
|
74
|
+
/**
|
|
75
|
+
* Bad Request
|
|
76
|
+
*/
|
|
77
|
+
400: ProblemDetails;
|
|
78
|
+
/**
|
|
79
|
+
* Unauthorized
|
|
80
|
+
*/
|
|
81
|
+
401: unknown;
|
|
82
|
+
/**
|
|
83
|
+
* Service Unavailable
|
|
84
|
+
*/
|
|
85
|
+
503: ProblemDetails;
|
|
86
|
+
};
|
|
87
|
+
export type CreateLocationError = CreateLocationErrors[keyof CreateLocationErrors];
|
|
88
|
+
export type CreateLocationResponses = {
|
|
89
|
+
/**
|
|
90
|
+
* Created
|
|
91
|
+
*/
|
|
92
|
+
201: LocationResponse;
|
|
93
|
+
};
|
|
94
|
+
export type CreateLocationResponse = CreateLocationResponses[keyof CreateLocationResponses];
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.client = void 0;
|
|
18
|
+
__exportStar(require("./generated"), exports);
|
|
19
|
+
var client_gen_1 = require("./generated/client.gen");
|
|
20
|
+
Object.defineProperty(exports, "client", { enumerable: true, get: function () { return client_gen_1.client; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reor/tripper-api-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Generated TypeScript client for the Tripper API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"generate": "openapi-ts -i ../Reor.Software.Tripper.WebHost/obj/openapi/Reor.Software.Tripper.WebHost.json -o src/generated",
|
|
12
|
+
"build": "tsc -p tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@hey-api/openapi-ts": "0.95.0",
|
|
16
|
+
"typescript": "5.9.3"
|
|
17
|
+
}
|
|
18
|
+
}
|