umami-api-js 0.0.4 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,70 +1,70 @@
1
- /** For endpoints listed on: https://umami.is/docs/api/reports-api */
1
+ /** Using reports throught the api: https://umami.is/docs/api/reports */
2
2
  export var Reports;
3
3
  (function (Reports) {
4
- /** Get all reports by website ID: https://umami.is/docs/api/reports-api#get-apireports (TODO UNTESTED) */
5
- async function getReports(websiteId, parameters) {
4
+ /** Get all reports by website ID: https://umami.is/docs/api/reports#get-apireports (TODO UNTESTED) */
5
+ async function get(websiteId, parameters) {
6
6
  const response = await this.request("get", ["reports"], { websiteId, ...parameters });
7
7
  return response.data;
8
8
  }
9
- Reports.getReports = getReports;
10
- /** Creates a report: https://umami.is/docs/api/reports-api#post-apireports (TODO UNTESTED) */
11
- async function createReport(websiteId, parameters) {
9
+ Reports.get = get;
10
+ /** Creates a report: https://umami.is/docs/api/reports#post-apireports (TODO UNTESTED) */
11
+ async function post(websiteId, parameters) {
12
12
  return await this.request("post", ["reports"], { websiteId, ...parameters });
13
13
  }
14
- Reports.createReport = createReport;
15
- /** Gets a report by ID: https://umami.is/docs/api/reports-api#get-apireportsreportid (TODO UNTESTED) */
16
- async function getReport(reportId) {
14
+ Reports.post = post;
15
+ /** Gets a report by ID: https://umami.is/docs/api/reports#get-apireportsreportid (TODO UNTESTED) */
16
+ async function get_REPORTID(reportId) {
17
17
  return await this.request("get", ["reports", reportId]);
18
18
  }
19
- Reports.getReport = getReport;
20
- /** Updates a report: https://umami.is/docs/api/reports-api#post-apireportsreportid (TODO UNTESTED) */
21
- async function updateReport(reportId, websiteId, parameters) {
19
+ Reports.get_REPORTID = get_REPORTID;
20
+ /** Updates a report: https://umami.is/docs/api/reports#post-apireportsreportid (TODO UNTESTED) */
21
+ async function post_REPORTID(reportId, websiteId, parameters) {
22
22
  return await this.request("get", ["reports", reportId], { websiteId, ...parameters });
23
23
  }
24
- Reports.updateReport = updateReport;
25
- /** Deletes a report: https://umami.is/docs/api/reports-api#delete-apireportsreportid (TODO UNTESTED) */
26
- async function deleteReport(reportId) {
24
+ Reports.post_REPORTID = post_REPORTID;
25
+ /** Deletes a report: https://umami.is/docs/api/reports#delete-apireportsreportid (TODO UNTESTED) */
26
+ async function delete_REPORTID(reportId) {
27
27
  return await this.request("delete", ["reports", reportId]);
28
28
  }
29
- Reports.deleteReport = deleteReport;
30
- /** See how users engage with your marketing and what drives conversions: https://umami.is/docs/api/reports-api#post-apireportsattribution (TODO UNTESTED) */
31
- async function getReportsAttribution(websiteId, parameters) {
29
+ Reports.delete_REPORTID = delete_REPORTID;
30
+ /** See how users engage with your marketing and what drives conversions: https://umami.is/docs/api/reports#post-apireportsattribution (TODO UNTESTED) */
31
+ async function postAttribution(websiteId, parameters) {
32
32
  return await this.request("post", ["reports", "attribution"], { websiteId, ...parameters });
33
33
  }
34
- Reports.getReportsAttribution = getReportsAttribution;
35
- /** Dive deeper into your data by using segments and filters: https://umami.is/docs/api/reports-api#post-apireportsbreakdown (TODO UNTESTED) */
36
- async function getReportsBreakdown(websiteId, parameters) {
34
+ Reports.postAttribution = postAttribution;
35
+ /** Dive deeper into your data by using segments and filters: https://umami.is/docs/api/reports#post-apireportsbreakdown (TODO UNTESTED) */
36
+ async function postBreakdown(websiteId, parameters) {
37
37
  return await this.request("post", ["reports", "breakdown"], { websiteId, ...parameters });
38
38
  }
39
- Reports.getReportsBreakdown = getReportsBreakdown;
40
- /** Understand the conversion and drop-off rate of users: https://umami.is/docs/api/reports-api#post-apireportsfunnel (TODO UNTESTED) */
41
- async function getReportsFunnel(websiteId, parameters) {
39
+ Reports.postBreakdown = postBreakdown;
40
+ /** Understand the conversion and drop-off rate of users: https://umami.is/docs/api/reports#post-apireportsfunnel (TODO UNTESTED) */
41
+ async function postFunnel(websiteId, parameters) {
42
42
  return await this.request("post", ["reports", "funnel"], { websiteId, ...parameters });
43
43
  }
44
- Reports.getReportsFunnel = getReportsFunnel;
45
- /** Track your goals for pageviews and events: https://umami.is/docs/api/reports-api#post-apireportsgoals (TODO UNTESTED) */
46
- async function getReportsGoals(websiteId, parameters) {
44
+ Reports.postFunnel = postFunnel;
45
+ /** Track your goals for pageviews and events: https://umami.is/docs/api/reports#post-apireportsgoals (TODO UNTESTED) */
46
+ async function postGoals(websiteId, parameters) {
47
47
  return await this.request("post", ["reports", "goals"], { websiteId, ...parameters });
48
48
  }
49
- Reports.getReportsGoals = getReportsGoals;
50
- /** Understand how users nagivate through your website: https://umami.is/docs/api/reports-api#post-apireportsjourney (TODO UNTESTED) */
51
- async function getReportsJourney(websiteId, parameters) {
49
+ Reports.postGoals = postGoals;
50
+ /** Understand how users nagivate through your website: https://umami.is/docs/api/reports#post-apireportsjourney (TODO UNTESTED) */
51
+ async function postJourney(websiteId, parameters) {
52
52
  return await this.request("post", ["reports", "journey"], { websiteId, ...parameters });
53
53
  }
54
- Reports.getReportsJourney = getReportsJourney;
55
- /** Measure your website stickiness by tracking how often users return: https://umami.is/docs/api/reports-api#post-apireportsretention (TODO UNTESTED) */
56
- async function getReportsRetention(websiteId, parameters) {
54
+ Reports.postJourney = postJourney;
55
+ /** Measure your website stickiness by tracking how often users return: https://umami.is/docs/api/reports#post-apireportsretention (TODO UNTESTED) */
56
+ async function postRetention(websiteId, parameters) {
57
57
  return await this.request("post", ["reports", "retention"], { websiteId, ...parameters });
58
58
  }
59
- Reports.getReportsRetention = getReportsRetention;
60
- /** Get currency for given range. Needed for Revenue and optional in Attribution reports: https://umami.is/docs/api/reports-api#post-apireportsrevenue (TODO UNTESTED) */
61
- async function getReportsRevenue(websiteId, parameters) {
59
+ Reports.postRetention = postRetention;
60
+ /** Get currency for given range. Needed for Revenue and optional in Attribution reports: https://umami.is/docs/api/reports#post-apireportsrevenue (TODO UNTESTED) */
61
+ async function postRevenue(websiteId, parameters) {
62
62
  return await this.request("post", ["reports", "revenue"], { websiteId, ...parameters });
63
63
  }
64
- Reports.getReportsRevenue = getReportsRevenue;
65
- /** Track your campaigns through UTM parameters: https://umami.is/docs/api/reports-api#post-apireportsutm (TODO UNTESTED) */
66
- async function getReportsUTM(websiteId, parameters) {
64
+ Reports.postRevenue = postRevenue;
65
+ /** Track your campaigns through UTM parameters: https://umami.is/docs/api/reports#post-apireportsutm (TODO UNTESTED) */
66
+ async function postUTM(websiteId, parameters) {
67
67
  return await this.request("post", ["reports", "utm"], { websiteId, ...parameters });
68
68
  }
69
- Reports.getReportsUTM = getReportsUTM;
69
+ Reports.postUTM = postUTM;
70
70
  })(Reports || (Reports = {}));
@@ -1,5 +1,5 @@
1
1
  import { API, Filters, GenericRequestParameters, Timestamps } from "../index.js";
2
- /** For endpoints listed on: https://umami.is/docs/api/sessions-api */
2
+ /** Operations around Sessions and Session data: https://umami.is/docs/api/sessions */
3
3
  export declare namespace Sessions {
4
4
  interface GenericSession {
5
5
  id: string;
@@ -17,13 +17,13 @@ export declare namespace Sessions {
17
17
  visits: number;
18
18
  views: number;
19
19
  }
20
- /** Gets website session details within a given time range: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessions (TODO UNTESTED) */
21
- function getWebsiteSessions(this: API, websiteId: string, parameters: Filters & Timestamps & GenericRequestParameters): Promise<(GenericSession & {
20
+ /** Gets website session details within a given time range: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessions (TODO UNTESTED) */
21
+ function get_WEBSITEID_Sessions(this: API, websiteId: string, parameters: Filters & Timestamps & GenericRequestParameters): Promise<(GenericSession & {
22
22
  hostname: string;
23
23
  createdAt: Date;
24
24
  })[]>;
25
- /** Gets summarized website session statistics: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionsstats (TODO UNTESTED) */
26
- function getWebsiteSessionsStats(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
25
+ /** Gets summarized website session statistics: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsstats (TODO UNTESTED) */
26
+ function get_WEBSITEID_SessionsStats(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
27
27
  /** Pages hits */
28
28
  pageviews: {
29
29
  value: number;
@@ -45,18 +45,18 @@ export declare namespace Sessions {
45
45
  value: number;
46
46
  };
47
47
  }>;
48
- /** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionsweekly (TODO UNTESTED) */
49
- function getWebsiteSessionsWeekly(this: API, websiteId: string, parameters: Filters & Timestamps & {
48
+ /** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsweekly (TODO UNTESTED) */
49
+ function get_WEBSITEID_SessionsWeekly(this: API, websiteId: string, parameters: Filters & Timestamps & {
50
50
  timezone: string;
51
51
  }): Promise<number[][]>;
52
- /** Gets session details for a individual session: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionssessionid (TODO UNTESTED) */
53
- function getWebsiteSession(this: API, websiteId: string, sessionId: string): Promise<GenericSession & {
52
+ /** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid (TODO UNTESTED) */
53
+ function get_WEBSITEID_Sessions_SESSIONID(this: API, websiteId: string, sessionId: string): Promise<GenericSession & {
54
54
  distinctId: string;
55
55
  events: number;
56
56
  totaltime: number;
57
57
  }>;
58
- /** Gets session activity for a individual session: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionssessionidactivity (TODO UNTESTED) */
59
- function getWebsiteSessionActivity(this: API, websiteId: string, sessionId: string, parameters: Timestamps): Promise<{
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<{
60
60
  createdAt: Date;
61
61
  urlPath: string;
62
62
  urlQuery: string;
@@ -67,8 +67,8 @@ export declare namespace Sessions {
67
67
  visitId: string;
68
68
  hasData: number;
69
69
  }[]>;
70
- /** Gets session properties for a individual session: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO UNTESTED) */
71
- function getWebsiteSessionProperties(this: API, websiteId: string, sessionId: string): Promise<{
70
+ /** Gets session properties for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO UNTESTED) */
71
+ function get_WEBSITEID_Sessions_SESSIONID_Properties(this: API, websiteId: string, sessionId: string): Promise<{
72
72
  websiteId: string;
73
73
  sessionid: string;
74
74
  dataKey: string;
@@ -78,13 +78,13 @@ export declare namespace Sessions {
78
78
  dateValue: Date | null;
79
79
  createdAt: Date;
80
80
  }[]>;
81
- /** Gets session data counts by property name: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsession-dataproperties (TODO UNTESTED) */
82
- function getWebsiteSessionDataProperties(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
81
+ /** Gets session data counts by property name: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-dataproperties (TODO UNTESTED) */
82
+ function get_WEBSITEID_SessiondataProperties(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
83
83
  propertyName: string;
84
84
  total: number;
85
85
  }[]>;
86
- /** Gets session data counts for a given property: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsession-datavalues (TODO UNTESTED) */
87
- function getWebsiteSessionDataValues(this: API, websiteId: string, parameters: Filters & Timestamps & {
86
+ /** Gets session data counts for a given property: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-datavalues (TODO UNTESTED) */
87
+ function get_WEBSITEID_SessiondataValues(this: API, websiteId: string, parameters: Filters & Timestamps & {
88
88
  propertyName: string;
89
89
  }): Promise<{
90
90
  value: string;
@@ -1,45 +1,45 @@
1
- /** For endpoints listed on: https://umami.is/docs/api/sessions-api */
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-api#get-apiwebsiteswebsiteidsessions (TODO UNTESTED) */
5
- async function getWebsiteSessions(websiteId, parameters) {
4
+ /** Gets website session details within a given time range: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessions (TODO UNTESTED) */
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
- Sessions.getWebsiteSessions = getWebsiteSessions;
10
- /** Gets summarized website session statistics: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionsstats (TODO UNTESTED) */
11
- async function getWebsiteSessionsStats(websiteId, parameters) {
9
+ Sessions.get_WEBSITEID_Sessions = get_WEBSITEID_Sessions;
10
+ /** Gets summarized website session statistics: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsstats (TODO UNTESTED) */
11
+ async function get_WEBSITEID_SessionsStats(websiteId, parameters) {
12
12
  return await this.request("get", ["websites", websiteId, "sessions"], parameters);
13
13
  }
14
- Sessions.getWebsiteSessionsStats = getWebsiteSessionsStats;
15
- /** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionsweekly (TODO UNTESTED) */
16
- async function getWebsiteSessionsWeekly(websiteId, parameters) {
14
+ 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 (TODO UNTESTED) */
16
+ async function get_WEBSITEID_SessionsWeekly(websiteId, parameters) {
17
17
  return await this.request("get", ["websites", websiteId, "sessions", "weekly"], parameters);
18
18
  }
19
- Sessions.getWebsiteSessionsWeekly = getWebsiteSessionsWeekly;
20
- /** Gets session details for a individual session: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionssessionid (TODO UNTESTED) */
21
- async function getWebsiteSession(websiteId, sessionId) {
19
+ Sessions.get_WEBSITEID_SessionsWeekly = get_WEBSITEID_SessionsWeekly;
20
+ /** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid (TODO UNTESTED) */
21
+ async function get_WEBSITEID_Sessions_SESSIONID(websiteId, sessionId) {
22
22
  return await this.request("get", ["websites", websiteId, "sessions", sessionId]);
23
23
  }
24
- Sessions.getWebsiteSession = getWebsiteSession;
25
- /** Gets session activity for a individual session: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionssessionidactivity (TODO UNTESTED) */
26
- async function getWebsiteSessionActivity(websiteId, sessionId, parameters) {
24
+ 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 (TODO UNTESTED) */
26
+ async function get_WEBSITEID_Sessions_SESSIONID_Activity(websiteId, sessionId, parameters) {
27
27
  return await this.request("get", ["websites", websiteId, "sessions", sessionId, "activity"], parameters);
28
28
  }
29
- Sessions.getWebsiteSessionActivity = getWebsiteSessionActivity;
30
- /** Gets session properties for a individual session: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO UNTESTED) */
31
- async function getWebsiteSessionProperties(websiteId, sessionId) {
29
+ 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 UNTESTED) */
31
+ async function get_WEBSITEID_Sessions_SESSIONID_Properties(websiteId, sessionId) {
32
32
  return await this.request("get", ["websites", websiteId, "sessions", sessionId, "activity", "properties"]);
33
33
  }
34
- Sessions.getWebsiteSessionProperties = getWebsiteSessionProperties;
35
- /** Gets session data counts by property name: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsession-dataproperties (TODO UNTESTED) */
36
- async function getWebsiteSessionDataProperties(websiteId, parameters) {
34
+ 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 UNTESTED) */
36
+ async function get_WEBSITEID_SessiondataProperties(websiteId, parameters) {
37
37
  return await this.request("get", ["websites", websiteId, "session-data", "properties"], parameters);
38
38
  }
39
- Sessions.getWebsiteSessionDataProperties = getWebsiteSessionDataProperties;
40
- /** Gets session data counts for a given property: https://umami.is/docs/api/sessions-api#get-apiwebsiteswebsiteidsession-datavalues (TODO UNTESTED) */
41
- async function getWebsiteSessionDataValues(websiteId, parameters) {
39
+ 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 UNTESTED) */
41
+ async function get_WEBSITEID_SessiondataValues(websiteId, parameters) {
42
42
  return await this.request("get", ["websites", websiteId, "session-data", "values"], parameters);
43
43
  }
44
- Sessions.getWebsiteSessionDataValues = getWebsiteSessionDataValues;
44
+ Sessions.get_WEBSITEID_SessiondataValues = get_WEBSITEID_SessiondataValues;
45
45
  })(Sessions || (Sessions = {}));
@@ -1,5 +1,5 @@
1
- import { API, GenericObject, GenericRequestParameters, TeamRole } from "../index.js";
2
- /** For endpoints listed on: https://umami.is/docs/api/teams-api */
1
+ import { API, DeletionResult, GenericObject, GenericRequestParameters, TeamRole, Users } from "../index.js";
2
+ /** Operations around Team management: https://umami.is/docs/api/teams */
3
3
  export declare namespace Teams {
4
4
  interface GenericTeam extends GenericObject {
5
5
  name: string;
@@ -8,64 +8,60 @@ export declare namespace Teams {
8
8
  }
9
9
  interface TeamMember extends Omit<GenericObject, "deletedAt"> {
10
10
  teamId: string;
11
- userId: string;
11
+ userId: Users.User["id"];
12
12
  role: TeamRole;
13
13
  user: {
14
14
  id: string;
15
15
  username: string;
16
16
  };
17
17
  }
18
- /** Returns all teams: https://umami.is/docs/api/teams-api#get-apiteams (TODO UNTESTED) */
19
- function getTeams(this: API, parameters?: Omit<GenericRequestParameters, "search">): Promise<(GenericTeam & {
18
+ /** Returns all teams: https://umami.is/docs/api/teams#get-apiteams (TODO UNTESTED) */
19
+ function get(this: API, parameters?: Omit<GenericRequestParameters, "search">): Promise<(GenericTeam & {
20
20
  members: TeamMember[];
21
21
  _count: {
22
22
  websites: number;
23
23
  members: number;
24
24
  };
25
25
  })[]>;
26
- /** Creates a team: https://umami.is/docs/api/teams-api#post-apiteams (TODO UNTESTED) */
27
- function createTeam(this: API, name: string): Promise<[GenericTeam, Omit<TeamMember, "user">]>;
28
- /** Join a team: https://umami.is/docs/api/teams-api#post-apiteamsjoin (TODO UNTESTED) */
29
- function joinTeam(this: API, accessCode: string): Promise<Omit<TeamMember, "user">>;
30
- /** Get a team: https://umami.is/docs/api/teams-api#get-apiteamsteamid (TODO UNTESTED) */
31
- function getTeam(this: API, teamId: string): Promise<GenericTeam & {
26
+ /** Creates a team: https://umami.is/docs/api/teams#post-apiteams (TODO UNTESTED) */
27
+ function post(this: API, name: string): Promise<[GenericTeam, Omit<TeamMember, "user">]>;
28
+ /** Join a team: https://umami.is/docs/api/teams#post-apiteamsjoin (TODO UNTESTED) */
29
+ function postJoin(this: API, accessCode: string): Promise<Omit<TeamMember, "user">>;
30
+ /** Get a team: https://umami.is/docs/api/teams#get-apiteamsteamid (TODO UNTESTED) */
31
+ function get_TEAMID(this: API, teamId: string): Promise<GenericTeam & {
32
32
  members: Omit<TeamMember, "user">[];
33
33
  }>;
34
- /** Update a team: https://umami.is/docs/api/teams-api#post-apiteamsteamid (TODO UNTESTED) */
35
- function updateTeam(this: API, teamId: string, parameters: {
34
+ /** Update a team: https://umami.is/docs/api/teams#post-apiteamsteamid (TODO UNTESTED) */
35
+ function post_TEAMID(this: API, teamId: string, parameters: {
36
36
  /** The team's name */
37
37
  name?: string;
38
38
  /** The team's access code */
39
39
  accessCode?: string;
40
40
  }): Promise<GenericTeam>;
41
- /** Delete a team: https://umami.is/docs/api/teams-api#delete-apiteamsteamid (TODO UNTESTED) */
42
- function deleteTeam(this: API, teamId: string): Promise<{
43
- ok: boolean;
44
- }>;
45
- /** Get all users that belong to a team: https://umami.is/docs/api/teams-api#get-apiteamsteamidusers (TODO UNTESTED) */
46
- function getTeamUsers(this: API, teamId: string, parameters: GenericRequestParameters): Promise<TeamMember[]>;
47
- /** Add a user to a team: https://umami.is/docs/api/teams-api#post-apiteamsteamidusers (TODO UNTESTED) */
48
- function addTeamUser(this: API, teamId: string, parameters: {
41
+ /** Delete a team: https://umami.is/docs/api/teams#delete-apiteamsteamid (TODO UNTESTED) */
42
+ function delete_TEAMID(this: API, teamId: string): Promise<DeletionResult>;
43
+ /** Get all users that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusers (TODO UNTESTED) */
44
+ function get_TEAMID_Users(this: API, teamId: string, parameters: GenericRequestParameters): Promise<TeamMember[]>;
45
+ /** Add a user to a team: https://umami.is/docs/api/teams#post-apiteamsteamidusers (TODO UNTESTED) */
46
+ function post_TEAMID_Users(this: API, teamId: string, parameters: {
49
47
  /** ID of user to be added */
50
- userId: string;
48
+ userId: Users.User["id"];
51
49
  /** Team role for user */
52
50
  role: TeamRole;
53
51
  }): Promise<Omit<TeamMember, "user">>;
54
- /** Get a user belonging to a team: https://umami.is/docs/api/teams-api#get-apiteamsteamidusersuserid (TODO UNTESTED) */
55
- function getTeamUser(this: API, teamId: string, userId: string): Promise<Omit<TeamMember, "user">>;
56
- /** Update a user's role on a team: https://umami.is/docs/api/teams-api#post-apiteamsteamidusersuserid (TODO UNTESTED) */
57
- function updateTeamUser(this: API, teamId: string, userId: string, role: TeamRole): Promise<Omit<TeamMember, "user">>;
58
- /** Remove a user from a team: https://umami.is/docs/api/teams-api#delete-apiteamsteamidusersuserid (TODO UNTESTED) */
59
- function removeTeamUser(this: API, teamId: string, userId: string): Promise<{
60
- ok: boolean;
61
- }>;
62
- /** Get all websites that belong to a team: https://umami.is/docs/api/teams-api#get-apiteamsteamidwebsites (TODO UNTESTED) */
63
- function getTeamWebsites(this: API, teamId: string, parameters: GenericRequestParameters): Promise<(GenericObject & {
52
+ /** Get a user belonging to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusersuserid (TODO UNTESTED) */
53
+ function get_TEAMID_Users_USERID(this: API, teamId: string, userId: Users.User["id"]): Promise<Omit<TeamMember, "user">>;
54
+ /** Update a user's role on a team: https://umami.is/docs/api/teams#post-apiteamsteamidusersuserid (TODO UNTESTED) */
55
+ function post_TEAMID_Users_USERID(this: API, teamId: string, userId: Users.User["id"], role: TeamRole): Promise<Omit<TeamMember, "user">>;
56
+ /** Remove a user from a team: https://umami.is/docs/api/teams#delete-apiteamsteamidusersuserid (TODO UNTESTED) */
57
+ function delete_TEAMID_Users_USERID(this: API, teamId: string, userId: Users.User["id"]): Promise<DeletionResult>;
58
+ /** Get all websites that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidwebsites (TODO UNTESTED) */
59
+ function get_TEAMID_Websites(this: API, teamId: string, parameters: GenericRequestParameters): Promise<(GenericObject & {
64
60
  name: string;
65
61
  domain: string;
66
62
  shareId: string;
67
63
  resetAt: Date | null;
68
- userId: string | null;
64
+ userId: Users.User["id"] | null;
69
65
  teamId: string | null;
70
66
  createdBy: string;
71
67
  createUser: {
@@ -1,67 +1,67 @@
1
- /** For endpoints listed on: https://umami.is/docs/api/teams-api */
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-api#get-apiteams (TODO UNTESTED) */
5
- async function getTeams(parameters) {
4
+ /** Returns all teams: https://umami.is/docs/api/teams#get-apiteams (TODO UNTESTED) */
5
+ async function get(parameters) {
6
6
  const response = await this.request("get", ["teams"], parameters);
7
7
  return response.data;
8
8
  }
9
- Teams.getTeams = getTeams;
10
- /** Creates a team: https://umami.is/docs/api/teams-api#post-apiteams (TODO UNTESTED) */
11
- async function createTeam(name) {
9
+ Teams.get = get;
10
+ /** Creates a team: https://umami.is/docs/api/teams#post-apiteams (TODO UNTESTED) */
11
+ async function post(name) {
12
12
  return await this.request("post", ["teams"], { name });
13
13
  }
14
- Teams.createTeam = createTeam;
15
- /** Join a team: https://umami.is/docs/api/teams-api#post-apiteamsjoin (TODO UNTESTED) */
16
- async function joinTeam(accessCode) {
14
+ Teams.post = post;
15
+ /** Join a team: https://umami.is/docs/api/teams#post-apiteamsjoin (TODO UNTESTED) */
16
+ async function postJoin(accessCode) {
17
17
  return await this.request("post", ["teams", "join"], { accessCode });
18
18
  }
19
- Teams.joinTeam = joinTeam;
20
- /** Get a team: https://umami.is/docs/api/teams-api#get-apiteamsteamid (TODO UNTESTED) */
21
- async function getTeam(teamId) {
19
+ Teams.postJoin = postJoin;
20
+ /** Get a team: https://umami.is/docs/api/teams#get-apiteamsteamid (TODO UNTESTED) */
21
+ async function get_TEAMID(teamId) {
22
22
  return await this.request("get", ["teams", teamId]);
23
23
  }
24
- Teams.getTeam = getTeam;
25
- /** Update a team: https://umami.is/docs/api/teams-api#post-apiteamsteamid (TODO UNTESTED) */
26
- async function updateTeam(teamId, parameters) {
24
+ Teams.get_TEAMID = get_TEAMID;
25
+ /** Update a team: https://umami.is/docs/api/teams#post-apiteamsteamid (TODO UNTESTED) */
26
+ async function post_TEAMID(teamId, parameters) {
27
27
  return await this.request("post", ["teams", teamId], parameters);
28
28
  }
29
- Teams.updateTeam = updateTeam;
30
- /** Delete a team: https://umami.is/docs/api/teams-api#delete-apiteamsteamid (TODO UNTESTED) */
31
- async function deleteTeam(teamId) {
29
+ Teams.post_TEAMID = post_TEAMID;
30
+ /** Delete a team: https://umami.is/docs/api/teams#delete-apiteamsteamid (TODO UNTESTED) */
31
+ async function delete_TEAMID(teamId) {
32
32
  return await this.request("delete", ["teams", teamId]);
33
33
  }
34
- Teams.deleteTeam = deleteTeam;
35
- /** Get all users that belong to a team: https://umami.is/docs/api/teams-api#get-apiteamsteamidusers (TODO UNTESTED) */
36
- async function getTeamUsers(teamId, parameters) {
34
+ Teams.delete_TEAMID = delete_TEAMID;
35
+ /** Get all users that belong to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusers (TODO UNTESTED) */
36
+ async function get_TEAMID_Users(teamId, parameters) {
37
37
  const response = await this.request("get", ["teams", teamId, "users"], parameters);
38
38
  return response.data;
39
39
  }
40
- Teams.getTeamUsers = getTeamUsers;
41
- /** Add a user to a team: https://umami.is/docs/api/teams-api#post-apiteamsteamidusers (TODO UNTESTED) */
42
- async function addTeamUser(teamId, parameters) {
40
+ Teams.get_TEAMID_Users = get_TEAMID_Users;
41
+ /** Add a user to a team: https://umami.is/docs/api/teams#post-apiteamsteamidusers (TODO UNTESTED) */
42
+ async function post_TEAMID_Users(teamId, parameters) {
43
43
  return await this.request("post", ["teams", teamId, "users"], parameters);
44
44
  }
45
- Teams.addTeamUser = addTeamUser;
46
- /** Get a user belonging to a team: https://umami.is/docs/api/teams-api#get-apiteamsteamidusersuserid (TODO UNTESTED) */
47
- async function getTeamUser(teamId, userId) {
45
+ Teams.post_TEAMID_Users = post_TEAMID_Users;
46
+ /** Get a user belonging to a team: https://umami.is/docs/api/teams#get-apiteamsteamidusersuserid (TODO UNTESTED) */
47
+ async function get_TEAMID_Users_USERID(teamId, userId) {
48
48
  return await this.request("get", ["teams", teamId, "users", userId]);
49
49
  }
50
- Teams.getTeamUser = getTeamUser;
51
- /** Update a user's role on a team: https://umami.is/docs/api/teams-api#post-apiteamsteamidusersuserid (TODO UNTESTED) */
52
- async function updateTeamUser(teamId, userId, role) {
50
+ 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 (TODO UNTESTED) */
52
+ async function post_TEAMID_Users_USERID(teamId, userId, role) {
53
53
  return await this.request("post", ["teams", teamId, "users", userId], { role });
54
54
  }
55
- Teams.updateTeamUser = updateTeamUser;
56
- /** Remove a user from a team: https://umami.is/docs/api/teams-api#delete-apiteamsteamidusersuserid (TODO UNTESTED) */
57
- async function removeTeamUser(teamId, userId) {
55
+ Teams.post_TEAMID_Users_USERID = post_TEAMID_Users_USERID;
56
+ /** Remove a user from a team: https://umami.is/docs/api/teams#delete-apiteamsteamidusersuserid (TODO UNTESTED) */
57
+ async function delete_TEAMID_Users_USERID(teamId, userId) {
58
58
  return await this.request("delete", ["teams", teamId, "users", userId]);
59
59
  }
60
- Teams.removeTeamUser = removeTeamUser;
61
- /** Get all websites that belong to a team: https://umami.is/docs/api/teams-api#get-apiteamsteamidwebsites (TODO UNTESTED) */
62
- async function getTeamWebsites(teamId, parameters) {
60
+ 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 (TODO UNTESTED) */
62
+ async function get_TEAMID_Websites(teamId, parameters) {
63
63
  const response = await this.request("get", ["teams", teamId, "websites"], parameters);
64
64
  return response.data;
65
65
  }
66
- Teams.getTeamWebsites = getTeamWebsites;
66
+ Teams.get_TEAMID_Websites = get_TEAMID_Websites;
67
67
  })(Teams || (Teams = {}));
@@ -1,11 +1,24 @@
1
- import { API, GenericObject, GenericRequestParameters, MinimalUser, Role, TeamRole, Website } from "../index.js";
2
- /** For endpoints listed on: https://umami.is/docs/api/users-api */
1
+ import { API, DeletionResult, GenericObject, GenericRequestParameters, TeamRole, Website } from "../index.js";
2
+ /** Operations around User management: https://umami.is/docs/api/users */
3
3
  export declare namespace Users {
4
- interface GenericUser extends MinimalUser {
4
+ type Role = "admin" | "user" | "view-only";
5
+ interface MinimalUser {
6
+ id: string;
7
+ username: string;
8
+ }
9
+ interface MinimalUserWithRole extends MinimalUser {
5
10
  role: Role;
6
11
  }
7
- /** Creates a user: https://umami.is/docs/api/users-api#post-apiusers */
8
- function createUser(this: API, parameters: {
12
+ interface MinimalUserWithCreatedAt extends MinimalUserWithRole {
13
+ createdAt: Date;
14
+ }
15
+ interface MinimalUserWithRoleCreatedAt extends MinimalUserWithRole, MinimalUserWithCreatedAt {
16
+ }
17
+ interface User extends MinimalUserWithCreatedAt {
18
+ isAdmin: boolean;
19
+ }
20
+ /** Creates a user: https://umami.is/docs/api/users#post-apiusers */
21
+ function post(this: API, parameters: {
9
22
  /** The user's username */
10
23
  username: string;
11
24
  /** The user's password */
@@ -14,45 +27,36 @@ export declare namespace Users {
14
27
  role: Role;
15
28
  /** Force a UUID assignment to the user */
16
29
  id?: string;
17
- }): Promise<GenericUser>;
18
- /** Gets a user by ID: https://umami.is/docs/api/users-api#get-apiusersuserid */
19
- function getUser(this: API, id: string): Promise<GenericUser & {
20
- createdAt: Date;
21
- }>;
22
- /** Updates a user: https://umami.is/docs/api/users-api#post-apiusersuserid */
23
- function updateUser(this: API, id: string, parameters?: {
30
+ }): Promise<MinimalUserWithRole>;
31
+ /** Gets a user by ID: https://umami.is/docs/api/users#get-apiusersuserid */
32
+ function get_USERID(this: API, userId: User["id"]): Promise<MinimalUserWithRoleCreatedAt>;
33
+ /** Updates a user: https://umami.is/docs/api/users#post-apiusersuserid */
34
+ function post_USERID(this: API, userId: User["id"], parameters?: {
24
35
  /** The user's username */
25
36
  username?: string;
26
37
  /** The user's password */
27
38
  password?: string;
28
39
  /** The user's role */
29
40
  role?: Role;
30
- }): Promise<GenericUser & {
31
- createdAt: Date;
32
- }>;
33
- /** Deletes a user: https://umami.is/docs/api/users-api#delete-apiusersuserid */
34
- function deleteUser(this: API, id: string): Promise<{
35
- ok: boolean;
36
- }>;
37
- /** Gets all websites that belong to a user: https://umami.is/docs/api/users-api#get-apiusersuseridwebsites */
38
- function getUserWebsites(this: API, id: string, parameters: GenericRequestParameters & {
39
- includeTeams: boolean;
41
+ }): Promise<MinimalUserWithRoleCreatedAt>;
42
+ /** Deletes a user: https://umami.is/docs/api/users#delete-apiusersuserid */
43
+ function delete_USERID(this: API, userId: User["id"]): Promise<DeletionResult>;
44
+ /** Gets all websites that belong to a user: https://umami.is/docs/api/users#get-apiusersuseridwebsites */
45
+ function get_USERID_Websites(this: API, userId: User["id"], parameters?: GenericRequestParameters & {
46
+ includeTeams?: boolean;
40
47
  }): Promise<(Website & {
41
48
  user: MinimalUser;
42
49
  })[]>;
43
- /** Gets all teams that belong to a user: https://umami.is/docs/api/users-api#get-apiusersuseridteams */
44
- function getUserTeams(this: API, id: string, parameters?: Omit<GenericRequestParameters, "search">): Promise<(GenericObject & {
50
+ /** 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<(GenericObject & {
45
52
  name: string;
46
53
  accessCode: string;
47
54
  logoUrl: string | null;
48
55
  members: Omit<GenericObject, "deletedAt"> & {
49
56
  teamId: string;
50
- userId: string;
57
+ userId: User["id"];
51
58
  role: TeamRole;
52
- user: {
53
- id: string;
54
- username: string;
55
- };
59
+ user: MinimalUser;
56
60
  }[];
57
61
  _count: {
58
62
  websites: number;