umami-api-js 0.0.4 → 0.1.0

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 CHANGED
@@ -1,4 +1,5 @@
1
- A package to interact with [the API of self-hosted instances of Umami v2.19.0](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).
1
+ A package to interact with [the API of self-hosted instances of Umami v3.0.0](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
- Please note that this package is expected to work with self-hosted instances of **Umami v2.19.0**, and is *not* expected to work with [Umami Cloud](https://umami.is/docs/cloud), the instance of Umami hosted by its creators.
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.0**, 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.0**, 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
@@ -1,5 +1,8 @@
1
1
  import { Admin } from "./namespaces/Admin.js";
2
2
  import { Events } from "./namespaces/Events.js";
3
+ import { Links } from "./namespaces/Links.js";
4
+ import { Me } from "./namespaces/Me.js";
5
+ import { Pixels } from "./namespaces/Pixels.js";
3
6
  import { Realtime } from "./namespaces/Realtime.js";
4
7
  import { Reports } from "./namespaces/Reports.js";
5
8
  import { Sessions } from "./namespaces/Sessions.js";
@@ -7,7 +10,7 @@ import { Teams } from "./namespaces/Teams.js";
7
10
  import { Users } from "./namespaces/Users.js";
8
11
  import { Websites } from "./namespaces/Websites.js";
9
12
  import { WebsiteStats } from "./namespaces/WebsiteStats.js";
10
- export { Admin, Users, Teams, Events, Sessions, Websites, WebsiteStats, Realtime, Reports };
13
+ export { Admin, Events, Links, Me, Pixels, Websites, WebsiteStats, Realtime, Reports, Sessions, Teams, Users };
11
14
  export interface ValueAndPrev {
12
15
  /** The actual value for the given time period */
13
16
  value: number;
@@ -169,14 +172,14 @@ export declare class API {
169
172
  get user(): {
170
173
  id: string;
171
174
  username: string;
172
- role: string;
175
+ role: Role;
173
176
  createdAt: Date;
174
177
  isAdmin: boolean;
175
178
  };
176
179
  set user(user: {
177
180
  id: string;
178
181
  username: string;
179
- role: string;
182
+ role: Role;
180
183
  createdAt: Date;
181
184
  isAdmin: boolean;
182
185
  });
@@ -271,75 +274,185 @@ export declare class API {
271
274
  request(method: "get" | "post" | "put" | "delete", endpoint: Array<string | number>, parameters?: {
272
275
  [k: string]: any;
273
276
  }): Promise<any>;
274
- /** @remarks To be replaced by {@link API.getWebsiteStats2}, no deprecation warning as the new method is unreliable */
275
- getWebsiteStats(website_id: string, startAt: Date, endAt: Date): Promise<{
276
- pageviews: ValueAndPrev;
277
- visitors: ValueAndPrev;
278
- visits: ValueAndPrev;
279
- bounces: ValueAndPrev;
280
- totaltime: ValueAndPrev;
277
+ /**
278
+ * To register an event
279
+ * (TODO UNTESTED)
280
+ * @group Sending stats
281
+ */
282
+ sendStats(payload: {
283
+ /** Name of host */
284
+ hostname: string;
285
+ /** Screen resolution (ex. "1920x1080") */
286
+ screen: string;
287
+ /** Language of visitor (ex. "en-US") */
288
+ language: string;
289
+ /** Page URL */
290
+ url: string;
291
+ /** Referrer URL */
292
+ referrer: string;
293
+ /** Page title */
294
+ title: string;
295
+ /** Additional tag description */
296
+ tag: string;
297
+ /** Session identifier */
298
+ id: string;
299
+ /** Website ID */
300
+ website: string;
301
+ /** Name of the event */
302
+ name: string;
303
+ /** Additional data for the event */
304
+ data?: {
305
+ [k: string]: any;
306
+ };
307
+ }): Promise<{
308
+ cache: string;
309
+ sessionid: string;
310
+ visitId: string;
281
311
  }>;
312
+ /** @group Admin endpoints */
282
313
  readonly getUsersAsAdmin: typeof Admin.getUsers;
314
+ /** @group Admin endpoints */
283
315
  readonly getWebsitesAsAdmin: typeof Admin.getWebsites;
316
+ /** @group Admin endpoints */
284
317
  readonly getTeamsAsAdmin: typeof Admin.getTeams;
285
- readonly createUser: typeof Users.createUser;
286
- readonly getUser: typeof Users.getUser;
287
- readonly updateUser: typeof Users.updateUser;
288
- readonly deleteUser: typeof Users.deleteUser;
289
- readonly getUserTeams: typeof Users.getUserTeams;
290
- readonly getUserWebsites: typeof Users.getUserWebsites;
291
- readonly getTeams: typeof Teams.getTeams;
292
- readonly createTeam: typeof Teams.createTeam;
293
- readonly joinTeam: typeof Teams.joinTeam;
294
- readonly getTeam: typeof Teams.getTeam;
295
- readonly updateTeam: typeof Teams.updateTeam;
296
- readonly deleteTeam: typeof Teams.deleteTeam;
297
- readonly getTeamUsers: typeof Teams.getTeamUsers;
298
- readonly addTeamUser: typeof Teams.addTeamUser;
299
- readonly getTeamUser: typeof Teams.getTeamUser;
300
- readonly updateTeamUser: typeof Teams.updateTeamUser;
301
- readonly removeTeamUser: typeof Teams.removeTeamUser;
302
- readonly getTeamWebsites: typeof Teams.getTeamWebsites;
303
- readonly getWebsiteEvents: typeof Events.getWebsiteEvents;
304
- readonly getWebsiteEventData: typeof Events.getWebsiteEventData;
305
- readonly getWebsiteEventsData: typeof Events.getWebsiteEventsData;
306
- readonly getWebsiteEventsDataFields: typeof Events.getWebsiteEventsDataFields;
307
- readonly getWebsiteEventsDataProperties: typeof Events.getWebsiteEventsDataProperties;
308
- readonly getWebsiteEventsDataValues: typeof Events.getWebsiteEventsDataValues;
309
- readonly getWebsiteEventsDataStats: typeof Events.getWebsiteEventsDataStats;
310
- readonly getWebsiteSessions: typeof Sessions.getWebsiteSessions;
311
- readonly getWebsiteSessionsStats: typeof Sessions.getWebsiteSessionsStats;
312
- readonly getWebsiteSessionsWeekly: typeof Sessions.getWebsiteSessionsWeekly;
313
- readonly getWebsiteSession: typeof Sessions.getWebsiteSession;
314
- readonly getWebsiteSessionActivity: typeof Sessions.getWebsiteSessionActivity;
315
- readonly getWebsiteSessionProperties: typeof Sessions.getWebsiteSessionProperties;
316
- readonly getWebsiteSessionDataProperties: typeof Sessions.getWebsiteSessionDataProperties;
317
- readonly getWebsiteSessionDataValues: typeof Sessions.getWebsiteSessionDataValues;
318
- readonly getWebsites: typeof Websites.getWebsites;
319
- readonly createWebsite: typeof Websites.createWebsite;
320
- readonly getWebsite: typeof Websites.getWebsite;
321
- readonly updateWebsite: typeof Websites.updateWebsite;
322
- readonly deleteWebsite: typeof Websites.deleteWebsite;
323
- readonly resetWebsite: typeof Websites.resetWebsite;
324
- readonly getWebsiteActiveVisitors: typeof WebsiteStats.getWebsiteActiveVisitors;
325
- readonly getWebsiteEventsStats: typeof WebsiteStats.getWebsiteEvents;
326
- readonly getWebsiteMetrics: typeof WebsiteStats.getWebsiteMetrics;
327
- readonly getWebsiteMetricsExpanded: typeof WebsiteStats.getWebsiteMetricsExpanded;
328
- readonly getWebsitePageviews: typeof WebsiteStats.getWebsitePageviews;
329
- /** @remarks Will replace {@link API.getWebsiteStats}, which you should use for a reliable experience */
330
- readonly getWebsiteStats2: typeof WebsiteStats.getWebsiteStats;
331
- readonly getRealtime: typeof Realtime.getRealtime;
332
- readonly getReports: typeof Reports.getReports;
333
- readonly createReport: typeof Reports.createReport;
334
- readonly getReport: typeof Reports.getReport;
335
- readonly updateReport: typeof Reports.updateReport;
336
- readonly deleteReport: typeof Reports.deleteReport;
337
- readonly getReportsAttribution: typeof Reports.getReportsAttribution;
338
- readonly getReportsBreakdown: typeof Reports.getReportsBreakdown;
339
- readonly getReportsFunnel: typeof Reports.getReportsFunnel;
340
- readonly getReportsGoals: typeof Reports.getReportsGoals;
341
- readonly getReportsJourney: typeof Reports.getReportsJourney;
342
- readonly getReportsRetention: typeof Reports.getReportsRetention;
343
- readonly getReportsRevenue: typeof Reports.getReportsRevenue;
344
- readonly getReportsUTM: typeof Reports.getReportsUTM;
318
+ /** @group Events endpoints */
319
+ readonly getWebsiteEvents: typeof Events.get_WEBSITEID_Events;
320
+ /** @group Events endpoints */
321
+ readonly getWebsiteEventData: typeof Events.get_WEBSITEID_Eventdata_EVENTID;
322
+ /** @group Events endpoints */
323
+ readonly getWebsiteEventsData: typeof Events.get_WEBSITEID_EventdataEvents;
324
+ /** @group Events endpoints */
325
+ readonly getWebsiteEventsDataFields: typeof Events.get_WEBSITEID_EventdataFields;
326
+ /** @group Events endpoints */
327
+ readonly getWebsiteEventsDataProperties: typeof Events.get_WEBSITEID_EventdataProperties;
328
+ /** @group Events endpoints */
329
+ readonly getWebsiteEventsDataValues: typeof Events.get_WEBSITEID_EventdataValues;
330
+ /** @group Events endpoints */
331
+ readonly getWebsiteEventsDataStats: typeof Events.get_WEBSITEID_EventdataStats;
332
+ /** @group Links endpoints */
333
+ readonly getLinks: typeof Links.get;
334
+ /** @group Links endpoints */
335
+ readonly getLink: typeof Links.get_LINKID;
336
+ /** @group Links endpoints */
337
+ readonly updateLink: typeof Links.post_LINKID;
338
+ /** @group Links endpoints */
339
+ readonly deleteLink: typeof Links.delete_LINKID;
340
+ /** @group Me endpoints */
341
+ readonly getMyself: typeof Me.get;
342
+ /** @group Me endpoints */
343
+ readonly getMyTeams: typeof Me.getTeams;
344
+ /** @group Me endpoints */
345
+ readonly getMyWebsites: typeof Me.getWebsites;
346
+ /** @group Links endpoints */
347
+ readonly getPixels: typeof Pixels.get;
348
+ /** @group Links endpoints */
349
+ readonly getPixel: typeof Pixels.get_PIXELID;
350
+ /** @group Links endpoints */
351
+ readonly updatePixel: typeof Pixels.post_PIXELID;
352
+ /** @group Links endpoints */
353
+ readonly deletePixel: typeof Pixels.delete_PIXELID;
354
+ /** @group Websites endpoints */
355
+ readonly getWebsites: typeof Websites.get;
356
+ /** @group Websites endpoints */
357
+ readonly createWebsite: typeof Websites.post;
358
+ /** @group Websites endpoints */
359
+ readonly getWebsite: typeof Websites.get_WEBSITEID;
360
+ /** @group Websites endpoints */
361
+ readonly updateWebsite: typeof Websites.post_WEBSITEID;
362
+ /** @group Websites endpoints */
363
+ readonly deleteWebsite: typeof Websites.delete_WEBSITEID;
364
+ /** @group Websites endpoints */
365
+ readonly resetWebsite: typeof Websites.post_WEBSITEID_Reset;
366
+ /** @group Website stats endpoints */
367
+ readonly getWebsiteActiveVisitors: typeof WebsiteStats.get_WEBSITEID_Active;
368
+ /** @group Website stats endpoints */
369
+ readonly getWebsiteEventsStats: typeof WebsiteStats.get_WEBSITEID_EventsSeries;
370
+ /** @group Website stats endpoints */
371
+ readonly getWebsiteMetrics: typeof WebsiteStats.get_WEBSITEID_Metrics;
372
+ /** @group Website stats endpoints */
373
+ readonly getWebsiteMetricsExpanded: typeof WebsiteStats.get_WEBSITEID_MetricsExpanded;
374
+ /** @group Website stats endpoints */
375
+ readonly getWebsitePageviews: typeof WebsiteStats.get_WEBSITEID_Pageviews;
376
+ /** @group Website stats endpoints */
377
+ readonly getWebsiteStats: typeof WebsiteStats.get_WEBSITEID_Stats;
378
+ /** @group Realtime endpoints */
379
+ readonly getRealtime: typeof Realtime.get_WEBSITEID;
380
+ /** @group Reports endpoints */
381
+ readonly getReports: typeof Reports.get;
382
+ /** @group Reports endpoints */
383
+ readonly createReport: typeof Reports.post;
384
+ /** @group Reports endpoints */
385
+ readonly getReport: typeof Reports.get_REPORTID;
386
+ /** @group Reports endpoints */
387
+ readonly updateReport: typeof Reports.post_REPORTID;
388
+ /** @group Reports endpoints */
389
+ readonly deleteReport: typeof Reports.delete_REPORTID;
390
+ /** @group Reports endpoints */
391
+ readonly getReportsAttribution: typeof Reports.postAttribution;
392
+ /** @group Reports endpoints */
393
+ readonly getReportsBreakdown: typeof Reports.postBreakdown;
394
+ /** @group Reports endpoints */
395
+ readonly getReportsFunnel: typeof Reports.postFunnel;
396
+ /** @group Reports endpoints */
397
+ readonly getReportsGoals: typeof Reports.postGoals;
398
+ /** @group Reports endpoints */
399
+ readonly getReportsJourney: typeof Reports.postJourney;
400
+ /** @group Reports endpoints */
401
+ readonly getReportsRetention: typeof Reports.postRetention;
402
+ /** @group Reports endpoints */
403
+ readonly getReportsRevenue: typeof Reports.postRevenue;
404
+ /** @group Reports endpoints */
405
+ readonly getReportsUTM: typeof Reports.postUTM;
406
+ /** @group Sessions endpoints */
407
+ readonly getWebsiteSessions: typeof Sessions.get_WEBSITEID_Sessions;
408
+ /** @group Sessions endpoints */
409
+ readonly getWebsiteSessionsStats: typeof Sessions.get_WEBSITEID_SessionsStats;
410
+ /** @group Sessions endpoints */
411
+ readonly getWebsiteSessionsWeekly: typeof Sessions.get_WEBSITEID_SessionsWeekly;
412
+ /** @group Sessions endpoints */
413
+ readonly getWebsiteSession: typeof Sessions.get_WEBSITEID_Sessions_SESSIONID;
414
+ /** @group Sessions endpoints */
415
+ readonly getWebsiteSessionActivity: typeof Sessions.get_WEBSITEID_Sessions_SESSIONID_Activity;
416
+ /** @group Sessions endpoints */
417
+ readonly getWebsiteSessionProperties: typeof Sessions.get_WEBSITEID_Sessions_SESSIONID_Properties;
418
+ /** @group Sessions endpoints */
419
+ readonly getWebsiteSessionDataProperties: typeof Sessions.get_WEBSITEID_SessiondataProperties;
420
+ /** @group Sessions endpoints */
421
+ readonly getWebsiteSessionDataValues: typeof Sessions.get_WEBSITEID_SessiondataValues;
422
+ /** @group Teams endpoints */
423
+ readonly getTeams: typeof Teams.get;
424
+ /** @group Teams endpoints */
425
+ readonly createTeam: typeof Teams.post;
426
+ /** @group Teams endpoints */
427
+ readonly joinTeam: typeof Teams.postJoin;
428
+ /** @group Teams endpoints */
429
+ readonly getTeam: typeof Teams.get_TEAMID;
430
+ /** @group Teams endpoints */
431
+ readonly updateTeam: typeof Teams.post_TEAMID;
432
+ /** @group Teams endpoints */
433
+ readonly deleteTeam: typeof Teams.delete_TEAMID;
434
+ /** @group Teams endpoints */
435
+ readonly getTeamUsers: typeof Teams.get_TEAMID_Users;
436
+ /** @group Teams endpoints */
437
+ readonly addTeamUser: typeof Teams.post_TEAMID_Users;
438
+ /** @group Teams endpoints */
439
+ readonly getTeamUser: typeof Teams.get_TEAMID_Users_USERID;
440
+ /** @group Teams endpoints */
441
+ readonly updateTeamUser: typeof Teams.post_TEAMID_Users_USERID;
442
+ /** @group Teams endpoints */
443
+ readonly removeTeamUser: typeof Teams.delete_TEAMID_Users_USERID;
444
+ /** @group Teams endpoints */
445
+ readonly getTeamWebsites: typeof Teams.get_TEAMID_Websites;
446
+ /** @group Users endpoints */
447
+ readonly createUser: typeof Users.post;
448
+ /** @group Users endpoints */
449
+ readonly getUser: typeof Users.get_USERID;
450
+ /** @group Users endpoints */
451
+ readonly updateUser: typeof Users.post_USERID;
452
+ /** @group Users endpoints */
453
+ readonly deleteUser: typeof Users.delete_USERID;
454
+ /** @group Users endpoints */
455
+ readonly getUserTeams: typeof Users.get_USERID_Teams;
456
+ /** @group Users endpoints */
457
+ readonly getUserWebsites: typeof Users.get_USERID_Websites;
345
458
  }
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { Admin } from "./namespaces/Admin.js";
2
2
  import { Events } from "./namespaces/Events.js";
3
+ import { Links } from "./namespaces/Links.js";
4
+ import { Me } from "./namespaces/Me.js";
5
+ import { Pixels } from "./namespaces/Pixels.js";
3
6
  import { Realtime } from "./namespaces/Realtime.js";
4
7
  import { Reports } from "./namespaces/Reports.js";
5
8
  import { Sessions } from "./namespaces/Sessions.js";
@@ -8,7 +11,7 @@ import { Users } from "./namespaces/Users.js";
8
11
  import { Websites } from "./namespaces/Websites.js";
9
12
  import { WebsiteStats } from "./namespaces/WebsiteStats.js";
10
13
  import { adaptParametersForGETRequests, correctType } from "./utilities.js";
11
- export { Admin, Users, Teams, Events, Sessions, Websites, WebsiteStats, Realtime, Reports };
14
+ export { Admin, Events, Links, Me, Pixels, Websites, WebsiteStats, Realtime, Reports, Sessions, Teams, Users };
12
15
  /** If the {@link API} throws an error, it should always be an {@link APIError}! */
13
16
  export class APIError extends Error {
14
17
  message;
@@ -134,8 +137,8 @@ export class API {
134
137
  this.log(true, "Unable to obtain a token! Here's what was received from the API:", json);
135
138
  reject(new APIError(error_message, this.server, "post", ["auth", "login"], body, response.status));
136
139
  }
137
- this.token_type = json.token_type;
138
140
  this.token = json.token;
141
+ this.user = json.user;
139
142
  const expiration_date = new Date();
140
143
  expiration_date.setDate(expiration_date.getDate() + 1); // Assume 24 hours
141
144
  this.expires = expiration_date;
@@ -378,80 +381,171 @@ export class API {
378
381
  throw new APIError(`${e?.name} (${e?.message ?? e?.errno ?? e?.type})`, this.server, method, endpoint, parameters, undefined, e);
379
382
  }
380
383
  }
381
- /** @remarks To be replaced by {@link API.getWebsiteStats2}, no deprecation warning as the new method is unreliable */
382
- async getWebsiteStats(website_id, startAt, endAt) {
383
- return await this.request("get", ["websites", website_id, "stats"], { startAt, endAt });
384
+ // UNCATEGORIZED
385
+ /**
386
+ * To register an event
387
+ * (TODO UNTESTED)
388
+ * @group Sending stats
389
+ */
390
+ async sendStats(payload) {
391
+ return await this.request("post", ["send"], { payload, type: "event" });
384
392
  }
385
393
  // ADMIN
394
+ /** @group Admin endpoints */
386
395
  getUsersAsAdmin = Admin.getUsers;
396
+ /** @group Admin endpoints */
387
397
  getWebsitesAsAdmin = Admin.getWebsites;
398
+ /** @group Admin endpoints */
388
399
  getTeamsAsAdmin = Admin.getTeams;
389
- // USERS
390
- createUser = Users.createUser;
391
- getUser = Users.getUser;
392
- updateUser = Users.updateUser;
393
- deleteUser = Users.deleteUser;
394
- getUserTeams = Users.getUserTeams;
395
- getUserWebsites = Users.getUserWebsites;
396
- // TEAMS
397
- getTeams = Teams.getTeams;
398
- createTeam = Teams.createTeam;
399
- joinTeam = Teams.joinTeam;
400
- getTeam = Teams.getTeam;
401
- updateTeam = Teams.updateTeam;
402
- deleteTeam = Teams.deleteTeam;
403
- getTeamUsers = Teams.getTeamUsers;
404
- addTeamUser = Teams.addTeamUser;
405
- getTeamUser = Teams.getTeamUser;
406
- updateTeamUser = Teams.updateTeamUser;
407
- removeTeamUser = Teams.removeTeamUser;
408
- getTeamWebsites = Teams.getTeamWebsites;
409
400
  // EVENTS
410
- getWebsiteEvents = Events.getWebsiteEvents;
411
- getWebsiteEventData = Events.getWebsiteEventData;
412
- getWebsiteEventsData = Events.getWebsiteEventsData;
413
- getWebsiteEventsDataFields = Events.getWebsiteEventsDataFields;
414
- getWebsiteEventsDataProperties = Events.getWebsiteEventsDataProperties;
415
- getWebsiteEventsDataValues = Events.getWebsiteEventsDataValues;
416
- getWebsiteEventsDataStats = Events.getWebsiteEventsDataStats;
417
- // SESSIONS
418
- getWebsiteSessions = Sessions.getWebsiteSessions;
419
- getWebsiteSessionsStats = Sessions.getWebsiteSessionsStats;
420
- getWebsiteSessionsWeekly = Sessions.getWebsiteSessionsWeekly;
421
- getWebsiteSession = Sessions.getWebsiteSession;
422
- getWebsiteSessionActivity = Sessions.getWebsiteSessionActivity;
423
- getWebsiteSessionProperties = Sessions.getWebsiteSessionProperties;
424
- getWebsiteSessionDataProperties = Sessions.getWebsiteSessionDataProperties;
425
- getWebsiteSessionDataValues = Sessions.getWebsiteSessionDataValues;
401
+ /** @group Events endpoints */
402
+ getWebsiteEvents = Events.get_WEBSITEID_Events;
403
+ /** @group Events endpoints */
404
+ getWebsiteEventData = Events.get_WEBSITEID_Eventdata_EVENTID;
405
+ /** @group Events endpoints */
406
+ getWebsiteEventsData = Events.get_WEBSITEID_EventdataEvents;
407
+ /** @group Events endpoints */
408
+ getWebsiteEventsDataFields = Events.get_WEBSITEID_EventdataFields;
409
+ /** @group Events endpoints */
410
+ getWebsiteEventsDataProperties = Events.get_WEBSITEID_EventdataProperties;
411
+ /** @group Events endpoints */
412
+ getWebsiteEventsDataValues = Events.get_WEBSITEID_EventdataValues;
413
+ /** @group Events endpoints */
414
+ getWebsiteEventsDataStats = Events.get_WEBSITEID_EventdataStats;
415
+ // LINKS
416
+ /** @group Links endpoints */
417
+ getLinks = Links.get;
418
+ /** @group Links endpoints */
419
+ getLink = Links.get_LINKID;
420
+ /** @group Links endpoints */
421
+ updateLink = Links.post_LINKID;
422
+ /** @group Links endpoints */
423
+ deleteLink = Links.delete_LINKID;
424
+ // ME
425
+ /** @group Me endpoints */
426
+ getMyself = Me.get;
427
+ /** @group Me endpoints */
428
+ getMyTeams = Me.getTeams;
429
+ /** @group Me endpoints */
430
+ getMyWebsites = Me.getWebsites;
431
+ // PIXELS
432
+ /** @group Links endpoints */
433
+ getPixels = Pixels.get;
434
+ /** @group Links endpoints */
435
+ getPixel = Pixels.get_PIXELID;
436
+ /** @group Links endpoints */
437
+ updatePixel = Pixels.post_PIXELID;
438
+ /** @group Links endpoints */
439
+ deletePixel = Pixels.delete_PIXELID;
426
440
  // WEBSITES
427
- getWebsites = Websites.getWebsites;
428
- createWebsite = Websites.createWebsite;
429
- getWebsite = Websites.getWebsite;
430
- updateWebsite = Websites.updateWebsite;
431
- deleteWebsite = Websites.deleteWebsite;
432
- resetWebsite = Websites.resetWebsite;
441
+ /** @group Websites endpoints */
442
+ getWebsites = Websites.get;
443
+ /** @group Websites endpoints */
444
+ createWebsite = Websites.post;
445
+ /** @group Websites endpoints */
446
+ getWebsite = Websites.get_WEBSITEID;
447
+ /** @group Websites endpoints */
448
+ updateWebsite = Websites.post_WEBSITEID;
449
+ /** @group Websites endpoints */
450
+ deleteWebsite = Websites.delete_WEBSITEID;
451
+ /** @group Websites endpoints */
452
+ resetWebsite = Websites.post_WEBSITEID_Reset;
433
453
  // WEBSITE STATS
434
- getWebsiteActiveVisitors = WebsiteStats.getWebsiteActiveVisitors;
435
- getWebsiteEventsStats = WebsiteStats.getWebsiteEvents;
436
- getWebsiteMetrics = WebsiteStats.getWebsiteMetrics;
437
- getWebsiteMetricsExpanded = WebsiteStats.getWebsiteMetricsExpanded;
438
- getWebsitePageviews = WebsiteStats.getWebsitePageviews;
439
- /** @remarks Will replace {@link API.getWebsiteStats}, which you should use for a reliable experience */
440
- getWebsiteStats2 = WebsiteStats.getWebsiteStats;
454
+ /** @group Website stats endpoints */
455
+ getWebsiteActiveVisitors = WebsiteStats.get_WEBSITEID_Active;
456
+ /** @group Website stats endpoints */
457
+ getWebsiteEventsStats = WebsiteStats.get_WEBSITEID_EventsSeries;
458
+ /** @group Website stats endpoints */
459
+ getWebsiteMetrics = WebsiteStats.get_WEBSITEID_Metrics;
460
+ /** @group Website stats endpoints */
461
+ getWebsiteMetricsExpanded = WebsiteStats.get_WEBSITEID_MetricsExpanded;
462
+ /** @group Website stats endpoints */
463
+ getWebsitePageviews = WebsiteStats.get_WEBSITEID_Pageviews;
464
+ /** @group Website stats endpoints */
465
+ getWebsiteStats = WebsiteStats.get_WEBSITEID_Stats;
441
466
  // REALTIME
442
- getRealtime = Realtime.getRealtime;
467
+ /** @group Realtime endpoints */
468
+ getRealtime = Realtime.get_WEBSITEID;
443
469
  // REPORTS
444
- getReports = Reports.getReports;
445
- createReport = Reports.createReport;
446
- getReport = Reports.getReport;
447
- updateReport = Reports.updateReport;
448
- deleteReport = Reports.deleteReport;
449
- getReportsAttribution = Reports.getReportsAttribution;
450
- getReportsBreakdown = Reports.getReportsBreakdown;
451
- getReportsFunnel = Reports.getReportsFunnel;
452
- getReportsGoals = Reports.getReportsGoals;
453
- getReportsJourney = Reports.getReportsJourney;
454
- getReportsRetention = Reports.getReportsRetention;
455
- getReportsRevenue = Reports.getReportsRevenue;
456
- getReportsUTM = Reports.getReportsUTM;
470
+ /** @group Reports endpoints */
471
+ getReports = Reports.get;
472
+ /** @group Reports endpoints */
473
+ createReport = Reports.post;
474
+ /** @group Reports endpoints */
475
+ getReport = Reports.get_REPORTID;
476
+ /** @group Reports endpoints */
477
+ updateReport = Reports.post_REPORTID;
478
+ /** @group Reports endpoints */
479
+ deleteReport = Reports.delete_REPORTID;
480
+ /** @group Reports endpoints */
481
+ getReportsAttribution = Reports.postAttribution;
482
+ /** @group Reports endpoints */
483
+ getReportsBreakdown = Reports.postBreakdown;
484
+ /** @group Reports endpoints */
485
+ getReportsFunnel = Reports.postFunnel;
486
+ /** @group Reports endpoints */
487
+ getReportsGoals = Reports.postGoals;
488
+ /** @group Reports endpoints */
489
+ getReportsJourney = Reports.postJourney;
490
+ /** @group Reports endpoints */
491
+ getReportsRetention = Reports.postRetention;
492
+ /** @group Reports endpoints */
493
+ getReportsRevenue = Reports.postRevenue;
494
+ /** @group Reports endpoints */
495
+ getReportsUTM = Reports.postUTM;
496
+ // SESSIONS
497
+ /** @group Sessions endpoints */
498
+ getWebsiteSessions = Sessions.get_WEBSITEID_Sessions;
499
+ /** @group Sessions endpoints */
500
+ getWebsiteSessionsStats = Sessions.get_WEBSITEID_SessionsStats;
501
+ /** @group Sessions endpoints */
502
+ getWebsiteSessionsWeekly = Sessions.get_WEBSITEID_SessionsWeekly;
503
+ /** @group Sessions endpoints */
504
+ getWebsiteSession = Sessions.get_WEBSITEID_Sessions_SESSIONID;
505
+ /** @group Sessions endpoints */
506
+ getWebsiteSessionActivity = Sessions.get_WEBSITEID_Sessions_SESSIONID_Activity;
507
+ /** @group Sessions endpoints */
508
+ getWebsiteSessionProperties = Sessions.get_WEBSITEID_Sessions_SESSIONID_Properties;
509
+ /** @group Sessions endpoints */
510
+ getWebsiteSessionDataProperties = Sessions.get_WEBSITEID_SessiondataProperties;
511
+ /** @group Sessions endpoints */
512
+ getWebsiteSessionDataValues = Sessions.get_WEBSITEID_SessiondataValues;
513
+ // TEAMS
514
+ /** @group Teams endpoints */
515
+ getTeams = Teams.get;
516
+ /** @group Teams endpoints */
517
+ createTeam = Teams.post;
518
+ /** @group Teams endpoints */
519
+ joinTeam = Teams.postJoin;
520
+ /** @group Teams endpoints */
521
+ getTeam = Teams.get_TEAMID;
522
+ /** @group Teams endpoints */
523
+ updateTeam = Teams.post_TEAMID;
524
+ /** @group Teams endpoints */
525
+ deleteTeam = Teams.delete_TEAMID;
526
+ /** @group Teams endpoints */
527
+ getTeamUsers = Teams.get_TEAMID_Users;
528
+ /** @group Teams endpoints */
529
+ addTeamUser = Teams.post_TEAMID_Users;
530
+ /** @group Teams endpoints */
531
+ getTeamUser = Teams.get_TEAMID_Users_USERID;
532
+ /** @group Teams endpoints */
533
+ updateTeamUser = Teams.post_TEAMID_Users_USERID;
534
+ /** @group Teams endpoints */
535
+ removeTeamUser = Teams.delete_TEAMID_Users_USERID;
536
+ /** @group Teams endpoints */
537
+ getTeamWebsites = Teams.get_TEAMID_Websites;
538
+ // USERS
539
+ /** @group Users endpoints */
540
+ createUser = Users.post;
541
+ /** @group Users endpoints */
542
+ getUser = Users.get_USERID;
543
+ /** @group Users endpoints */
544
+ updateUser = Users.post_USERID;
545
+ /** @group Users endpoints */
546
+ deleteUser = Users.delete_USERID;
547
+ /** @group Users endpoints */
548
+ getUserTeams = Users.get_USERID_Teams;
549
+ /** @group Users endpoints */
550
+ getUserWebsites = Users.get_USERID_Websites;
457
551
  }
@@ -1,32 +1,23 @@
1
1
  import { API, GenericObject, GenericRequestParameters, MinimalUser, Role, Teams, Website } from "../index.js";
2
- /** For endpoints listed on: https://umami.is/docs/api/admin-api */
2
+ /** Operations around admin management: https://umami.is/docs/api/admin */
3
3
  export declare namespace Admin {
4
- /** Returns all users: https://umami.is/docs/api/admin-api#get-apiadminusers */
4
+ /** Returns all users: https://umami.is/docs/api/admin#get-apiadminusers */
5
5
  function getUsers(this: API, parameters?: GenericRequestParameters): Promise<(GenericObject & {
6
6
  username: string;
7
- /** @remarks **UNDOCUMENTED** & seems encrypted (thankfully, lol) */
8
- password: string;
9
7
  role: Role;
10
8
  logoUrl: string | null;
11
9
  displayName: string | null;
12
10
  _count: {
13
- /** @remarks **UNDOCUMENTED**, documented uncorrectly as `websites`? */
14
- websiteUser: number;
11
+ websites: number;
15
12
  };
16
13
  })[]>;
17
- /**
18
- * Returns all websites: https://umami.is/docs/api/admin-api#get-apiadminwebsites
19
- * @remarks TODO Possibly doesn't work? (throws 400 on my end)
20
- */
14
+ /** Returns all websites: https://umami.is/docs/api/admin#get-apiadminwebsites */
21
15
  function getWebsites(this: API, parameters?: GenericRequestParameters): Promise<(Website & {
22
16
  user: MinimalUser;
23
17
  /** @remarks TODO Documentation says it can be null but doesn't actually say what else it can be, ***presumed* to be string**, check */
24
18
  team: string | null;
25
19
  })[]>;
26
- /**
27
- * Returns all teams: https://umami.is/docs/api/admin-api#get-apiadminteams
28
- * @remarks TODO Possibly doesn't work? (throws 404 on my end)
29
- */
20
+ /** Returns all teams: https://umami.is/docs/api/admin#get-apiadminteams */
30
21
  function getTeams(this: API, parameters?: GenericRequestParameters): Promise<(GenericObject & {
31
22
  name: string;
32
23
  accessCode: string;
@@ -1,25 +1,19 @@
1
- /** For endpoints listed on: https://umami.is/docs/api/admin-api */
1
+ /** Operations around admin management: https://umami.is/docs/api/admin */
2
2
  export var Admin;
3
3
  (function (Admin) {
4
- /** Returns all users: https://umami.is/docs/api/admin-api#get-apiadminusers */
4
+ /** Returns all users: https://umami.is/docs/api/admin#get-apiadminusers */
5
5
  async function getUsers(parameters) {
6
6
  const response = await this.request("get", ["admin", "users"], parameters);
7
7
  return response.data;
8
8
  }
9
9
  Admin.getUsers = getUsers;
10
- /**
11
- * Returns all websites: https://umami.is/docs/api/admin-api#get-apiadminwebsites
12
- * @remarks TODO Possibly doesn't work? (throws 400 on my end)
13
- */
10
+ /** Returns all websites: https://umami.is/docs/api/admin#get-apiadminwebsites */
14
11
  async function getWebsites(parameters) {
15
12
  const response = await this.request("get", ["admin", "websites"], parameters);
16
13
  return response.data;
17
14
  }
18
15
  Admin.getWebsites = getWebsites;
19
- /**
20
- * Returns all teams: https://umami.is/docs/api/admin-api#get-apiadminteams
21
- * @remarks TODO Possibly doesn't work? (throws 404 on my end)
22
- */
16
+ /** Returns all teams: https://umami.is/docs/api/admin#get-apiadminteams */
23
17
  async function getTeams(parameters) {
24
18
  const response = await this.request("get", ["admin", "teams"], parameters);
25
19
  return response.data;