@buildcalendar/sdk 0.1.0-alpha.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/esm/client.js +57 -0
- package/esm/errors.js +27 -0
- package/esm/internal/request.js +59 -0
- package/esm/mod.js +2 -0
- package/esm/package.json +3 -0
- package/esm/types.js +1 -0
- package/package.json +28 -0
- package/script/client.js +60 -0
- package/script/errors.js +31 -0
- package/script/internal/request.js +62 -0
- package/script/mod.js +7 -0
- package/script/package.json +3 -0
- package/script/types.js +2 -0
- package/types/client.d.ts +40 -0
- package/types/client.d.ts.map +1 -0
- package/types/errors.d.ts +13 -0
- package/types/errors.d.ts.map +1 -0
- package/types/internal/request.d.ts +17 -0
- package/types/internal/request.d.ts.map +1 -0
- package/types/mod.d.ts +4 -0
- package/types/mod.d.ts.map +1 -0
- package/types/types.d.ts +56 -0
- package/types/types.d.ts.map +1 -0
package/esm/client.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createRequester } from "./internal/request.js";
|
|
2
|
+
const DEFAULT_BASE_URL = "https://buildcalendar.com/api/v1";
|
|
3
|
+
export function createClient({ apiKey, baseUrl, fetch }) {
|
|
4
|
+
if (!apiKey) {
|
|
5
|
+
throw new Error("apiKey is required");
|
|
6
|
+
}
|
|
7
|
+
const { request } = createRequester({
|
|
8
|
+
apiKey,
|
|
9
|
+
baseUrl: baseUrl ?? DEFAULT_BASE_URL,
|
|
10
|
+
fetcher: fetch ?? globalThis.fetch,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
health: (options) => request("/health", { options }),
|
|
14
|
+
calendars: {
|
|
15
|
+
list: (options) => request("/calendars", { options }),
|
|
16
|
+
get: (id, options) => request(`/calendars/${id}`, { options }),
|
|
17
|
+
create: (input, options) => request("/calendars", {
|
|
18
|
+
method: "POST",
|
|
19
|
+
body: {
|
|
20
|
+
name: input.name,
|
|
21
|
+
external_id: input.externalId,
|
|
22
|
+
timezone: input.timezone,
|
|
23
|
+
color: input.color,
|
|
24
|
+
description: input.description,
|
|
25
|
+
},
|
|
26
|
+
options,
|
|
27
|
+
}),
|
|
28
|
+
delete: (id, options) => request(`/calendars/${id}`, {
|
|
29
|
+
method: "DELETE",
|
|
30
|
+
options,
|
|
31
|
+
}),
|
|
32
|
+
events: (id, options) => request(`/calendars/${id}/events`, { options }),
|
|
33
|
+
},
|
|
34
|
+
events: {
|
|
35
|
+
create: (input, options) => request("/events", {
|
|
36
|
+
method: "POST",
|
|
37
|
+
body: {
|
|
38
|
+
calendar_id: input.calendarId,
|
|
39
|
+
title: input.title,
|
|
40
|
+
start: input.start,
|
|
41
|
+
end: input.end,
|
|
42
|
+
is_all_day: input.isAllDay,
|
|
43
|
+
description: input.description,
|
|
44
|
+
timezone: input.timezone,
|
|
45
|
+
payload: input.payload,
|
|
46
|
+
rrule: input.rrule,
|
|
47
|
+
},
|
|
48
|
+
options,
|
|
49
|
+
}),
|
|
50
|
+
get: (id, options) => request(`/events/${id}`, { options }),
|
|
51
|
+
delete: (id, options) => request(`/events/${id}`, {
|
|
52
|
+
method: "DELETE",
|
|
53
|
+
options,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
package/esm/errors.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class ApiError extends Error {
|
|
2
|
+
constructor({ status, message, code, details }) {
|
|
3
|
+
super(message);
|
|
4
|
+
Object.defineProperty(this, "status", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: void 0
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(this, "code", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "details", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
this.name = "ApiError";
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.details = details;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ApiError } from "../errors.js";
|
|
2
|
+
export function createRequester({ apiKey, baseUrl, fetcher, }) {
|
|
3
|
+
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
4
|
+
async function request(path, init = {}) {
|
|
5
|
+
const headers = new Headers(init.options?.headers);
|
|
6
|
+
headers.set("x-api-key", apiKey);
|
|
7
|
+
const hasBody = init.body !== undefined;
|
|
8
|
+
if (hasBody) {
|
|
9
|
+
headers.set("content-type", "application/json");
|
|
10
|
+
}
|
|
11
|
+
const response = await fetcher(`${normalizedBaseUrl}${path}`, {
|
|
12
|
+
method: init.method ?? "GET",
|
|
13
|
+
headers,
|
|
14
|
+
body: hasBody ? JSON.stringify(init.body) : undefined,
|
|
15
|
+
signal: init.options?.signal,
|
|
16
|
+
});
|
|
17
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
18
|
+
const isJson = contentType.includes("application/json");
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
let details;
|
|
21
|
+
if (isJson) {
|
|
22
|
+
try {
|
|
23
|
+
details = await response.json();
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
details = undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
try {
|
|
31
|
+
details = await response.text();
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
details = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const errorMessage = typeof details === "object" && details !== null && "error" in details
|
|
38
|
+
? String(details.error ?? response.statusText)
|
|
39
|
+
: response.statusText || "Request failed";
|
|
40
|
+
const errorCode = typeof details === "object" && details !== null && "error" in details
|
|
41
|
+
? String(details.error ?? "") || undefined
|
|
42
|
+
: undefined;
|
|
43
|
+
throw new ApiError({
|
|
44
|
+
status: response.status,
|
|
45
|
+
message: errorMessage,
|
|
46
|
+
code: errorCode,
|
|
47
|
+
details,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (response.status === 204) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (isJson) {
|
|
54
|
+
return (await response.json());
|
|
55
|
+
}
|
|
56
|
+
return (await response.text());
|
|
57
|
+
}
|
|
58
|
+
return { request };
|
|
59
|
+
}
|
package/esm/mod.js
ADDED
package/esm/package.json
ADDED
package/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buildcalendar/sdk",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Official buildcalendar.com SDK",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"buildcalendar",
|
|
7
|
+
"sdk",
|
|
8
|
+
"api"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "./script/mod.js",
|
|
12
|
+
"module": "./esm/mod.js",
|
|
13
|
+
"types": "./types/mod.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./types/mod.d.ts",
|
|
18
|
+
"default": "./esm/mod.js"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./types/mod.d.ts",
|
|
22
|
+
"default": "./script/mod.js"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {},
|
|
27
|
+
"_generatedBy": "dnt@dev"
|
|
28
|
+
}
|
package/script/client.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createClient = createClient;
|
|
4
|
+
const request_js_1 = require("./internal/request.js");
|
|
5
|
+
const DEFAULT_BASE_URL = "https://buildcalendar.com/api/v1";
|
|
6
|
+
function createClient({ apiKey, baseUrl, fetch }) {
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
throw new Error("apiKey is required");
|
|
9
|
+
}
|
|
10
|
+
const { request } = (0, request_js_1.createRequester)({
|
|
11
|
+
apiKey,
|
|
12
|
+
baseUrl: baseUrl ?? DEFAULT_BASE_URL,
|
|
13
|
+
fetcher: fetch ?? globalThis.fetch,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
health: (options) => request("/health", { options }),
|
|
17
|
+
calendars: {
|
|
18
|
+
list: (options) => request("/calendars", { options }),
|
|
19
|
+
get: (id, options) => request(`/calendars/${id}`, { options }),
|
|
20
|
+
create: (input, options) => request("/calendars", {
|
|
21
|
+
method: "POST",
|
|
22
|
+
body: {
|
|
23
|
+
name: input.name,
|
|
24
|
+
external_id: input.externalId,
|
|
25
|
+
timezone: input.timezone,
|
|
26
|
+
color: input.color,
|
|
27
|
+
description: input.description,
|
|
28
|
+
},
|
|
29
|
+
options,
|
|
30
|
+
}),
|
|
31
|
+
delete: (id, options) => request(`/calendars/${id}`, {
|
|
32
|
+
method: "DELETE",
|
|
33
|
+
options,
|
|
34
|
+
}),
|
|
35
|
+
events: (id, options) => request(`/calendars/${id}/events`, { options }),
|
|
36
|
+
},
|
|
37
|
+
events: {
|
|
38
|
+
create: (input, options) => request("/events", {
|
|
39
|
+
method: "POST",
|
|
40
|
+
body: {
|
|
41
|
+
calendar_id: input.calendarId,
|
|
42
|
+
title: input.title,
|
|
43
|
+
start: input.start,
|
|
44
|
+
end: input.end,
|
|
45
|
+
is_all_day: input.isAllDay,
|
|
46
|
+
description: input.description,
|
|
47
|
+
timezone: input.timezone,
|
|
48
|
+
payload: input.payload,
|
|
49
|
+
rrule: input.rrule,
|
|
50
|
+
},
|
|
51
|
+
options,
|
|
52
|
+
}),
|
|
53
|
+
get: (id, options) => request(`/events/${id}`, { options }),
|
|
54
|
+
delete: (id, options) => request(`/events/${id}`, {
|
|
55
|
+
method: "DELETE",
|
|
56
|
+
options,
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
package/script/errors.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
constructor({ status, message, code, details }) {
|
|
6
|
+
super(message);
|
|
7
|
+
Object.defineProperty(this, "status", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: void 0
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(this, "code", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: void 0
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "details", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
this.name = "ApiError";
|
|
26
|
+
this.status = status;
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.details = details;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRequester = createRequester;
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
|
+
function createRequester({ apiKey, baseUrl, fetcher, }) {
|
|
6
|
+
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
7
|
+
async function request(path, init = {}) {
|
|
8
|
+
const headers = new Headers(init.options?.headers);
|
|
9
|
+
headers.set("x-api-key", apiKey);
|
|
10
|
+
const hasBody = init.body !== undefined;
|
|
11
|
+
if (hasBody) {
|
|
12
|
+
headers.set("content-type", "application/json");
|
|
13
|
+
}
|
|
14
|
+
const response = await fetcher(`${normalizedBaseUrl}${path}`, {
|
|
15
|
+
method: init.method ?? "GET",
|
|
16
|
+
headers,
|
|
17
|
+
body: hasBody ? JSON.stringify(init.body) : undefined,
|
|
18
|
+
signal: init.options?.signal,
|
|
19
|
+
});
|
|
20
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
21
|
+
const isJson = contentType.includes("application/json");
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
let details;
|
|
24
|
+
if (isJson) {
|
|
25
|
+
try {
|
|
26
|
+
details = await response.json();
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
details = undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
try {
|
|
34
|
+
details = await response.text();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
details = undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const errorMessage = typeof details === "object" && details !== null && "error" in details
|
|
41
|
+
? String(details.error ?? response.statusText)
|
|
42
|
+
: response.statusText || "Request failed";
|
|
43
|
+
const errorCode = typeof details === "object" && details !== null && "error" in details
|
|
44
|
+
? String(details.error ?? "") || undefined
|
|
45
|
+
: undefined;
|
|
46
|
+
throw new errors_js_1.ApiError({
|
|
47
|
+
status: response.status,
|
|
48
|
+
message: errorMessage,
|
|
49
|
+
code: errorCode,
|
|
50
|
+
details,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (response.status === 204) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (isJson) {
|
|
57
|
+
return (await response.json());
|
|
58
|
+
}
|
|
59
|
+
return (await response.text());
|
|
60
|
+
}
|
|
61
|
+
return { request };
|
|
62
|
+
}
|
package/script/mod.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = exports.createClient = void 0;
|
|
4
|
+
var client_js_1 = require("./client.js");
|
|
5
|
+
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_js_1.createClient; } });
|
|
6
|
+
var errors_js_1 = require("./errors.js");
|
|
7
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return errors_js_1.ApiError; } });
|
package/script/types.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Calendar, CreateCalendarInput, CreateEventInput, DeleteResponse, Event, EventWithCalendar, HealthResponse } from "./types.js";
|
|
2
|
+
export type CreateClientOptions = {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
};
|
|
7
|
+
export declare function createClient({ apiKey, baseUrl, fetch }: CreateClientOptions): {
|
|
8
|
+
health: (options?: {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}) => Promise<HealthResponse>;
|
|
11
|
+
calendars: {
|
|
12
|
+
list: (options?: {
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}) => Promise<Calendar[]>;
|
|
15
|
+
get: (id: string, options?: {
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}) => Promise<Calendar>;
|
|
18
|
+
create: (input: CreateCalendarInput, options?: {
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}) => Promise<Calendar>;
|
|
21
|
+
delete: (id: string, options?: {
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}) => Promise<DeleteResponse>;
|
|
24
|
+
events: (id: string, options?: {
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
}) => Promise<Event[]>;
|
|
27
|
+
};
|
|
28
|
+
events: {
|
|
29
|
+
create: (input: CreateEventInput, options?: {
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}) => Promise<Event>;
|
|
32
|
+
get: (id: string, options?: {
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}) => Promise<EventWithCalendar>;
|
|
35
|
+
delete: (id: string, options?: {
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}) => Promise<DeleteResponse>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB,CAAC;AAIF,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,mBAAmB;uBAYrD;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE;;yBAGxB;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;kBAE/B,MAAM,YAAY;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;wBAG3C,mBAAmB,YAChB;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;qBAavB,MAAM,YAAY;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;qBAK1C,MAAM,YAAY;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;;;wBAIvC,gBAAgB,YAAY;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;kBAgB1D,MAAM,YAAY;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;qBAEvC,MAAM,YAAY;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;;EAO5D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ApiErrorPayload = {
|
|
2
|
+
status: number;
|
|
3
|
+
message: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
details?: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare class ApiError extends Error {
|
|
8
|
+
readonly status: number;
|
|
9
|
+
readonly code?: string;
|
|
10
|
+
readonly details?: unknown;
|
|
11
|
+
constructor({ status, message, code, details }: ApiErrorPayload);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEf,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,eAAe;CAOhE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type RequestOptions = {
|
|
2
|
+
signal?: AbortSignal;
|
|
3
|
+
headers?: Record<string, string>;
|
|
4
|
+
};
|
|
5
|
+
export type Requester = {
|
|
6
|
+
request: <T>(path: string, init?: {
|
|
7
|
+
method?: string;
|
|
8
|
+
body?: unknown;
|
|
9
|
+
options?: RequestOptions;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
};
|
|
12
|
+
export declare function createRequester({ apiKey, baseUrl, fetcher, }: {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
fetcher: typeof fetch;
|
|
16
|
+
}): Requester;
|
|
17
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/internal/request.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,CAAC,CAAC,EACT,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,OAAO,CAAC,EAAE,cAAc,CAAC;KAC1B,KACE,OAAO,CAAC,CAAC,CAAC,CAAC;CACjB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,KAAK,CAAC;CACvB,GAAG,SAAS,CA6EZ"}
|
package/types/mod.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EACV,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type Calendar = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string | null;
|
|
5
|
+
external_id: string | null;
|
|
6
|
+
timezone: string;
|
|
7
|
+
color: string | null;
|
|
8
|
+
created_at: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
};
|
|
11
|
+
export type Event = {
|
|
12
|
+
id: string;
|
|
13
|
+
calendar_id: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
is_all_day: boolean;
|
|
16
|
+
start_ts: string | null;
|
|
17
|
+
end_ts: string | null;
|
|
18
|
+
start_date: string | null;
|
|
19
|
+
end_date: string | null;
|
|
20
|
+
timezone: string | null;
|
|
21
|
+
payload: Record<string, unknown>;
|
|
22
|
+
rrule: string | null;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
};
|
|
26
|
+
export type EventWithCalendar = Event & {
|
|
27
|
+
calendar: {
|
|
28
|
+
id: string;
|
|
29
|
+
team_id: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type CreateCalendarInput = {
|
|
33
|
+
name: string;
|
|
34
|
+
externalId?: string;
|
|
35
|
+
timezone?: string;
|
|
36
|
+
color?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
};
|
|
39
|
+
export type CreateEventInput = {
|
|
40
|
+
calendarId: string;
|
|
41
|
+
title: string;
|
|
42
|
+
start: string;
|
|
43
|
+
end: string;
|
|
44
|
+
isAllDay?: boolean;
|
|
45
|
+
description?: string;
|
|
46
|
+
timezone?: string;
|
|
47
|
+
payload?: Record<string, unknown>;
|
|
48
|
+
rrule?: string;
|
|
49
|
+
};
|
|
50
|
+
export type DeleteResponse = {
|
|
51
|
+
success: true;
|
|
52
|
+
};
|
|
53
|
+
export type HealthResponse = {
|
|
54
|
+
status: "ok";
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","s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