@@ -36,33 +36,13 @@ export const httpClientActions = {
3636
3737 accessInfoGet ( options ?: AxiosRequestConfig ) {
3838 return this . get < {
39- result : {
40- default_source : string ,
41- available_sources : string [ ]
42- }
39+ result : Moonraker . Authorization . InfoResponse
4340 } > ( '/access/info' , options )
4441 } ,
4542
46- accessRefreshJwtPost ( refresh_token : string , options ?: AxiosRequestConfig ) {
47- return this . post < {
48- result : {
49- username : string ,
50- token : string ,
51- action : 'user_jwt_refresh' ,
52- source : string
53- }
54- } > ( '/access/refresh_jwt' , { refresh_token } , options )
55- } ,
56-
5743 accessLoginPost ( username : string , password : string , source : string = 'moonraker' , options ?: AxiosRequestConfig ) {
5844 return this . post < {
59- result : {
60- username : string ,
61- token : string ,
62- refresh_token : string ,
63- action : 'user_logged_in' ,
64- source : string
65- }
45+ result : Moonraker . Authorization . LoginResponse
6646 } > ( '/access/login' , {
6747 username,
6848 password,
@@ -72,109 +52,31 @@ export const httpClientActions = {
7252
7353 accessLogoutPost ( options ?: AxiosRequestConfig ) {
7454 return this . post < {
75- result : {
76- username : string ,
77- action : 'user_logged_out'
78- }
55+ result : Moonraker . Authorization . LogoutResponse
7956 } > ( 'access/logout' , undefined , options )
8057 } ,
8158
8259 accessOneshotTokenGet ( options ?: AxiosRequestConfig ) {
8360 return this . get < {
84- result : string
61+ result : Moonraker . StringResponse
8562 } > ( '/access/oneshot_token' , options )
8663 } ,
8764
8865 accessCurrentUserGet ( options ?: AxiosRequestConfig ) {
8966 return this . get < {
90- result : {
91- username : string ,
92- source : string ,
93- created_on : number
94- }
67+ result : Moonraker . Authorization . GetUserResponse
9568 } > ( '/access/user' , options )
9669 } ,
9770
98- accessUsersListGet ( options ?: AxiosRequestConfig ) {
99- return this . get < {
100- result : {
101- users : Array < {
102- username : string ,
103- source : string ,
104- created_on : number
105- } >
106- }
107- } > ( '/access/users/list' , options )
108- } ,
109-
110- accessUserPost ( username : string , password : string , options ?: AxiosRequestConfig ) {
111- return this . post < {
112- result : {
113- username : string ,
114- token : string ,
115- refresh_token : string ,
116- action : 'user_created' ,
117- source : 'moonraker'
118- }
119- } > ( '/access/user' , {
120- username,
121- password
122- } , options )
123- } ,
124-
125- accessUserDelete ( username : string , options ?: AxiosRequestConfig ) {
126- return this . delete < {
127- result : {
128- username : string ,
129- action : 'user_deleted'
130- }
131- } > ( '/access/user' , {
132- ...options ,
133- params : { username }
134- } )
135- } ,
136-
137- accessUserPasswordPost ( password : string , new_password : string , options ?: AxiosRequestConfig ) {
138- return this . post < {
139- result : {
140- username : string ,
141- action : 'user_password_reset'
142- }
143- } > ( '/access/user/password' , {
144- password,
145- new_password
146- } , options )
147- } ,
148-
149- accessApiKeyGet ( options ?: AxiosRequestConfig ) {
71+ serverDatabaseItemGet < T = unknown > ( namespace : string , key ?: string , options ?: AxiosRequestConfig ) {
15072 return this . get < {
151- result : string
152- } > ( '/access/api_key' , options )
153- } ,
154-
155- accessApiKeyPost ( options ?: AxiosRequestConfig ) {
156- return this . post < {
157- result : string
158- } > ( '/access/api_key' , undefined , options )
159- } ,
160-
161- serverDatabaseItemGet < T = unknown > ( namespace : string , options ?: AxiosRequestConfig ) {
162- return this . get < {
163- result : {
164- namespace : string ,
165- key : string ,
166- value : T
167- }
168- } > ( `/server/database/item?namespace=${ namespace } ` , options )
73+ result : Moonraker . Database . GetItemResponse < T >
74+ } > ( `/server/database/item?namespace=${ namespace } &key=${ key } ` , options )
16975 } ,
17076
17177 serverDatabaseItemPost < T = unknown > ( namespace : string , key : string , value : T , options ?: AxiosRequestConfig ) {
17278 return this . post < {
173- result : {
174- namespace : string ,
175- key : string ,
176- value : T
177- }
79+ result : Moonraker . Database . PostItemResponse < T >
17880 } > ( '/server/database/item' , {
17981 namespace,
18082 key,
@@ -184,11 +86,7 @@ export const httpClientActions = {
18486
18587 serverDatabaseItemDelete < T = unknown > ( namespace : string , key : string , options ?: AxiosRequestConfig ) {
18688 return this . delete < {
187- result : {
188- namespace : string ,
189- key : string ,
190- value : T
191- }
89+ result : Moonraker . Database . DeleteItemResponse < T >
19290 } > ( `/server/database/item?namespace=${ namespace } &key=${ key } ` , options )
19391 } ,
19492
0 commit comments