|
1 | 1 | import datetime |
2 | 2 | import json |
| 3 | +import warnings |
3 | 4 | from typing import Any, Callable, Dict, Iterable, List, Union |
4 | 5 | from urllib.parse import urlparse |
5 | 6 | from urllib.request import Request, urlopen |
@@ -116,10 +117,26 @@ def set_guest_user(self, guest_user: Dict) -> StreamResponse: |
116 | 117 | return self.post("guest", data=dict(user=guest_user)) |
117 | 118 |
|
118 | 119 | def update_users(self, users: List[Dict]) -> StreamResponse: |
119 | | - return self.post("users", data={"users": {u["id"]: u for u in users}}) |
| 120 | + warnings.warn( |
| 121 | + "This method is deprecated. Use upsert_users instead.", |
| 122 | + DeprecationWarning, |
| 123 | + stacklevel=2, |
| 124 | + ) |
| 125 | + return self.upsert_users(users) |
120 | 126 |
|
121 | 127 | def update_user(self, user: Dict) -> StreamResponse: |
122 | | - return self.update_users([user]) |
| 128 | + warnings.warn( |
| 129 | + "This method is deprecated. Use upsert_user instead.", |
| 130 | + DeprecationWarning, |
| 131 | + stacklevel=2, |
| 132 | + ) |
| 133 | + return self.upsert_user(user) |
| 134 | + |
| 135 | + def upsert_users(self, users: List[Dict]) -> StreamResponse: |
| 136 | + return self.post("users", data={"users": {u["id"]: u for u in users}}) |
| 137 | + |
| 138 | + def upsert_user(self, user: Dict) -> StreamResponse: |
| 139 | + return self.upsert_users([user]) |
123 | 140 |
|
124 | 141 | def update_users_partial(self, updates: List[Dict]) -> StreamResponse: |
125 | 142 | return self.patch("users", data={"users": updates}) |
|
0 commit comments