umami-api-js 0.1.1 → 0.1.3
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/README.md +3 -3
- package/dist/index.d.ts +16 -27
- package/dist/index.js +7 -5
- package/dist/namespaces/Admin.d.ts +3 -13
- package/dist/namespaces/Events.d.ts +37 -36
- package/dist/namespaces/Events.js +7 -7
- package/dist/namespaces/Links.d.ts +3 -3
- package/dist/namespaces/Me.d.ts +3 -26
- package/dist/namespaces/Pixels.d.ts +2 -2
- package/dist/namespaces/Realtime.d.ts +3 -3
- package/dist/namespaces/Reports.d.ts +12 -12
- package/dist/namespaces/Sessions.d.ts +54 -38
- package/dist/namespaces/Sessions.js +12 -10
- package/dist/namespaces/Teams.d.ts +52 -53
- package/dist/namespaces/Teams.js +15 -12
- package/dist/namespaces/Users.d.ts +3 -19
- package/dist/namespaces/WebsiteStats.d.ts +6 -6
- package/dist/namespaces/Websites.d.ts +34 -16
- package/dist/utilities.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
A package to interact with [the API of self-hosted instances of Umami v3.0.
|
|
1
|
+
A package to interact with [the API of self-hosted instances of Umami v3.0.1](https://umami.is/docs/api). It is a lightweight alternative to [@umami/api-client](https://github.com/umami-software/api-client), forked from [osu-api-v2-js](https://github.com/TTTaevas/osu-api-v2-js).
|
|
2
2
|
|
|
3
|
-
If you are reading this from the [package's documentation](https://umami-api-js.taevas.xyz/), please be aware that the documentation is for **umami-api-js@0.1.
|
|
3
|
+
If you are reading this from the [package's documentation](https://umami-api-js.taevas.xyz/), please be aware that the documentation is for **umami-api-js@0.1.3**, so make sure your package is up to date! Report any bug on [Codeberg](https://codeberg.org/Taevas/umami-api-js/issues).
|
|
4
4
|
|
|
5
|
-
Please note that this package is expected to work with self-hosted instances of **Umami v3.0.
|
|
5
|
+
Please note that this package is expected to work with self-hosted instances of **Umami v3.0.1**, and is *not* expected to work with [Umami Cloud](https://umami.is/docs/cloud), the instance of Umami hosted by its creators.
|
package/dist/index.d.ts
CHANGED
|
@@ -20,19 +20,9 @@ export interface GenericObject {
|
|
|
20
20
|
export interface DeletionResult {
|
|
21
21
|
ok: boolean;
|
|
22
22
|
}
|
|
23
|
-
export interface Website extends GenericObject {
|
|
24
|
-
name: string;
|
|
25
|
-
domain: string;
|
|
26
|
-
shareId: string | null;
|
|
27
|
-
resetAt: Date | null;
|
|
28
|
-
/** @remarks Is null if the website is under a team (has a `teamId`) */
|
|
29
|
-
userId: Users.User["id"] | null;
|
|
30
|
-
teamId: string | null;
|
|
31
|
-
createdBy: Users.User["id"];
|
|
32
|
-
}
|
|
33
23
|
export interface Report extends Omit<GenericObject, "deletedAt"> {
|
|
34
24
|
userId: Users.User["id"];
|
|
35
|
-
websiteId:
|
|
25
|
+
websiteId: Websites.Website["id"];
|
|
36
26
|
type: string;
|
|
37
27
|
name: string;
|
|
38
28
|
description: string;
|
|
@@ -102,7 +92,6 @@ export interface Filters {
|
|
|
102
92
|
/** UUID of cohort */
|
|
103
93
|
cohort?: string;
|
|
104
94
|
}
|
|
105
|
-
export type TeamRole = "team-manager" | "team-member" | "team-view-only";
|
|
106
95
|
/** If the {@link API} throws an error, it should always be an {@link APIError}! */
|
|
107
96
|
export declare class APIError extends Error {
|
|
108
97
|
message: string;
|
|
@@ -154,7 +143,10 @@ export declare class API {
|
|
|
154
143
|
get server(): string;
|
|
155
144
|
set server(server: string);
|
|
156
145
|
private _headers;
|
|
157
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Used in practically all requests, those are all the headers the package uses excluding `Authorization`, the one with the token
|
|
148
|
+
* @remarks If the User-Agent is not liked by https://isbot.js.org/, Umami might give responses akin to `{beep: "boop"}`
|
|
149
|
+
*/
|
|
158
150
|
get headers(): {
|
|
159
151
|
[key: string]: any;
|
|
160
152
|
};
|
|
@@ -258,37 +250,34 @@ export declare class API {
|
|
|
258
250
|
}): Promise<any>;
|
|
259
251
|
/**
|
|
260
252
|
* To register an event
|
|
261
|
-
* (TODO UNTESTED)
|
|
262
253
|
* @group Sending stats
|
|
263
254
|
*/
|
|
264
|
-
sendStats(
|
|
255
|
+
sendStats(websiteId: Websites.Website["id"], payload?: {
|
|
265
256
|
/** Name of host */
|
|
266
|
-
hostname
|
|
257
|
+
hostname?: Events.Event["hostname"];
|
|
267
258
|
/** Screen resolution (ex. "1920x1080") */
|
|
268
|
-
screen
|
|
259
|
+
screen?: string;
|
|
269
260
|
/** Language of visitor (ex. "en-US") */
|
|
270
|
-
language
|
|
261
|
+
language?: string;
|
|
271
262
|
/** Page URL */
|
|
272
|
-
url
|
|
263
|
+
url?: string;
|
|
273
264
|
/** Referrer URL */
|
|
274
|
-
referrer
|
|
265
|
+
referrer?: string;
|
|
275
266
|
/** Page title */
|
|
276
|
-
title
|
|
267
|
+
title?: string;
|
|
277
268
|
/** Additional tag description */
|
|
278
|
-
tag
|
|
269
|
+
tag?: string;
|
|
279
270
|
/** Session identifier */
|
|
280
|
-
id
|
|
281
|
-
/** Website ID */
|
|
282
|
-
website: string;
|
|
271
|
+
id?: Events.Event["sessionId"];
|
|
283
272
|
/** Name of the event */
|
|
284
|
-
name
|
|
273
|
+
name?: Events.Event["eventName"];
|
|
285
274
|
/** Additional data for the event */
|
|
286
275
|
data?: {
|
|
287
276
|
[k: string]: any;
|
|
288
277
|
};
|
|
289
278
|
}): Promise<{
|
|
290
279
|
cache: string;
|
|
291
|
-
|
|
280
|
+
sessionId: Events.Event["sessionId"];
|
|
292
281
|
visitId: string;
|
|
293
282
|
}>;
|
|
294
283
|
/** @group Admin endpoints */
|
package/dist/index.js
CHANGED
|
@@ -94,9 +94,12 @@ export class API {
|
|
|
94
94
|
"Accept": "application/json",
|
|
95
95
|
"Accept-Encoding": "gzip",
|
|
96
96
|
"Content-Type": "application/json",
|
|
97
|
-
"User-Agent": "umami-api-js (
|
|
97
|
+
"User-Agent": "umami-api-js (codeberg.org/Taevas/umami-api-js)",
|
|
98
98
|
};
|
|
99
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Used in practically all requests, those are all the headers the package uses excluding `Authorization`, the one with the token
|
|
101
|
+
* @remarks If the User-Agent is not liked by https://isbot.js.org/, Umami might give responses akin to `{beep: "boop"}`
|
|
102
|
+
*/
|
|
100
103
|
get headers() { return this._headers; }
|
|
101
104
|
set headers(headers) { this._headers = headers; }
|
|
102
105
|
_user = {
|
|
@@ -384,11 +387,10 @@ export class API {
|
|
|
384
387
|
// UNCATEGORIZED
|
|
385
388
|
/**
|
|
386
389
|
* To register an event
|
|
387
|
-
* (TODO UNTESTED)
|
|
388
390
|
* @group Sending stats
|
|
389
391
|
*/
|
|
390
|
-
async sendStats(payload) {
|
|
391
|
-
return await this.request("post", ["send"], { payload, type: "event" });
|
|
392
|
+
async sendStats(websiteId, payload) {
|
|
393
|
+
return await this.request("post", ["send"], { payload: { website: websiteId, ...payload }, type: "event" });
|
|
392
394
|
}
|
|
393
395
|
// ADMIN
|
|
394
396
|
/** @group Admin endpoints */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API, GenericObject, GenericRequestParameters, Teams, Users,
|
|
1
|
+
import { API, GenericObject, GenericRequestParameters, Teams, Users, Websites } from "../index.js";
|
|
2
2
|
/** Operations around admin management: https://umami.is/docs/api/admin */
|
|
3
3
|
export declare namespace Admin {
|
|
4
4
|
/** Returns all users: https://umami.is/docs/api/admin#get-apiadminusers */
|
|
@@ -12,20 +12,10 @@ export declare namespace Admin {
|
|
|
12
12
|
};
|
|
13
13
|
})[]>;
|
|
14
14
|
/** Returns all websites: https://umami.is/docs/api/admin#get-apiadminwebsites */
|
|
15
|
-
function getWebsites(this: API, parameters?: GenericRequestParameters): Promise<(
|
|
16
|
-
user: Users.MinimalUser;
|
|
15
|
+
function getWebsites(this: API, parameters?: GenericRequestParameters): Promise<(Websites.WebsiteWithUser & {
|
|
17
16
|
/** @remarks TODO Documentation says it can be null but doesn't actually say what else it can be, ***presumed* to be string**, check */
|
|
18
17
|
team: string | null;
|
|
19
18
|
})[]>;
|
|
20
19
|
/** Returns all teams: https://umami.is/docs/api/admin#get-apiadminteams */
|
|
21
|
-
function getTeams(this: API, parameters?: GenericRequestParameters): Promise<
|
|
22
|
-
name: string;
|
|
23
|
-
accessCode: string;
|
|
24
|
-
logoUrl: string | null;
|
|
25
|
-
members: Teams.TeamMember[];
|
|
26
|
-
_count: {
|
|
27
|
-
websites: number;
|
|
28
|
-
members: number;
|
|
29
|
-
};
|
|
30
|
-
})[]>;
|
|
20
|
+
function getTeams(this: API, parameters?: GenericRequestParameters): Promise<Teams.TeamWithMembersCount[]>;
|
|
31
21
|
}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { API, Filters, GenericRequestParameters, Timestamps } from "../index.js";
|
|
1
|
+
import { API, Filters, GenericRequestParameters, Sessions, Timestamps, Websites } from "../index.js";
|
|
2
2
|
/** Operations around Events and Event data: https://umami.is/docs/api/events */
|
|
3
3
|
export declare namespace Events {
|
|
4
|
-
|
|
5
|
-
function get_WEBSITEID_Events(this: API, websiteId: string, parameters: Filters & Timestamps & GenericRequestParameters): Promise<{
|
|
4
|
+
interface Event {
|
|
6
5
|
id: string;
|
|
7
|
-
websiteId:
|
|
8
|
-
sessionId:
|
|
6
|
+
websiteId: Websites.Website["id"];
|
|
7
|
+
sessionId: Sessions.Session["id"];
|
|
9
8
|
createdAt: Date;
|
|
10
9
|
hostname: string;
|
|
11
10
|
urlPath: string;
|
|
12
11
|
urlQuery: string;
|
|
13
|
-
referrerPath: string;
|
|
14
|
-
referrerQuery: string;
|
|
15
|
-
referrerDomain: string;
|
|
12
|
+
referrerPath: string | null;
|
|
13
|
+
referrerQuery: string | null;
|
|
14
|
+
referrerDomain: string | null;
|
|
16
15
|
country: string;
|
|
17
16
|
city: string;
|
|
18
17
|
device: string;
|
|
19
|
-
os: string;
|
|
20
|
-
browser: string;
|
|
21
|
-
pageTitle: string;
|
|
18
|
+
os: string | null;
|
|
19
|
+
browser: string | null;
|
|
20
|
+
pageTitle: string | null;
|
|
22
21
|
eventType: number;
|
|
23
22
|
eventName: string;
|
|
24
|
-
hasData
|
|
25
|
-
}
|
|
26
|
-
/** Gets event
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
hasData?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Gets website event details within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevents */
|
|
26
|
+
function get_WEBSITEID_Events(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & GenericRequestParameters): Promise<Event[]>;
|
|
27
|
+
/** Gets event-data for a individual event: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataeventid */
|
|
28
|
+
function get_WEBSITEID_Eventdata_EVENTID(this: API, websiteId: Websites.Website["id"], eventId: Event["id"]): Promise<{
|
|
29
|
+
websiteId: Websites.Website["id"];
|
|
30
|
+
sessionId?: Sessions.Session["id"];
|
|
31
|
+
eventId: Event["id"];
|
|
32
|
+
urlPath?: string;
|
|
33
|
+
eventName: Event["eventName"];
|
|
33
34
|
dataKey: string;
|
|
34
35
|
stringValue: string;
|
|
35
36
|
numberValue: number | null;
|
|
@@ -37,43 +38,43 @@ export declare namespace Events {
|
|
|
37
38
|
dataType: number;
|
|
38
39
|
createdAt: Date;
|
|
39
40
|
}[]>;
|
|
40
|
-
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO
|
|
41
|
-
function get_WEBSITEID_EventdataEvents(this: API, websiteId:
|
|
41
|
+
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO Server returns a 500) */
|
|
42
|
+
function get_WEBSITEID_EventdataEvents(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
42
43
|
/** Event name filter */
|
|
43
|
-
event?:
|
|
44
|
+
event?: Event["eventName"];
|
|
44
45
|
}): Promise<{
|
|
45
|
-
eventName:
|
|
46
|
+
eventName: Event["eventName"];
|
|
46
47
|
propertyName: string;
|
|
47
48
|
dataType: number;
|
|
48
49
|
total: number;
|
|
49
50
|
}[]>;
|
|
50
|
-
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields
|
|
51
|
-
function get_WEBSITEID_EventdataFields(this: API, websiteId:
|
|
51
|
+
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields */
|
|
52
|
+
function get_WEBSITEID_EventdataFields(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
52
53
|
propertyName: string;
|
|
53
54
|
dataType: number;
|
|
54
55
|
value: string;
|
|
55
56
|
total: number;
|
|
56
57
|
}[]>;
|
|
57
|
-
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties
|
|
58
|
-
function get_WEBSITEID_EventdataProperties(this: API, websiteId:
|
|
59
|
-
eventName:
|
|
58
|
+
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties */
|
|
59
|
+
function get_WEBSITEID_EventdataProperties(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
60
|
+
eventName: Event["eventName"] | null;
|
|
60
61
|
propertyName: string;
|
|
61
62
|
total: number;
|
|
62
63
|
}[]>;
|
|
63
|
-
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues
|
|
64
|
-
function get_WEBSITEID_EventdataValues(this: API, websiteId:
|
|
64
|
+
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues */
|
|
65
|
+
function get_WEBSITEID_EventdataValues(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
65
66
|
/** Event name filter */
|
|
66
|
-
event:
|
|
67
|
+
event: Event["eventName"];
|
|
67
68
|
/** Property name */
|
|
68
69
|
propertyName: string;
|
|
69
70
|
}): Promise<{
|
|
70
71
|
value: string;
|
|
71
72
|
total: number;
|
|
72
|
-
}>;
|
|
73
|
-
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats
|
|
74
|
-
function get_WEBSITEID_EventdataStats(this: API, websiteId:
|
|
73
|
+
}[]>;
|
|
74
|
+
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats */
|
|
75
|
+
function get_WEBSITEID_EventdataStats(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
75
76
|
events: number;
|
|
76
77
|
properties: number;
|
|
77
78
|
records: number;
|
|
78
|
-
}
|
|
79
|
+
}>;
|
|
79
80
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/** Operations around Events and Event data: https://umami.is/docs/api/events */
|
|
2
2
|
export var Events;
|
|
3
3
|
(function (Events) {
|
|
4
|
-
/** Gets website event details within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevents
|
|
4
|
+
/** Gets website event details within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevents */
|
|
5
5
|
async function get_WEBSITEID_Events(websiteId, parameters) {
|
|
6
6
|
const response = await this.request("get", ["websites", websiteId, "events"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
9
|
Events.get_WEBSITEID_Events = get_WEBSITEID_Events;
|
|
10
|
-
/** Gets event-data for a individual event: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataeventid
|
|
10
|
+
/** Gets event-data for a individual event: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataeventid */
|
|
11
11
|
async function get_WEBSITEID_Eventdata_EVENTID(websiteId, eventId) {
|
|
12
12
|
return await this.request("get", ["websites", websiteId, "event-data", eventId]);
|
|
13
13
|
}
|
|
14
14
|
Events.get_WEBSITEID_Eventdata_EVENTID = get_WEBSITEID_Eventdata_EVENTID;
|
|
15
|
-
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO
|
|
15
|
+
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO Server returns a 500) */
|
|
16
16
|
async function get_WEBSITEID_EventdataEvents(websiteId, parameters) {
|
|
17
17
|
return await this.request("get", ["websites", websiteId, "event-data", "events"], parameters);
|
|
18
18
|
}
|
|
19
19
|
Events.get_WEBSITEID_EventdataEvents = get_WEBSITEID_EventdataEvents;
|
|
20
|
-
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields
|
|
20
|
+
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields */
|
|
21
21
|
async function get_WEBSITEID_EventdataFields(websiteId, parameters) {
|
|
22
22
|
return await this.request("get", ["websites", websiteId, "event-data", "fields"], parameters);
|
|
23
23
|
}
|
|
24
24
|
Events.get_WEBSITEID_EventdataFields = get_WEBSITEID_EventdataFields;
|
|
25
|
-
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties
|
|
25
|
+
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties */
|
|
26
26
|
async function get_WEBSITEID_EventdataProperties(websiteId, parameters) {
|
|
27
27
|
return await this.request("get", ["websites", websiteId, "event-data", "properties"], parameters);
|
|
28
28
|
}
|
|
29
29
|
Events.get_WEBSITEID_EventdataProperties = get_WEBSITEID_EventdataProperties;
|
|
30
|
-
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues
|
|
30
|
+
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues */
|
|
31
31
|
async function get_WEBSITEID_EventdataValues(websiteId, parameters) {
|
|
32
32
|
return await this.request("get", ["websites", websiteId, "event-data", "values"], parameters);
|
|
33
33
|
}
|
|
34
34
|
Events.get_WEBSITEID_EventdataValues = get_WEBSITEID_EventdataValues;
|
|
35
|
-
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats
|
|
35
|
+
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats */
|
|
36
36
|
async function get_WEBSITEID_EventdataStats(websiteId, parameters) {
|
|
37
37
|
return await this.request("get", ["websites", websiteId, "event-data", "stats"], parameters);
|
|
38
38
|
}
|
|
@@ -15,11 +15,11 @@ export declare namespace Links {
|
|
|
15
15
|
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid (TODO UNTESTED) */
|
|
16
16
|
function post_LINKID(this: API, linkId: Link["id"], parameters: {
|
|
17
17
|
/** The link's name */
|
|
18
|
-
name?:
|
|
18
|
+
name?: Link["name"];
|
|
19
19
|
/** The link's destination URL */
|
|
20
|
-
url?:
|
|
20
|
+
url?: Link["url"];
|
|
21
21
|
/** The link's URL slug, **with a minimum of 8 characters** */
|
|
22
|
-
slug?:
|
|
22
|
+
slug?: Link["slug"];
|
|
23
23
|
}): Promise<Link>;
|
|
24
24
|
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid (TODO UNTESTED) */
|
|
25
25
|
function delete_LINKID(this: API, linkId: Link["id"]): Promise<DeletionResult>;
|
package/dist/namespaces/Me.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API,
|
|
1
|
+
import { API, Teams, Users, Websites } from "../index.js";
|
|
2
2
|
/** All information about your session: https://umami.is/docs/api/me */
|
|
3
3
|
export declare namespace Me {
|
|
4
4
|
/** Get information based on your auth token: https://umami.is/docs/api/me#get-apime */
|
|
@@ -9,30 +9,7 @@ export declare namespace Me {
|
|
|
9
9
|
user: Users.User;
|
|
10
10
|
}>;
|
|
11
11
|
/** Get all your teams: https://umami.is/docs/api/me#get-apimeteams */
|
|
12
|
-
function getTeams(this: API): Promise<
|
|
13
|
-
name: string;
|
|
14
|
-
accessCode: string;
|
|
15
|
-
logoUrl: string | null;
|
|
16
|
-
members: (Omit<GenericObject, "deletedAt"> & {
|
|
17
|
-
teamId: string;
|
|
18
|
-
userId: Users.User["id"];
|
|
19
|
-
role: TeamRole;
|
|
20
|
-
user: Users.MinimalUser;
|
|
21
|
-
})[];
|
|
22
|
-
_count: {
|
|
23
|
-
websites: number;
|
|
24
|
-
members: number;
|
|
25
|
-
};
|
|
26
|
-
})[]>;
|
|
12
|
+
function getTeams(this: API): Promise<Teams.TeamWithMembersCount[]>;
|
|
27
13
|
/** Get all your websites: https://umami.is/docs/api/me#get-apimeteams */
|
|
28
|
-
function getWebsites(this: API): Promise<
|
|
29
|
-
name: string;
|
|
30
|
-
domain: string;
|
|
31
|
-
shareId: string | null;
|
|
32
|
-
resetAt: Date | null;
|
|
33
|
-
userId: Users.User["id"];
|
|
34
|
-
teamId: string | null;
|
|
35
|
-
createdBy: string;
|
|
36
|
-
user: Users.MinimalUser;
|
|
37
|
-
})[]>;
|
|
14
|
+
function getWebsites(this: API): Promise<Websites.WebsiteWithUser[]>;
|
|
38
15
|
}
|
|
@@ -14,9 +14,9 @@ export declare namespace Pixels {
|
|
|
14
14
|
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid (TODO UNTESTED) */
|
|
15
15
|
function post_PIXELID(this: API, pixelId: Pixel["id"], parameters: {
|
|
16
16
|
/** The pixel's name */
|
|
17
|
-
name?:
|
|
17
|
+
name?: Pixel["name"];
|
|
18
18
|
/** The pixel's URL slug, **with a minimum of 8 characters** */
|
|
19
|
-
slug?:
|
|
19
|
+
slug?: Pixel["slug"];
|
|
20
20
|
}): Promise<Pixel>;
|
|
21
21
|
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid (TODO UNTESTED) */
|
|
22
22
|
function delete_PIXELID(this: API, pixelId: Pixel["id"]): Promise<DeletionResult>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { API } from "../index.js";
|
|
1
|
+
import { API, Sessions, Websites } from "../index.js";
|
|
2
2
|
/** Realtime data for your website: https://umami.is/docs/api/realtime */
|
|
3
3
|
export declare namespace Realtime {
|
|
4
4
|
/** Realtime stats within the last 30 minutes: https://umami.is/docs/api/realtime#get-apirealtimewebsiteid (TODO UNTESTED) */
|
|
5
|
-
function get_WEBSITEID(this: API, websiteId:
|
|
5
|
+
function get_WEBSITEID(this: API, websiteId: Websites.Website["id"]): Promise<{
|
|
6
6
|
countries: {
|
|
7
7
|
[k: string]: number;
|
|
8
8
|
};
|
|
@@ -14,7 +14,7 @@ export declare namespace Realtime {
|
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
16
16
|
__type: string;
|
|
17
|
-
sessionId:
|
|
17
|
+
sessionId: Sessions.Session["id"];
|
|
18
18
|
eventName: string;
|
|
19
19
|
createdAt: Date;
|
|
20
20
|
browser: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API, DeletionResult, Filters, GenericRequestParameters, NameValue, Report, Timestamps, XTY } from "../index.js";
|
|
1
|
+
import { API, DeletionResult, Filters, GenericRequestParameters, NameValue, Report, Timestamps, Websites, XTY } from "../index.js";
|
|
2
2
|
/** Using reports throught the api: https://umami.is/docs/api/reports */
|
|
3
3
|
export declare namespace Reports {
|
|
4
4
|
type ReportType = {
|
|
@@ -9,9 +9,9 @@ export declare namespace Reports {
|
|
|
9
9
|
views: number;
|
|
10
10
|
}
|
|
11
11
|
/** Get all reports by website ID: https://umami.is/docs/api/reports#get-apireports (TODO UNTESTED) */
|
|
12
|
-
function get(this: API, websiteId:
|
|
12
|
+
function get(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Omit<GenericRequestParameters, "search">): Promise<Report[]>;
|
|
13
13
|
/** Creates a report: https://umami.is/docs/api/reports#post-apireports (TODO UNTESTED) */
|
|
14
|
-
function post(this: API, websiteId:
|
|
14
|
+
function post(this: API, websiteId: Websites.Website["id"], parameters: ReportType & {
|
|
15
15
|
/** Name of report */
|
|
16
16
|
name: string;
|
|
17
17
|
/** Description of report */
|
|
@@ -22,7 +22,7 @@ export declare namespace Reports {
|
|
|
22
22
|
/** Gets a report by ID: https://umami.is/docs/api/reports#get-apireportsreportid (TODO UNTESTED) */
|
|
23
23
|
function get_REPORTID(this: API, reportId: string): Promise<Report>;
|
|
24
24
|
/** Updates a report: https://umami.is/docs/api/reports#post-apireportsreportid (TODO UNTESTED) */
|
|
25
|
-
function post_REPORTID(this: API, reportId: string, websiteId:
|
|
25
|
+
function post_REPORTID(this: API, reportId: string, websiteId: Websites.Website["id"], parameters: ReportType & {
|
|
26
26
|
/** Name of report */
|
|
27
27
|
name: string;
|
|
28
28
|
/** Description of report */
|
|
@@ -33,7 +33,7 @@ export declare namespace Reports {
|
|
|
33
33
|
/** Deletes a report: https://umami.is/docs/api/reports#delete-apireportsreportid (TODO UNTESTED) */
|
|
34
34
|
function delete_REPORTID(this: API, reportId: string): Promise<DeletionResult>;
|
|
35
35
|
/** See how users engage with your marketing and what drives conversions: https://umami.is/docs/api/reports#post-apireportsattribution (TODO UNTESTED) */
|
|
36
|
-
function postAttribution(this: API, websiteId:
|
|
36
|
+
function postAttribution(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
37
37
|
/** Attribution model */
|
|
38
38
|
model: "firstClick" | "lastClick";
|
|
39
39
|
/** Conversion type */
|
|
@@ -55,7 +55,7 @@ export declare namespace Reports {
|
|
|
55
55
|
};
|
|
56
56
|
}>;
|
|
57
57
|
/** Dive deeper into your data by using segments and filters: https://umami.is/docs/api/reports#post-apireportsbreakdown (TODO UNTESTED) */
|
|
58
|
-
function postBreakdown(this: API, websiteId:
|
|
58
|
+
function postBreakdown(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
59
59
|
fields: ("path" | "title" | "query" | "referrer" | "browser" | "os" | "device" | "country" | "region" | "city" | "hostname" | "tag" | "event")[];
|
|
60
60
|
}): Promise<{
|
|
61
61
|
views: number;
|
|
@@ -67,7 +67,7 @@ export declare namespace Reports {
|
|
|
67
67
|
country: string;
|
|
68
68
|
}[]>;
|
|
69
69
|
/** Understand the conversion and drop-off rate of users: https://umami.is/docs/api/reports#post-apireportsfunnel (TODO UNTESTED) */
|
|
70
|
-
function postFunnel(this: API, websiteId:
|
|
70
|
+
function postFunnel(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
71
71
|
/** Type of event and conversion step */
|
|
72
72
|
steps: {
|
|
73
73
|
type: "path" | "event";
|
|
@@ -85,7 +85,7 @@ export declare namespace Reports {
|
|
|
85
85
|
remaining: number;
|
|
86
86
|
}[]>;
|
|
87
87
|
/** Track your goals for pageviews and events: https://umami.is/docs/api/reports#post-apireportsgoals (TODO UNTESTED) */
|
|
88
|
-
function postGoals(this: API, websiteId:
|
|
88
|
+
function postGoals(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
89
89
|
/** Conversion type */
|
|
90
90
|
type: ("path" | "event")[];
|
|
91
91
|
/** Conversion step value */
|
|
@@ -95,7 +95,7 @@ export declare namespace Reports {
|
|
|
95
95
|
total: number;
|
|
96
96
|
}>;
|
|
97
97
|
/** Understand how users nagivate through your website: https://umami.is/docs/api/reports#post-apireportsjourney (TODO UNTESTED) */
|
|
98
|
-
function postJourney(this: API, websiteId:
|
|
98
|
+
function postJourney(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
99
99
|
/** Number of steps from 3 to 7 */
|
|
100
100
|
steps: number;
|
|
101
101
|
/** Starting step URL or event name */
|
|
@@ -107,7 +107,7 @@ export declare namespace Reports {
|
|
|
107
107
|
count: number;
|
|
108
108
|
}[]>;
|
|
109
109
|
/** Measure your website stickiness by tracking how often users return: https://umami.is/docs/api/reports#post-apireportsretention (TODO UNTESTED) */
|
|
110
|
-
function postRetention(this: API, websiteId:
|
|
110
|
+
function postRetention(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
111
111
|
/** Timezone (ex. America/Los_Angeles) */
|
|
112
112
|
timezone: string;
|
|
113
113
|
}): Promise<{
|
|
@@ -118,7 +118,7 @@ export declare namespace Reports {
|
|
|
118
118
|
percentage: number;
|
|
119
119
|
}[]>;
|
|
120
120
|
/** Get currency for given range. Needed for Revenue and optional in Attribution reports: https://umami.is/docs/api/reports#post-apireportsrevenue (TODO UNTESTED) */
|
|
121
|
-
function postRevenue(this: API, websiteId:
|
|
121
|
+
function postRevenue(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps & {
|
|
122
122
|
/** Timezone (ex. America/Los_Angeles) */
|
|
123
123
|
timezone: string;
|
|
124
124
|
/** Currency code (ISO 4217) */
|
|
@@ -134,7 +134,7 @@ export declare namespace Reports {
|
|
|
134
134
|
};
|
|
135
135
|
}>;
|
|
136
136
|
/** Track your campaigns through UTM parameters: https://umami.is/docs/api/reports#post-apireportsutm (TODO UNTESTED) */
|
|
137
|
-
function postUTM(this: API, websiteId:
|
|
137
|
+
function postUTM(this: API, websiteId: Websites.Website["id"], parameters: ReportType & Filters & Timestamps): Promise<{
|
|
138
138
|
utm_source: UTM[];
|
|
139
139
|
utm_medium: UTM[];
|
|
140
140
|
utm_campaign: UTM[];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { API, Filters, GenericRequestParameters, Timestamps } from "../index.js";
|
|
1
|
+
import { API, Events, Filters, GenericRequestParameters, Timestamps, Websites } from "../index.js";
|
|
2
2
|
/** Operations around Sessions and Session data: https://umami.is/docs/api/sessions */
|
|
3
3
|
export declare namespace Sessions {
|
|
4
|
-
interface
|
|
4
|
+
interface Session {
|
|
5
5
|
id: string;
|
|
6
|
-
websiteId:
|
|
7
|
-
browser: string;
|
|
8
|
-
os: string;
|
|
6
|
+
websiteId: Websites.Website["id"];
|
|
7
|
+
browser: string | null;
|
|
8
|
+
os: string | null;
|
|
9
9
|
device: string;
|
|
10
10
|
screen: string;
|
|
11
|
-
language: string;
|
|
11
|
+
language: string | null;
|
|
12
12
|
country: string;
|
|
13
13
|
region: string;
|
|
14
14
|
city: string;
|
|
@@ -17,13 +17,19 @@ export declare namespace Sessions {
|
|
|
17
17
|
visits: number;
|
|
18
18
|
views: number;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
function get_WEBSITEID_Sessions(this: API, websiteId: string, parameters: Filters & Timestamps & GenericRequestParameters): Promise<(GenericSession & {
|
|
20
|
+
interface SessionWithHostnameCreatedat extends Session {
|
|
22
21
|
hostname: string;
|
|
23
22
|
createdAt: Date;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
}
|
|
24
|
+
interface SessionWithDistinctidEventsTotaltime extends Session {
|
|
25
|
+
distinctId: string | null;
|
|
26
|
+
events: number;
|
|
27
|
+
totaltime: number;
|
|
28
|
+
}
|
|
29
|
+
/** Gets website session details within a given time range: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessions */
|
|
30
|
+
function get_WEBSITEID_Sessions(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & GenericRequestParameters): Promise<SessionWithHostnameCreatedat[]>;
|
|
31
|
+
/** Gets summarized website session statistics: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsstats */
|
|
32
|
+
function get_WEBSITEID_SessionsStats(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
27
33
|
/** Pages hits */
|
|
28
34
|
pageviews: {
|
|
29
35
|
value: number;
|
|
@@ -36,41 +42,51 @@ export declare namespace Sessions {
|
|
|
36
42
|
visits: {
|
|
37
43
|
value: number;
|
|
38
44
|
};
|
|
39
|
-
/**
|
|
40
|
-
|
|
45
|
+
/** @remarks Undocumented */
|
|
46
|
+
countries: {
|
|
47
|
+
value: number;
|
|
48
|
+
};
|
|
49
|
+
/** @remarks Undocumented */
|
|
50
|
+
events: {
|
|
41
51
|
value: number;
|
|
42
52
|
};
|
|
43
|
-
/**
|
|
44
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Number of visitors who only visit a single page
|
|
55
|
+
* @remarks While featured in the documentation, it doesn't seem to exist
|
|
56
|
+
*/
|
|
57
|
+
bounces?: {
|
|
58
|
+
value: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Time spent on the website
|
|
62
|
+
* @remarks While featured in the documentation, it doesn't seem to exist
|
|
63
|
+
*/
|
|
64
|
+
totaltime?: {
|
|
45
65
|
value: number;
|
|
46
66
|
};
|
|
47
67
|
}>;
|
|
48
|
-
/** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsweekly
|
|
49
|
-
function get_WEBSITEID_SessionsWeekly(this: API, websiteId:
|
|
68
|
+
/** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsweekly */
|
|
69
|
+
function get_WEBSITEID_SessionsWeekly(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
50
70
|
timezone: string;
|
|
51
71
|
}): Promise<number[][]>;
|
|
52
|
-
/** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid
|
|
53
|
-
function get_WEBSITEID_Sessions_SESSIONID(this: API, websiteId:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
totaltime: number;
|
|
57
|
-
}>;
|
|
58
|
-
/** Gets session activity for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidactivity (TODO UNTESTED) */
|
|
59
|
-
function get_WEBSITEID_Sessions_SESSIONID_Activity(this: API, websiteId: string, sessionId: string, parameters: Timestamps): Promise<{
|
|
72
|
+
/** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid */
|
|
73
|
+
function get_WEBSITEID_Sessions_SESSIONID(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"]): Promise<SessionWithDistinctidEventsTotaltime>;
|
|
74
|
+
/** Gets session activity for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidactivity */
|
|
75
|
+
function get_WEBSITEID_Sessions_SESSIONID_Activity(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"], parameters: Timestamps): Promise<{
|
|
60
76
|
createdAt: Date;
|
|
61
77
|
urlPath: string;
|
|
62
78
|
urlQuery: string;
|
|
63
|
-
referrerDomain: string;
|
|
64
|
-
eventId:
|
|
65
|
-
eventType:
|
|
66
|
-
eventName:
|
|
79
|
+
referrerDomain: string | null;
|
|
80
|
+
eventId: Events.Event["id"];
|
|
81
|
+
eventType: Events.Event["eventType"];
|
|
82
|
+
eventName: Events.Event["eventName"] | null;
|
|
67
83
|
visitId: string;
|
|
68
|
-
hasData:
|
|
84
|
+
hasData: boolean;
|
|
69
85
|
}[]>;
|
|
70
|
-
/** Gets session properties for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO
|
|
71
|
-
function get_WEBSITEID_Sessions_SESSIONID_Properties(this: API, websiteId:
|
|
72
|
-
websiteId:
|
|
73
|
-
|
|
86
|
+
/** Gets session properties for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO Server returns empty array) */
|
|
87
|
+
function get_WEBSITEID_Sessions_SESSIONID_Properties(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"]): Promise<{
|
|
88
|
+
websiteId: Websites.Website["id"];
|
|
89
|
+
sessionId: Session["id"];
|
|
74
90
|
dataKey: string;
|
|
75
91
|
dataType: number;
|
|
76
92
|
stringValue: string;
|
|
@@ -78,13 +94,13 @@ export declare namespace Sessions {
|
|
|
78
94
|
dateValue: Date | null;
|
|
79
95
|
createdAt: Date;
|
|
80
96
|
}[]>;
|
|
81
|
-
/** Gets session data counts by property name: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-dataproperties (TODO
|
|
82
|
-
function get_WEBSITEID_SessiondataProperties(this: API, websiteId:
|
|
97
|
+
/** Gets session data counts by property name: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-dataproperties (TODO Server returns empty array) */
|
|
98
|
+
function get_WEBSITEID_SessiondataProperties(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
83
99
|
propertyName: string;
|
|
84
100
|
total: number;
|
|
85
101
|
}[]>;
|
|
86
|
-
/** Gets session data counts for a given property: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-datavalues (TODO
|
|
87
|
-
function get_WEBSITEID_SessiondataValues(this: API, websiteId:
|
|
102
|
+
/** Gets session data counts for a given property: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-datavalues (TODO Server returns empty array) */
|
|
103
|
+
function get_WEBSITEID_SessiondataValues(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
88
104
|
propertyName: string;
|
|
89
105
|
}): Promise<{
|
|
90
106
|
value: string;
|
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
/** Operations around Sessions and Session data: https://umami.is/docs/api/sessions */
|
|
2
2
|
export var Sessions;
|
|
3
3
|
(function (Sessions) {
|
|
4
|
-
/** Gets website session details within a given time range: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessions
|
|
4
|
+
/** Gets website session details within a given time range: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessions */
|
|
5
5
|
async function get_WEBSITEID_Sessions(websiteId, parameters) {
|
|
6
6
|
const response = await this.request("get", ["websites", websiteId, "sessions"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
9
|
Sessions.get_WEBSITEID_Sessions = get_WEBSITEID_Sessions;
|
|
10
|
-
/** Gets summarized website session statistics: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsstats
|
|
10
|
+
/** Gets summarized website session statistics: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsstats */
|
|
11
11
|
async function get_WEBSITEID_SessionsStats(websiteId, parameters) {
|
|
12
|
-
|
|
12
|
+
const response = await this.request("get", ["websites", websiteId, "sessions", "stats"], parameters);
|
|
13
|
+
Object.values(response).forEach((v) => { v.value = Number(v.value); });
|
|
14
|
+
return response;
|
|
13
15
|
}
|
|
14
16
|
Sessions.get_WEBSITEID_SessionsStats = get_WEBSITEID_SessionsStats;
|
|
15
|
-
/** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsweekly
|
|
17
|
+
/** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsweekly */
|
|
16
18
|
async function get_WEBSITEID_SessionsWeekly(websiteId, parameters) {
|
|
17
19
|
return await this.request("get", ["websites", websiteId, "sessions", "weekly"], parameters);
|
|
18
20
|
}
|
|
19
21
|
Sessions.get_WEBSITEID_SessionsWeekly = get_WEBSITEID_SessionsWeekly;
|
|
20
|
-
/** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid
|
|
22
|
+
/** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid */
|
|
21
23
|
async function get_WEBSITEID_Sessions_SESSIONID(websiteId, sessionId) {
|
|
22
24
|
return await this.request("get", ["websites", websiteId, "sessions", sessionId]);
|
|
23
25
|
}
|
|
24
26
|
Sessions.get_WEBSITEID_Sessions_SESSIONID = get_WEBSITEID_Sessions_SESSIONID;
|
|
25
|
-
/** Gets session activity for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidactivity
|
|
27
|
+
/** Gets session activity for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidactivity */
|
|
26
28
|
async function get_WEBSITEID_Sessions_SESSIONID_Activity(websiteId, sessionId, parameters) {
|
|
27
29
|
return await this.request("get", ["websites", websiteId, "sessions", sessionId, "activity"], parameters);
|
|
28
30
|
}
|
|
29
31
|
Sessions.get_WEBSITEID_Sessions_SESSIONID_Activity = get_WEBSITEID_Sessions_SESSIONID_Activity;
|
|
30
|
-
/** Gets session properties for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO
|
|
32
|
+
/** Gets session properties for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO Server returns empty array) */
|
|
31
33
|
async function get_WEBSITEID_Sessions_SESSIONID_Properties(websiteId, sessionId) {
|
|
32
|
-
return await this.request("get", ["websites", websiteId, "sessions", sessionId, "
|
|
34
|
+
return await this.request("get", ["websites", websiteId, "sessions", sessionId, "properties"]);
|
|
33
35
|
}
|
|
34
36
|
Sessions.get_WEBSITEID_Sessions_SESSIONID_Properties = get_WEBSITEID_Sessions_SESSIONID_Properties;
|
|
35
|
-
/** Gets session data counts by property name: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-dataproperties (TODO
|
|
37
|
+
/** Gets session data counts by property name: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-dataproperties (TODO Server returns empty array) */
|
|
36
38
|
async function get_WEBSITEID_SessiondataProperties(websiteId, parameters) {
|
|
37
39
|
return await this.request("get", ["websites", websiteId, "session-data", "properties"], parameters);
|
|
38
40
|
}
|
|
39
41
|
Sessions.get_WEBSITEID_SessiondataProperties = get_WEBSITEID_SessiondataProperties;
|
|
40
|
-
/** Gets session data counts for a given property: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-datavalues (TODO
|
|
42
|
+
/** Gets session data counts for a given property: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-datavalues (TODO Server returns empty array) */
|
|
41
43
|
async function get_WEBSITEID_SessiondataValues(websiteId, parameters) {
|
|
42
44
|
return await this.request("get", ["websites", websiteId, "session-data", "values"], parameters);
|
|
43
45
|
}
|
|
@@ -1,72 +1,71 @@
|
|
|
1
|
-
import { API, DeletionResult,
|
|
1
|
+
import { API, DeletionResult, GenericRequestParameters, Users, Websites } from "../index.js";
|
|
2
2
|
/** Operations around Team management: https://umami.is/docs/api/teams */
|
|
3
3
|
export declare namespace Teams {
|
|
4
|
-
interface
|
|
4
|
+
interface Team {
|
|
5
|
+
id: string;
|
|
5
6
|
name: string;
|
|
6
7
|
accessCode: string;
|
|
7
8
|
logoUrl: string | null;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
deletedAt: Date | null;
|
|
8
12
|
}
|
|
9
|
-
interface TeamMember
|
|
10
|
-
|
|
13
|
+
interface TeamMember {
|
|
14
|
+
id: string;
|
|
15
|
+
teamId: Team["id"];
|
|
11
16
|
userId: Users.User["id"];
|
|
12
17
|
role: TeamRole;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
}
|
|
21
|
+
interface TeamMemberWithUser extends TeamMember {
|
|
22
|
+
user: Users.MinimalUser;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
interface TeamWithMembers extends Team {
|
|
25
|
+
members: TeamMemberWithUser[];
|
|
26
|
+
}
|
|
27
|
+
interface TeamWithMembersCount extends TeamWithMembers {
|
|
21
28
|
_count: {
|
|
22
29
|
websites: number;
|
|
23
30
|
members: number;
|
|
24
31
|
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
function
|
|
32
|
+
}
|
|
33
|
+
type TeamRole = "team-owner" | "team-manager" | "team-member" | "team-view-only";
|
|
34
|
+
/** Returns all teams: https://umami.is/docs/api/teams#get-apiteams */
|
|
35
|
+
function get(this: API, parameters?: Omit<GenericRequestParameters, "search">): Promise<TeamWithMembersCount[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a team: https://umami.is/docs/api/teams#post-apiteams
|
|
38
|
+
* @returns An Array where its first element is the created team, and its second element is its owner
|
|
39
|
+
*/
|
|
40
|
+
function post(this: API, name: Team["name"]): Promise<[Team, TeamMember]>;
|
|
41
|
+
/** Join a team: https://umami.is/docs/api/teams#post-apiteamsjoin */
|
|
42
|
+
function postJoin(this: API, accessCode: Team["accessCode"]): Promise<TeamMember>;
|
|
43
|
+
/** Get a team: https://umami.is/docs/api/teams#get-apiteamsteamid */
|
|
44
|
+
function get_TEAMID(this: API, teamId: Team["id"]): Promise<TeamWithMembers>;
|
|
45
|
+
/** Update a team: https://umami.is/docs/api/teams#post-apiteamsteamid */
|
|
46
|
+
function post_TEAMID(this: API, teamId: Team["id"], parameters: {
|
|
36
47
|
/** The team's name */
|
|
37
|
-
name?:
|
|
48
|
+
name?: Team["name"];
|
|
38
49
|
/** The team's access code */
|
|
39
|
-
accessCode?:
|
|
40
|
-
}): Promise<
|
|
41
|
-
/** Delete a team: https://umami.is/docs/api/teams#delete-apiteamsteamid
|
|
42
|
-
function delete_TEAMID(this: API, teamId:
|
|
43
|
-
/** Get all users that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusers
|
|
44
|
-
function get_TEAMID_Users(this: API, teamId:
|
|
45
|
-
/** Add a user to a team: https://umami.is/docs/api/teams#post-apiteamsteamidusers
|
|
46
|
-
function post_TEAMID_Users(this: API, teamId:
|
|
50
|
+
accessCode?: Team["accessCode"];
|
|
51
|
+
}): Promise<Team>;
|
|
52
|
+
/** Delete a team: https://umami.is/docs/api/teams#delete-apiteamsteamid */
|
|
53
|
+
function delete_TEAMID(this: API, teamId: Team["id"]): Promise<DeletionResult>;
|
|
54
|
+
/** Get all users that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusers */
|
|
55
|
+
function get_TEAMID_Users(this: API, teamId: Team["id"], parameters?: GenericRequestParameters): Promise<TeamMemberWithUser[]>;
|
|
56
|
+
/** Add a user to a team: https://umami.is/docs/api/teams#post-apiteamsteamidusers */
|
|
57
|
+
function post_TEAMID_Users(this: API, teamId: Team["id"], parameters: {
|
|
47
58
|
/** ID of user to be added */
|
|
48
59
|
userId: Users.User["id"];
|
|
49
60
|
/** Team role for user */
|
|
50
|
-
role: TeamRole
|
|
51
|
-
}): Promise<
|
|
52
|
-
/** Get a user belonging to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusersuserid
|
|
53
|
-
function get_TEAMID_Users_USERID(this: API, teamId:
|
|
54
|
-
/** Update a user's role on a team: https://umami.is/docs/api/teams#post-apiteamsteamidusersuserid
|
|
55
|
-
function post_TEAMID_Users_USERID(this: API, teamId:
|
|
56
|
-
/** Remove a user from a team: https://umami.is/docs/api/teams#delete-apiteamsteamidusersuserid
|
|
57
|
-
function delete_TEAMID_Users_USERID(this: API, teamId:
|
|
58
|
-
/** Get all websites that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidwebsites
|
|
59
|
-
function get_TEAMID_Websites(this: API, teamId:
|
|
60
|
-
name: string;
|
|
61
|
-
domain: string;
|
|
62
|
-
shareId: string;
|
|
63
|
-
resetAt: Date | null;
|
|
64
|
-
userId: Users.User["id"] | null;
|
|
65
|
-
teamId: string | null;
|
|
66
|
-
createdBy: string;
|
|
67
|
-
createUser: {
|
|
68
|
-
id: string;
|
|
69
|
-
username: string;
|
|
70
|
-
};
|
|
71
|
-
})[]>;
|
|
61
|
+
role: Exclude<TeamRole, "team-owner">;
|
|
62
|
+
}): Promise<TeamMember>;
|
|
63
|
+
/** Get a user belonging to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusersuserid */
|
|
64
|
+
function get_TEAMID_Users_USERID(this: API, teamId: Team["id"], userId: Users.User["id"]): Promise<TeamMember>;
|
|
65
|
+
/** Update a user's role on a team: https://umami.is/docs/api/teams#post-apiteamsteamidusersuserid */
|
|
66
|
+
function post_TEAMID_Users_USERID(this: API, teamId: Team["id"], userId: Users.User["id"], role: Exclude<TeamRole, "team-owner">): Promise<TeamMember>;
|
|
67
|
+
/** Remove a user from a team: https://umami.is/docs/api/teams#delete-apiteamsteamidusersuserid */
|
|
68
|
+
function delete_TEAMID_Users_USERID(this: API, teamId: Team["id"], userId: Users.User["id"]): Promise<DeletionResult>;
|
|
69
|
+
/** Get all websites that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidwebsites */
|
|
70
|
+
function get_TEAMID_Websites(this: API, teamId: Team["id"], parameters?: GenericRequestParameters): Promise<Websites.WebsiteWithCreateuser[]>;
|
|
72
71
|
}
|
package/dist/namespaces/Teams.js
CHANGED
|
@@ -1,64 +1,67 @@
|
|
|
1
1
|
/** Operations around Team management: https://umami.is/docs/api/teams */
|
|
2
2
|
export var Teams;
|
|
3
3
|
(function (Teams) {
|
|
4
|
-
/** Returns all teams: https://umami.is/docs/api/teams#get-apiteams
|
|
4
|
+
/** Returns all teams: https://umami.is/docs/api/teams#get-apiteams */
|
|
5
5
|
async function get(parameters) {
|
|
6
6
|
const response = await this.request("get", ["teams"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
9
|
Teams.get = get;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Creates a team: https://umami.is/docs/api/teams#post-apiteams
|
|
12
|
+
* @returns An Array where its first element is the created team, and its second element is its owner
|
|
13
|
+
*/
|
|
11
14
|
async function post(name) {
|
|
12
15
|
return await this.request("post", ["teams"], { name });
|
|
13
16
|
}
|
|
14
17
|
Teams.post = post;
|
|
15
|
-
/** Join a team: https://umami.is/docs/api/teams#post-apiteamsjoin
|
|
18
|
+
/** Join a team: https://umami.is/docs/api/teams#post-apiteamsjoin */
|
|
16
19
|
async function postJoin(accessCode) {
|
|
17
20
|
return await this.request("post", ["teams", "join"], { accessCode });
|
|
18
21
|
}
|
|
19
22
|
Teams.postJoin = postJoin;
|
|
20
|
-
/** Get a team: https://umami.is/docs/api/teams#get-apiteamsteamid
|
|
23
|
+
/** Get a team: https://umami.is/docs/api/teams#get-apiteamsteamid */
|
|
21
24
|
async function get_TEAMID(teamId) {
|
|
22
25
|
return await this.request("get", ["teams", teamId]);
|
|
23
26
|
}
|
|
24
27
|
Teams.get_TEAMID = get_TEAMID;
|
|
25
|
-
/** Update a team: https://umami.is/docs/api/teams#post-apiteamsteamid
|
|
28
|
+
/** Update a team: https://umami.is/docs/api/teams#post-apiteamsteamid */
|
|
26
29
|
async function post_TEAMID(teamId, parameters) {
|
|
27
30
|
return await this.request("post", ["teams", teamId], parameters);
|
|
28
31
|
}
|
|
29
32
|
Teams.post_TEAMID = post_TEAMID;
|
|
30
|
-
/** Delete a team: https://umami.is/docs/api/teams#delete-apiteamsteamid
|
|
33
|
+
/** Delete a team: https://umami.is/docs/api/teams#delete-apiteamsteamid */
|
|
31
34
|
async function delete_TEAMID(teamId) {
|
|
32
35
|
return await this.request("delete", ["teams", teamId]);
|
|
33
36
|
}
|
|
34
37
|
Teams.delete_TEAMID = delete_TEAMID;
|
|
35
|
-
/** Get all users that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusers
|
|
38
|
+
/** Get all users that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusers */
|
|
36
39
|
async function get_TEAMID_Users(teamId, parameters) {
|
|
37
40
|
const response = await this.request("get", ["teams", teamId, "users"], parameters);
|
|
38
41
|
return response.data;
|
|
39
42
|
}
|
|
40
43
|
Teams.get_TEAMID_Users = get_TEAMID_Users;
|
|
41
|
-
/** Add a user to a team: https://umami.is/docs/api/teams#post-apiteamsteamidusers
|
|
44
|
+
/** Add a user to a team: https://umami.is/docs/api/teams#post-apiteamsteamidusers */
|
|
42
45
|
async function post_TEAMID_Users(teamId, parameters) {
|
|
43
46
|
return await this.request("post", ["teams", teamId, "users"], parameters);
|
|
44
47
|
}
|
|
45
48
|
Teams.post_TEAMID_Users = post_TEAMID_Users;
|
|
46
|
-
/** Get a user belonging to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusersuserid
|
|
49
|
+
/** Get a user belonging to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusersuserid */
|
|
47
50
|
async function get_TEAMID_Users_USERID(teamId, userId) {
|
|
48
51
|
return await this.request("get", ["teams", teamId, "users", userId]);
|
|
49
52
|
}
|
|
50
53
|
Teams.get_TEAMID_Users_USERID = get_TEAMID_Users_USERID;
|
|
51
|
-
/** Update a user's role on a team: https://umami.is/docs/api/teams#post-apiteamsteamidusersuserid
|
|
54
|
+
/** Update a user's role on a team: https://umami.is/docs/api/teams#post-apiteamsteamidusersuserid */
|
|
52
55
|
async function post_TEAMID_Users_USERID(teamId, userId, role) {
|
|
53
56
|
return await this.request("post", ["teams", teamId, "users", userId], { role });
|
|
54
57
|
}
|
|
55
58
|
Teams.post_TEAMID_Users_USERID = post_TEAMID_Users_USERID;
|
|
56
|
-
/** Remove a user from a team: https://umami.is/docs/api/teams#delete-apiteamsteamidusersuserid
|
|
59
|
+
/** Remove a user from a team: https://umami.is/docs/api/teams#delete-apiteamsteamidusersuserid */
|
|
57
60
|
async function delete_TEAMID_Users_USERID(teamId, userId) {
|
|
58
61
|
return await this.request("delete", ["teams", teamId, "users", userId]);
|
|
59
62
|
}
|
|
60
63
|
Teams.delete_TEAMID_Users_USERID = delete_TEAMID_Users_USERID;
|
|
61
|
-
/** Get all websites that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidwebsites
|
|
64
|
+
/** Get all websites that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidwebsites */
|
|
62
65
|
async function get_TEAMID_Websites(teamId, parameters) {
|
|
63
66
|
const response = await this.request("get", ["teams", teamId, "websites"], parameters);
|
|
64
67
|
return response.data;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API, DeletionResult,
|
|
1
|
+
import { API, DeletionResult, GenericRequestParameters, Teams, Websites } from "../index.js";
|
|
2
2
|
/** Operations around User management: https://umami.is/docs/api/users */
|
|
3
3
|
export declare namespace Users {
|
|
4
4
|
type Role = "admin" | "user" | "view-only";
|
|
@@ -44,23 +44,7 @@ export declare namespace Users {
|
|
|
44
44
|
/** Gets all websites that belong to a user: https://umami.is/docs/api/users#get-apiusersuseridwebsites */
|
|
45
45
|
function get_USERID_Websites(this: API, userId: User["id"], parameters?: GenericRequestParameters & {
|
|
46
46
|
includeTeams?: boolean;
|
|
47
|
-
}): Promise<
|
|
48
|
-
user: MinimalUser;
|
|
49
|
-
})[]>;
|
|
47
|
+
}): Promise<Websites.WebsiteWithUser[]>;
|
|
50
48
|
/** Gets all teams that belong to a user: https://umami.is/docs/api/users#get-apiusersuseridteams */
|
|
51
|
-
function get_USERID_Teams(this: API, userId: User["id"], parameters?: Omit<GenericRequestParameters, "search">): Promise<
|
|
52
|
-
name: string;
|
|
53
|
-
accessCode: string;
|
|
54
|
-
logoUrl: string | null;
|
|
55
|
-
members: Omit<GenericObject, "deletedAt"> & {
|
|
56
|
-
teamId: string;
|
|
57
|
-
userId: User["id"];
|
|
58
|
-
role: TeamRole;
|
|
59
|
-
user: MinimalUser;
|
|
60
|
-
}[];
|
|
61
|
-
_count: {
|
|
62
|
-
websites: number;
|
|
63
|
-
members: number;
|
|
64
|
-
};
|
|
65
|
-
})[]>;
|
|
49
|
+
function get_USERID_Teams(this: API, userId: User["id"], parameters?: Omit<GenericRequestParameters, "search">): Promise<Teams.TeamWithMembersCount[]>;
|
|
66
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API, Filters, Timestamps, XTY } from "../index.js";
|
|
1
|
+
import { API, Filters, Timestamps, Websites, XTY } from "../index.js";
|
|
2
2
|
/** Operations around Website statistics: https://umami.is/docs/api/website-stats */
|
|
3
3
|
export declare namespace WebsiteStats {
|
|
4
4
|
/**
|
|
@@ -31,16 +31,16 @@ export declare namespace WebsiteStats {
|
|
|
31
31
|
}
|
|
32
32
|
type MetricsTypes = "path" | "entry" | "exit" | "title" | "query" | "referrer" | "channel" | "domain" | "country" | "region" | "city" | "browser" | "os" | "device" | "language" | "screen" | "event" | "hostname" | "tag";
|
|
33
33
|
/** Gets the number of active users on a website: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidactive (TODO UNTESTED) */
|
|
34
|
-
function get_WEBSITEID_Active(this: API, websiteId:
|
|
34
|
+
function get_WEBSITEID_Active(this: API, websiteId: Websites.Website["id"]): Promise<{
|
|
35
35
|
visitors: number;
|
|
36
36
|
}>;
|
|
37
37
|
/** Gets events within a given time range: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteideventsseries (TODO UNTESTED) */
|
|
38
|
-
function get_WEBSITEID_EventsSeries(this: API, websiteId:
|
|
38
|
+
function get_WEBSITEID_EventsSeries(this: API, websiteId: Websites.Website["id"], parameters: Timestamps & Units & Filters & {
|
|
39
39
|
/** Timezone (ex. America/Los_Angeles) */
|
|
40
40
|
timezone: string;
|
|
41
41
|
}): Promise<XTY[]>;
|
|
42
42
|
/** Gets metrics for a given time range: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidmetrics (TODO UNTESTED) */
|
|
43
|
-
function get_WEBSITEID_Metrics(this: API, websiteId:
|
|
43
|
+
function get_WEBSITEID_Metrics(this: API, websiteId: Websites.Website["id"], parameters: Timestamps & Units & Filters & {
|
|
44
44
|
/** Timezone (ex. America/Los_Angeles) */
|
|
45
45
|
timezone: string;
|
|
46
46
|
/** Metrics type */
|
|
@@ -61,7 +61,7 @@ export declare namespace WebsiteStats {
|
|
|
61
61
|
name: string;
|
|
62
62
|
})[]>;
|
|
63
63
|
/** Gets pageviews within a given time range: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidpageviews (TODO UNTESTED) */
|
|
64
|
-
function get_WEBSITEID_Pageviews(this: API, websiteId:
|
|
64
|
+
function get_WEBSITEID_Pageviews(this: API, websiteId: Websites.Website["id"], parameters: Timestamps & Units & Filters & {
|
|
65
65
|
/** Timezone (ex. America/Los_Angeles) */
|
|
66
66
|
timezone: string;
|
|
67
67
|
/** Comparison value `prev` | `yoy` */
|
|
@@ -81,7 +81,7 @@ export declare namespace WebsiteStats {
|
|
|
81
81
|
}[];
|
|
82
82
|
}>;
|
|
83
83
|
/** Gets summarized website statistics: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidstats (TODO UNTESTED) */
|
|
84
|
-
function get_WEBSITEID_Stats(this: API, websiteId:
|
|
84
|
+
function get_WEBSITEID_Stats(this: API, websiteId: Websites.Website["id"], parameters: Timestamps & Filters & Units & {
|
|
85
85
|
/** Timezone (ex. America/Los_Angeles) */
|
|
86
86
|
timezone: string;
|
|
87
87
|
}): Promise<Stats & {
|
|
@@ -1,39 +1,57 @@
|
|
|
1
|
-
import { API, DeletionResult, GenericRequestParameters,
|
|
1
|
+
import { API, DeletionResult, GenericRequestParameters, Teams, Users } from "../index.js";
|
|
2
2
|
/** Operations around Website management and statistics: https://umami.is/docs/api/websites */
|
|
3
3
|
export declare namespace Websites {
|
|
4
|
+
interface Website {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
domain: string;
|
|
8
|
+
shareId: string | null;
|
|
9
|
+
resetAt: Date | null;
|
|
10
|
+
/** @remarks Is null if the website is under a team (has a `teamId`) */
|
|
11
|
+
userId: Users.User["id"] | null;
|
|
12
|
+
teamId: Teams.Team["id"] | null;
|
|
13
|
+
createdBy: Users.User["id"];
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date | null;
|
|
16
|
+
deletedAt: Date | null;
|
|
17
|
+
}
|
|
18
|
+
interface WebsiteWithCreateuser extends Website {
|
|
19
|
+
createUser: Users.MinimalUser;
|
|
20
|
+
}
|
|
21
|
+
interface WebsiteWithUser extends Website {
|
|
22
|
+
user: Users.MinimalUser;
|
|
23
|
+
}
|
|
4
24
|
/** Returns all user websites: https://umami.is/docs/api/websites#get-apiwebsites */
|
|
5
25
|
function get(this: API, parameters?: GenericRequestParameters & {
|
|
6
26
|
/** Set to true if you want to include websites where you are the team owner */
|
|
7
27
|
includeTeams?: boolean;
|
|
8
|
-
}): Promise<
|
|
9
|
-
user: Users.MinimalUser;
|
|
10
|
-
})[]>;
|
|
28
|
+
}): Promise<WebsiteWithUser[]>;
|
|
11
29
|
/** Creates a website: https://umami.is/docs/api/websites#post-apiwebsites */
|
|
12
30
|
function post(this: API, parameters: {
|
|
13
31
|
/** The name of the website in Umami */
|
|
14
|
-
name:
|
|
32
|
+
name: Website["name"];
|
|
15
33
|
/** The full domain of the tracked website */
|
|
16
|
-
domain:
|
|
34
|
+
domain: Website["domain"];
|
|
17
35
|
/** A unique string to enable a share url. Set `null` to unshare */
|
|
18
|
-
shareId?:
|
|
36
|
+
shareId?: Website["shareId"];
|
|
19
37
|
/** The ID of the team the website will be created under */
|
|
20
|
-
teamId?:
|
|
38
|
+
teamId?: Website["teamId"];
|
|
21
39
|
/** Force a UUID assignment to the website */
|
|
22
|
-
id?:
|
|
40
|
+
id?: Website["id"];
|
|
23
41
|
}): Promise<Website>;
|
|
24
42
|
/** Gets a website by ID: https://umami.is/docs/api/websites#get-apiwebsiteswebsiteid */
|
|
25
|
-
function get_WEBSITEID(this: API, websiteId:
|
|
43
|
+
function get_WEBSITEID(this: API, websiteId: Website["id"]): Promise<Website>;
|
|
26
44
|
/** Updates a website: https://umami.is/docs/api/websites#post-apiwebsiteswebsiteid */
|
|
27
|
-
function post_WEBSITEID(this: API, websiteId:
|
|
45
|
+
function post_WEBSITEID(this: API, websiteId: Website["id"], parameters: {
|
|
28
46
|
/** The name of the website in Umami */
|
|
29
|
-
name?:
|
|
47
|
+
name?: Website["name"];
|
|
30
48
|
/** The full domain of the tracked website */
|
|
31
|
-
domain?:
|
|
49
|
+
domain?: Website["domain"];
|
|
32
50
|
/** A unique string to enable a share url. Set `null` to unshare */
|
|
33
|
-
shareId?:
|
|
51
|
+
shareId?: Website["shareId"];
|
|
34
52
|
}): Promise<Website>;
|
|
35
53
|
/** Deletes a website: https://umami.is/docs/api/websites#delete-apiwebsiteswebsiteid */
|
|
36
|
-
function delete_WEBSITEID(this: API, websiteId:
|
|
54
|
+
function delete_WEBSITEID(this: API, websiteId: Website["id"]): Promise<DeletionResult>;
|
|
37
55
|
/** Resets a website by removing all data related to the website: https://umami.is/docs/api/websites#post-apiwebsiteswebsiteidreset */
|
|
38
|
-
function post_WEBSITEID_Reset(this: API, websiteId:
|
|
56
|
+
function post_WEBSITEID_Reset(this: API, websiteId: Website["id"]): Promise<DeletionResult>;
|
|
39
57
|
}
|
package/dist/utilities.js
CHANGED
|
@@ -56,7 +56,7 @@ export function correctType(x, force_string) {
|
|
|
56
56
|
const vals = Object.values(x);
|
|
57
57
|
// If a key is any of those, the value is expected to be a string, so we use `force_string` to make correctType convert them to string for us
|
|
58
58
|
const unconvertables = ["value"];
|
|
59
|
-
const unconvertables_substrings = ["string", "name"]; // or if the key contains any of those substrings
|
|
59
|
+
const unconvertables_substrings = ["string", "name", "Id"]; // or if the key contains any of those substrings
|
|
60
60
|
for (let i = 0; i < keys.length; i++) {
|
|
61
61
|
x[keys[i]] = correctType(vals[i], unconvertables.some((u) => keys[i] === u) || unconvertables_substrings.some((s) => keys[i].toLowerCase().includes(s)));
|
|
62
62
|
}
|