Skip to content

Commit d568c46

Browse files
authored
Merge pull request #50 from FusionAuth/wied03/ENG-2750/develop_merge_org_admin
Merge wied03/ENG-2750/develop_merge_org_admin
2 parents c9ca41d + a9562cd commit d568c46

File tree

3 files changed

+68
-50
lines changed

3 files changed

+68
-50
lines changed

build.savant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* language governing permissions and limitations under the License.
1515
*/
1616

17-
project(group: "io.fusionauth", name: "fusionauth-python-client", version: "1.58.0", licenses: ["ApacheV2_0"]) {
17+
project(group: "io.fusionauth", name: "fusionauth-python-client", version: "1.59.0", licenses: ["ApacheV2_0"]) {
1818
workflow {
1919
fetch {
2020
cache()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="fusionauth-client",
8-
version="1.58.0",
8+
version="1.59.0",
99
author="FusionAuth",
1010
author_email="[email protected]",
1111
description="A client library for FusionAuth",

src/main/python/fusionauth/fusionauth_client.py

Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018-2023, FusionAuth, All Rights Reserved
2+
# Copyright (c) 2018-2025, FusionAuth, All Rights Reserved
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -129,6 +129,7 @@ def change_password(self, change_password_id, request):
129129
.post() \
130130
.go()
131131

132+
@deprecated("This method has been renamed to change_password_using_jwt, use that method instead.")
132133
def change_password_by_jwt(self, encoded_jwt, request):
133134
"""
134135
Changes a user's password using their access token (JWT) instead of the changePasswordId
@@ -160,6 +161,23 @@ def change_password_by_identity(self, request):
160161
.post() \
161162
.go()
162163

164+
def change_password_using_jwt(self, encoded_jwt, request):
165+
"""
166+
Changes a user's password using their access token (JWT) instead of the changePasswordId
167+
A common use case for this method will be if you want to allow the user to change their own password.
168+
169+
Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
170+
171+
Attributes:
172+
encoded_jwt: The encoded JWT (access token).
173+
request: The change password request that contains all the information used to change the password.
174+
"""
175+
return self.start_anonymous().uri('/api/user/change-password') \
176+
.authorization("Bearer " + encoded_jwt) \
177+
.body_handler(JSONBodyHandler(request)) \
178+
.post() \
179+
.go()
180+
163181
def check_change_password_using_id(self, change_password_id):
164182
"""
165183
Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
@@ -760,7 +778,7 @@ def deactivate_user_action(self, user_action_id):
760778
@deprecated("This method has been renamed to deactivate_users_by_ids, use that method instead.")
761779
def deactivate_users(self, user_ids):
762780
"""
763-
Deactivates the users with the given ids.
781+
Deactivates the users with the given Ids.
764782
765783
Attributes:
766784
user_ids: The ids of the users to deactivate.
@@ -774,7 +792,7 @@ def deactivate_users(self, user_ids):
774792

775793
def deactivate_users_by_ids(self, user_ids):
776794
"""
777-
Deactivates the users with the given ids.
795+
Deactivates the users with the given Ids.
778796
779797
Attributes:
780798
user_ids: The ids of the users to deactivate.
@@ -1217,8 +1235,8 @@ def delete_user_with_request(self, user_id, request):
12171235
@deprecated("This method has been renamed to delete_users_by_query, use that method instead.")
12181236
def delete_users(self, request):
12191237
"""
1220-
Deletes the users with the given ids, or users matching the provided JSON query or queryString.
1221-
The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.
1238+
Deletes the users with the given Ids, or users matching the provided JSON query or queryString.
1239+
The order of preference is Ids, query and then queryString, it is recommended to only provide one of the three for the request.
12221240
12231241
This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body.
12241242
Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.
@@ -1233,8 +1251,8 @@ def delete_users(self, request):
12331251

12341252
def delete_users_by_query(self, request):
12351253
"""
1236-
Deletes the users with the given ids, or users matching the provided JSON query or queryString.
1237-
The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.
1254+
Deletes the users with the given Ids, or users matching the provided JSON query or queryString.
1255+
The order of preference is Ids, query and then queryString, it is recommended to only provide one of the three for the request.
12381256
12391257
This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body.
12401258
Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.
@@ -1756,7 +1774,7 @@ def modify_action(self, action_id, request):
17561774
action.
17571775
17581776
Attributes:
1759-
action_id: The Id of the action to modify. This is technically the user action log id.
1777+
action_id: The Id of the action to modify. This is technically the user action log Id.
17601778
request: The request that contains all the information about the modification.
17611779
"""
17621780
return self.start().uri('/api/user/action') \
@@ -1779,16 +1797,16 @@ def passwordless_login(self, request):
17791797

17801798
def patch_api_key(self, key_id, request):
17811799
"""
1782-
Updates an authentication API key by given id
1800+
Updates an API key with the given Id.
17831801
17841802
Attributes:
1785-
key_id: The Id of the authentication key. If not provided a secure random api key will be generated.
1786-
request: The request object that contains all the information needed to create the APIKey.
1803+
key_id: The Id of the API key. If not provided a secure random api key will be generated.
1804+
request: The request object that contains all the information needed to create the API key.
17871805
"""
17881806
return self.start().uri('/api/api-key') \
17891807
.url_segment(key_id) \
17901808
.body_handler(JSONBodyHandler(request)) \
1791-
.post() \
1809+
.patch() \
17921810
.go()
17931811

17941812
def patch_application(self, application_id, request):
@@ -2297,7 +2315,7 @@ def reindex(self, request):
22972315

22982316
def remove_user_from_family(self, family_id, user_id):
22992317
"""
2300-
Removes a user from the family with the given id.
2318+
Removes a user from the family with the given Id.
23012319
23022320
Attributes:
23032321
family_id: The Id of the family to remove the user from.
@@ -2352,7 +2370,7 @@ def resend_registration_verification(self, email, application_id):
23522370

23532371
def retrieve_api_key(self, key_id):
23542372
"""
2355-
Retrieves an authentication API key for the given id
2373+
Retrieves an authentication API key for the given Id.
23562374
23572375
Attributes:
23582376
key_id: The Id of the API key to retrieve.
@@ -2419,7 +2437,7 @@ def retrieve_application(self, application_id=None):
24192437
Retrieves the application for the given Id or all the applications if the Id is null.
24202438
24212439
Attributes:
2422-
application_id: (Optional) The application id.
2440+
application_id: (Optional) The application Id.
24232441
"""
24242442
return self.start().uri('/api/application') \
24252443
.url_segment(application_id) \
@@ -2494,11 +2512,11 @@ def retrieve_consents(self):
24942512

24952513
def retrieve_daily_active_report(self, start, end, application_id=None):
24962514
"""
2497-
Retrieves the daily active user report between the two instants. If you specify an application id, it will only
2515+
Retrieves the daily active user report between the two instants. If you specify an application Id, it will only
24982516
return the daily active counts for that application.
24992517
25002518
Attributes:
2501-
application_id: (Optional) The application id.
2519+
application_id: (Optional) The application Id.
25022520
start: The start instant as UTC milliseconds since Epoch.
25032521
end: The end instant as UTC milliseconds since Epoch.
25042522
"""
@@ -2511,7 +2529,7 @@ def retrieve_daily_active_report(self, start, end, application_id=None):
25112529

25122530
def retrieve_email_template(self, email_template_id=None):
25132531
"""
2514-
Retrieves the email template for the given Id. If you don't specify the id, this will return all the email templates.
2532+
Retrieves the email template for the given Id. If you don't specify the Id, this will return all the email templates.
25152533
25162534
Attributes:
25172535
email_template_id: (Optional) The Id of the email template.
@@ -2894,11 +2912,11 @@ def retrieve_lambdas_by_type(self, _type):
28942912

28952913
def retrieve_login_report(self, start, end, application_id=None):
28962914
"""
2897-
Retrieves the login report between the two instants. If you specify an application id, it will only return the
2915+
Retrieves the login report between the two instants. If you specify an application Id, it will only return the
28982916
login counts for that application.
28992917
29002918
Attributes:
2901-
application_id: (Optional) The application id.
2919+
application_id: (Optional) The application Id.
29022920
start: The start instant as UTC milliseconds since Epoch.
29032921
end: The end instant as UTC milliseconds since Epoch.
29042922
"""
@@ -2911,7 +2929,7 @@ def retrieve_login_report(self, start, end, application_id=None):
29112929

29122930
def retrieve_message_template(self, message_template_id=None):
29132931
"""
2914-
Retrieves the message template for the given Id. If you don't specify the id, this will return all the message templates.
2932+
Retrieves the message template for the given Id. If you don't specify the Id, this will return all the message templates.
29152933
29162934
Attributes:
29172935
message_template_id: (Optional) The Id of the message template.
@@ -2967,11 +2985,11 @@ def retrieve_messengers(self):
29672985

29682986
def retrieve_monthly_active_report(self, start, end, application_id=None):
29692987
"""
2970-
Retrieves the monthly active user report between the two instants. If you specify an application id, it will only
2988+
Retrieves the monthly active user report between the two instants. If you specify an application Id, it will only
29712989
return the monthly active counts for that application.
29722990
29732991
Attributes:
2974-
application_id: (Optional) The application id.
2992+
application_id: (Optional) The application Id.
29752993
start: The start instant as UTC milliseconds since Epoch.
29762994
end: The end instant as UTC milliseconds since Epoch.
29772995
"""
@@ -3133,7 +3151,7 @@ def retrieve_refresh_tokens(self, user_id):
31333151

31343152
def retrieve_registration(self, user_id, application_id):
31353153
"""
3136-
Retrieves the user registration for the user with the given Id and the given application id.
3154+
Retrieves the user registration for the user with the given Id and the given application Id.
31373155
31383156
Attributes:
31393157
user_id: The Id of the user.
@@ -3147,11 +3165,11 @@ def retrieve_registration(self, user_id, application_id):
31473165

31483166
def retrieve_registration_report(self, start, end, application_id=None):
31493167
"""
3150-
Retrieves the registration report between the two instants. If you specify an application id, it will only return
3168+
Retrieves the registration report between the two instants. If you specify an application Id, it will only return
31513169
the registration counts for that application.
31523170
31533171
Attributes:
3154-
application_id: (Optional) The application id.
3172+
application_id: (Optional) The application Id.
31553173
start: The start instant as UTC milliseconds since Epoch.
31563174
end: The end instant as UTC milliseconds since Epoch.
31573175
"""
@@ -3313,7 +3331,7 @@ def retrieve_user(self, user_id):
33133331

33143332
def retrieve_user_action(self, user_action_id=None):
33153333
"""
3316-
Retrieves the user action for the given Id. If you pass in null for the id, this will return all the user
3334+
Retrieves the user action for the given Id. If you pass in null for the Id, this will return all the user
33173335
actions.
33183336
33193337
Attributes:
@@ -3326,7 +3344,7 @@ def retrieve_user_action(self, user_action_id=None):
33263344

33273345
def retrieve_user_action_reason(self, user_action_reason_id=None):
33283346
"""
3329-
Retrieves the user action reason for the given Id. If you pass in null for the id, this will return all the user
3347+
Retrieves the user action reason for the given Id. If you pass in null for the Id, this will return all the user
33303348
action reasons.
33313349
33323350
Attributes:
@@ -3440,8 +3458,8 @@ def retrieve_user_code(self, client_id, client_secret, user_code):
34403458
This API is useful if you want to build your own login workflow to complete a device grant.
34413459
34423460
Attributes:
3443-
client_id: The client id.
3444-
client_secret: The client id.
3461+
client_id: The client Id.
3462+
client_secret: The client Id.
34453463
user_code: The end-user verification code.
34463464
"""
34473465
body = {
@@ -3553,12 +3571,12 @@ def retrieve_user_links_by_user_id(self, user_id, identity_provider_id=None):
35533571

35543572
def retrieve_user_login_report(self, user_id, start, end, application_id=None):
35553573
"""
3556-
Retrieves the login report between the two instants for a particular user by Id. If you specify an application id, it will only return the
3574+
Retrieves the login report between the two instants for a particular user by Id. If you specify an application Id, it will only return the
35573575
login counts for that application.
35583576
35593577
Attributes:
3560-
application_id: (Optional) The application id.
3561-
user_id: The userId id.
3578+
application_id: (Optional) The application Id.
3579+
user_id: The userId Id.
35623580
start: The start instant as UTC milliseconds since Epoch.
35633581
end: The end instant as UTC milliseconds since Epoch.
35643582
"""
@@ -3572,12 +3590,12 @@ def retrieve_user_login_report(self, user_id, start, end, application_id=None):
35723590

35733591
def retrieve_user_login_report_by_login_id(self, login_id, start, end, application_id=None):
35743592
"""
3575-
Retrieves the login report between the two instants for a particular user by login Id. If you specify an application id, it will only return the
3593+
Retrieves the login report between the two instants for a particular user by login Id. If you specify an application Id, it will only return the
35763594
login counts for that application.
35773595
35783596
Attributes:
3579-
application_id: (Optional) The application id.
3580-
login_id: The userId id.
3597+
application_id: (Optional) The application Id.
3598+
login_id: The userId Id.
35813599
start: The start instant as UTC milliseconds since Epoch.
35823600
end: The end instant as UTC milliseconds since Epoch.
35833601
"""
@@ -3674,7 +3692,7 @@ def retrieve_web_authn_credentials_for_user(self, user_id):
36743692

36753693
def retrieve_webhook(self, webhook_id=None):
36763694
"""
3677-
Retrieves the webhook for the given Id. If you pass in null for the id, this will return all the webhooks.
3695+
Retrieves the webhook for the given Id. If you pass in null for the Id, this will return all the webhooks.
36783696
36793697
Attributes:
36803698
webhook_id: (Optional) The Id of the webhook.
@@ -3906,7 +3924,7 @@ def search_entities(self, request):
39063924

39073925
def search_entities_by_ids(self, ids):
39083926
"""
3909-
Retrieves the entities for the given ids. If any Id is invalid, it is ignored.
3927+
Retrieves the entities for the given Ids. If any Id is invalid, it is ignored.
39103928
39113929
Attributes:
39123930
ids: The entity ids to search for.
@@ -4075,7 +4093,7 @@ def search_user_comments(self, request):
40754093
@deprecated("This method has been renamed to search_users_by_ids, use that method instead.")
40764094
def search_users(self, ids):
40774095
"""
4078-
Retrieves the users for the given ids. If any Id is invalid, it is ignored.
4096+
Retrieves the users for the given Ids. If any Id is invalid, it is ignored.
40794097
40804098
Attributes:
40814099
ids: The user ids to search for.
@@ -4087,10 +4105,10 @@ def search_users(self, ids):
40874105

40884106
def search_users_by_ids(self, ids):
40894107
"""
4090-
Retrieves the users for the given ids. If any Id is invalid, it is ignored.
4108+
Retrieves the users for the given Ids. If any Id is invalid, it is ignored.
40914109
40924110
Attributes:
4093-
ids: The user ids to search for.
4111+
ids: The user Ids to search for.
40944112
"""
40954113
return self.start().uri('/api/user/search') \
40964114
.url_parameter('ids', self.convert_true_false(ids)) \
@@ -4150,7 +4168,7 @@ def search_webhooks(self, request):
41504168

41514169
def send_email(self, email_template_id, request):
41524170
"""
4153-
Send an email using an email template id. You can optionally provide <code>requestData</code> to access key value
4171+
Send an email using an email template Id. You can optionally provide <code>requestData</code> to access key value
41544172
pairs in the email template.
41554173
41564174
Attributes:
@@ -4343,16 +4361,16 @@ def two_factor_login(self, request):
43434361
.post() \
43444362
.go()
43454363

4346-
def update_api_key(self, api_key_id, request):
4364+
def update_api_key(self, key_id, request):
43474365
"""
4348-
Updates an API key by given id
4366+
Updates an API key with the given Id.
43494367
43504368
Attributes:
4351-
api_key_id: The Id of the API key to update.
4352-
request: The request object that contains all the information used to create the API Key.
4369+
key_id: The Id of the API key to update.
4370+
request: The request that contains all the new API key information.
43534371
"""
43544372
return self.start().uri('/api/api-key') \
4355-
.url_segment(api_key_id) \
4373+
.url_segment(key_id) \
43564374
.body_handler(JSONBodyHandler(request)) \
43574375
.put() \
43584376
.go()
@@ -4802,7 +4820,7 @@ def validate_device(self, user_code, client_id):
48024820
48034821
Attributes:
48044822
user_code: The end-user verification code.
4805-
client_id: The client id.
4823+
client_id: The client Id.
48064824
"""
48074825
return self.start_anonymous().uri('/oauth2/device/validate') \
48084826
.url_parameter('user_code', self.convert_true_false(user_code)) \

0 commit comments

Comments
 (0)