Debian Codegraph @

src/auth0/management/stats/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4
5 from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6 from ..core.request_options import RequestOptions
7 from ..types.daily_stats import DailyStats
8 from ..types.get_active_users_count_stats_response_content import GetActiveUsersCountStatsResponseContent
9 from .raw_client import AsyncRawStatsClient, RawStatsClient
10
11
12 class StatsClient:
13 def __init__(self, *, client_wrapper: SyncClientWrapper):
14 self._raw_client = RawStatsClient(client_wrapper=client_wrapper)
15
16 @property
17 def with_raw_response(self) -> RawStatsClient:
18 """
19 Retrieves a raw implementation of this client that returns raw responses.
20
21 Returns
22 -------
23 RawStatsClient
24 """
25 return self._raw_client
26
27 def get_active_users_count(
28 self, *, request_options: typing.Optional[RequestOptions] = None
29 ) -> GetActiveUsersCountStatsResponseContent:
30 """
31 Retrieve the number of active users that logged in during the last 30 days.
32
33 Parameters
34 ----------
35 request_options : typing.Optional[RequestOptions]
36 Request-specific configuration.
37
38 Returns
39 -------
40 GetActiveUsersCountStatsResponseContent
41 Number of active users successfully retrieved.
42
43 Examples
44 --------
45 from auth0 import Auth0
46
47 client = Auth0(
48 token="YOUR_TOKEN",
49 )
50 client.stats.get_active_users_count()
51 """
52 _response = self._raw_client.get_active_users_count(request_options=request_options)
53 return _response.data
54
55 def get_daily(
56 self,
57 *,
58 from_: typing.Optional[str] = None,
59 to: typing.Optional[str] = None,
60 request_options: typing.Optional[RequestOptions] = None,
61 ) -> typing.List[DailyStats]:
62 """
63 Retrieve the number of logins, signups and breached-password detections (subscription required) that occurred each day within a specified date range.
64
65 Parameters
66 ----------
67 from_ : typing.Optional[str]
68 Optional first day of the date range (inclusive) in YYYYMMDD format.
69
70 to : typing.Optional[str]
71 Optional last day of the date range (inclusive) in YYYYMMDD format.
72
73 request_options : typing.Optional[RequestOptions]
74 Request-specific configuration.
75
76 Returns
77 -------
78 typing.List[DailyStats]
79 Daily stats successfully retrieved.
80
81 Examples
82 --------
83 from auth0 import Auth0
84
85 client = Auth0(
86 token="YOUR_TOKEN",
87 )
88 client.stats.get_daily(
89 from_="from",
90 to="to",
91 )
92 """
93 _response = self._raw_client.get_daily(from_=from_, to=to, request_options=request_options)
94 return _response.data
95
96
97 class AsyncStatsClient:
98 def __init__(self, *, client_wrapper: AsyncClientWrapper):
99 self._raw_client = AsyncRawStatsClient(client_wrapper=client_wrapper)
100
101 @property
102 def with_raw_response(self) -> AsyncRawStatsClient:
103 """
104 Retrieves a raw implementation of this client that returns raw responses.
105
106 Returns
107 -------
108 AsyncRawStatsClient
109 """
110 return self._raw_client
111
112 async def get_active_users_count(
113 self, *, request_options: typing.Optional[RequestOptions] = None
114 ) -> GetActiveUsersCountStatsResponseContent:
115 """
116 Retrieve the number of active users that logged in during the last 30 days.
117
118 Parameters
119 ----------
120 request_options : typing.Optional[RequestOptions]
121 Request-specific configuration.
122
123 Returns
124 -------
125 GetActiveUsersCountStatsResponseContent
126 Number of active users successfully retrieved.
127
128 Examples
129 --------
130 import asyncio
131
132 from auth0 import AsyncAuth0
133
134 client = AsyncAuth0(
135 token="YOUR_TOKEN",
136 )
137
138
139 async def main() -> None:
140 await client.stats.get_active_users_count()
141
142
143 asyncio.run(main())
144 """
145 _response = await self._raw_client.get_active_users_count(request_options=request_options)
146 return _response.data
147
148 async def get_daily(
149 self,
150 *,
151 from_: typing.Optional[str] = None,
152 to: typing.Optional[str] = None,
153 request_options: typing.Optional[RequestOptions] = None,
154 ) -> typing.List[DailyStats]:
155 """
156 Retrieve the number of logins, signups and breached-password detections (subscription required) that occurred each day within a specified date range.
157
158 Parameters
159 ----------
160 from_ : typing.Optional[str]
161 Optional first day of the date range (inclusive) in YYYYMMDD format.
162
163 to : typing.Optional[str]
164 Optional last day of the date range (inclusive) in YYYYMMDD format.
165
166 request_options : typing.Optional[RequestOptions]
167 Request-specific configuration.
168
169 Returns
170 -------
171 typing.List[DailyStats]
172 Daily stats successfully retrieved.
173
174 Examples
175 --------
176 import asyncio
177
178 from auth0 import AsyncAuth0
179
180 client = AsyncAuth0(
181 token="YOUR_TOKEN",
182 )
183
184
185 async def main() -> None:
186 await client.stats.get_daily(
187 from_="from",
188 to="to",
189 )
190
191
192 asyncio.run(main())
193 """
194 _response = await self._raw_client.get_daily(from_=from_, to=to, request_options=request_options)
195 return _response.data