From 901364cd1c07003292da90c7d9c253d4622e818a Mon Sep 17 00:00:00 2001 From: stanleyphu Date: Tue, 7 Nov 2023 18:06:47 -0800 Subject: [PATCH] Rename WarrantObject to Object --- test/test_live.py | 26 +++++++++---------- warrant/__init__.py | 2 +- warrant/feature.py | 14 +++++------ warrant/{warrant_object.py => object.py} | 32 ++++++++++++------------ warrant/permission.py | 14 +++++------ warrant/pricing_tier.py | 14 +++++------ warrant/role.py | 14 +++++------ warrant/tenant.py | 18 ++++++------- warrant/user.py | 18 ++++++------- 9 files changed, 76 insertions(+), 76 deletions(-) rename warrant/{warrant_object.py => object.py} (69%) diff --git a/test/test_live.py b/test/test_live.py index b173dc6..3526cde 100644 --- a/test/test_live.py +++ b/test/test_live.py @@ -221,46 +221,46 @@ def test_crud_features(self): self.assertEqual(len(features_list.results), 0) def test_crud_objects(self): - object1 = warrant.WarrantObject.create("document") + object1 = warrant.Object.create("document") self.assertEqual(object1.object_type, "document") self.assertIsNotNone(object1.object_id) self.assertEqual(object1.meta, {}) - object2 = warrant.WarrantObject.create("folder", "planning") - refetched_object = warrant.WarrantObject.get(object2.object_type, object2.object_id, {"Warrant-Token": "latest"}) + object2 = warrant.Object.create("folder", "planning") + refetched_object = warrant.Object.get(object2.object_type, object2.object_id, {"Warrant-Token": "latest"}) self.assertEqual(object2.object_type, refetched_object.object_type) self.assertEqual(object2.object_id, refetched_object.object_id) self.assertEqual(object2.meta, refetched_object.meta) object2.update({"description": "Second document"}) - refetched_object = warrant.WarrantObject.get(object2.object_type, object2.object_id, {"Warrant-Token": "latest"}) + refetched_object = warrant.Object.get(object2.object_type, object2.object_id, {"Warrant-Token": "latest"}) self.assertEqual(refetched_object.object_type, "folder") self.assertEqual(refetched_object.object_id, "planning") self.assertEqual(refetched_object.meta, {"description": "Second document"}) - objects_list = warrant.WarrantObject.list({"sortBy": "createdAt", "limit": 10}, {"Warrant-Token": "latest"}) + objects_list = warrant.Object.list({"sortBy": "createdAt", "limit": 10}, {"Warrant-Token": "latest"}) self.assertEqual(len(objects_list.results), 2) self.assertEqual(objects_list.results[0].object_type, object1.object_type) self.assertEqual(objects_list.results[0].object_id, object1.object_id) self.assertEqual(objects_list.results[1].object_type, object2.object_type) self.assertEqual(objects_list.results[1].object_id, object2.object_id) - warrant_token = warrant.WarrantObject.delete(object1.object_type, object1.object_id) + warrant_token = warrant.Object.delete(object1.object_type, object1.object_id) self.assertIsNotNone(warrant_token) - warrant_token = warrant.WarrantObject.delete(object2.object_type, object2.object_id) + warrant_token = warrant.Object.delete(object2.object_type, object2.object_id) self.assertIsNotNone(warrant_token) - objects_list = warrant.WarrantObject.list({"sortBy": "createdAt", "limit": 10}, {"Warrant-Token": "latest"}) + objects_list = warrant.Object.list({"sortBy": "createdAt", "limit": 10}, {"Warrant-Token": "latest"}) self.assertEqual(len(objects_list.results), 0) def test_batch_create_delete_objects(self): - objects = warrant.WarrantObject.batch_create([ + objects = warrant.Object.batch_create([ {"objectType": "document", "objectId": "document-a"}, {"objectType": "document", "objectId": "document-b"}, {"objectType": "folder", "objectId": "resources", "meta": {"description": "Helpful documents"}} ]) self.assertEqual(len(objects), 3) - objects_list = warrant.WarrantObject.list({"limit": 10}, {"Warrant-Token": "latest"}) + objects_list = warrant.Object.list({"limit": 10}, {"Warrant-Token": "latest"}) self.assertEqual(len(objects_list.results), 3) self.assertEqual(objects_list.results[0].object_type, "document") self.assertEqual(objects_list.results[0].object_id, "document-a") @@ -270,12 +270,12 @@ def test_batch_create_delete_objects(self): self.assertEqual(objects_list.results[2].object_id, "resources") self.assertEqual(objects_list.results[2].meta, {"description": "Helpful documents"}) - warrant.WarrantObject.batch_delete([ + warrant.Object.batch_delete([ {"objectType": "document", "objectId": "document-a"}, {"objectType": "document", "objectId": "document-b"}, {"objectType": "folder", "objectId": "resources", "meta": {"description": "Helpful documents"}} ]) - objects_list = warrant.WarrantObject.list({"limit": 10}, {"Warrant-Token": "latest"}) + objects_list = warrant.Object.list({"limit": 10}, {"Warrant-Token": "latest"}) self.assertEqual(len(objects_list.results), 0) def test_multitenancy_example(self): @@ -732,7 +732,7 @@ def test_batch_create_delete_warrants(self): {"objectType": permission1.object_type, "objectId": permission1.id, "relation": "member", "subject": {"objectType": new_user.object_type, "objectId": new_user.id}}, {"objectType": permission2.object_type, "objectId": permission2.id, "relation": "member", "subject": {"objectType": new_user.object_type, "objectId": new_user.id}} ]) - warrant.WarrantObject.batch_delete([ + warrant.Object.batch_delete([ {"objectType": permission1.object_type, "objectId": permission1.id}, {"objectType": permission2.object_type, "objectId": permission2.id}, {"objectType": new_user.object_type, "objectId": new_user.id}, diff --git a/warrant/__init__.py b/warrant/__init__.py index 027e5bc..507c1c8 100644 --- a/warrant/__init__.py +++ b/warrant/__init__.py @@ -1,6 +1,6 @@ from warrant.api_resource import APIResource, WarrantException from warrant.list_result import ListResult -from warrant.warrant_object import WarrantObject +from warrant.object import Object from warrant.warrant import Warrant, Subject, QueryResult from warrant.authz import Authz, CheckOp diff --git a/warrant/feature.py b/warrant/feature.py index 6b4ad78..0cd2b18 100644 --- a/warrant/feature.py +++ b/warrant/feature.py @@ -1,16 +1,16 @@ -from warrant import APIResource, Subject, Warrant, WarrantObject, constants, ListResult +from warrant import APIResource, Subject, Warrant, Object, constants, ListResult from typing import Any, Dict, List, Optional -class Feature(WarrantObject): +class Feature(Object): def __init__(self, id: str = "", meta: Dict[str, Any] = {}) -> None: self.id = id - WarrantObject.__init__(self, "feature", id, meta) + Object.__init__(self, "feature", id, meta) @classmethod def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): list_params['objectType'] = 'feature' - list_result = WarrantObject.list(list_params, opts=opts) + list_result = Object.list(list_params, opts=opts) features = map(lambda warrant_obj: Feature(warrant_obj.object_id, warrant_obj.meta), list_result.results) if list_result.prev_cursor != "" and list_result.next_cursor != "": return ListResult[Feature](list(features), list_result.prev_cursor, list_result.next_cursor) @@ -23,17 +23,17 @@ def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): @classmethod def get(cls, id: str, opts: Dict[str, Any] = {}) -> "Feature": - warrant_obj = WarrantObject.get("feature", id, opts=opts) + warrant_obj = Object.get("feature", id, opts=opts) return Feature.from_warrant_obj(warrant_obj) @classmethod def create(cls, id: str, meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "Feature": - warrant_obj = WarrantObject.create("feature", id, meta, opts=opts) + warrant_obj = Object.create("feature", id, meta, opts=opts) return Feature.from_warrant_obj(warrant_obj) @classmethod def delete(cls, id: str, opts: Dict[str, Any] = {}) -> Optional[str]: - return WarrantObject.delete("feature", id, opts=opts) + return Object.delete("feature", id, opts=opts) """ Pricing tiers diff --git a/warrant/warrant_object.py b/warrant/object.py similarity index 69% rename from warrant/warrant_object.py rename to warrant/object.py index 0036f36..3d33dd2 100644 --- a/warrant/warrant_object.py +++ b/warrant/object.py @@ -2,30 +2,30 @@ from typing import Any, Dict, List, Optional -class WarrantObject(APIResource): +class Object(APIResource): def __init__(self, object_type: str, object_id: str, meta: Dict[str, Any] = {}) -> None: self.object_type = object_type self.object_id = object_id self.meta = meta @classmethod - def list(cls, params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> ListResult["WarrantObject"]: + def list(cls, params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> ListResult["Object"]: if params is None: params = {} if opts is None: opts = {} - list_result = cls._get(uri="/v2/objects", params=params, opts=opts, object_hook=WarrantObject.from_json) + list_result = cls._get(uri="/v2/objects", params=params, opts=opts, object_hook=Object.from_json) if "prevCursor" in list_result and "nextCursor" in list_result: - return ListResult[WarrantObject](list_result['results'], list_result['prevCursor'], list_result['nextCursor']) + return ListResult[Object](list_result['results'], list_result['prevCursor'], list_result['nextCursor']) elif "prevCursor" in list_result: - return ListResult[WarrantObject](list_result['results'], list_result['prevCursor']) + return ListResult[Object](list_result['results'], list_result['prevCursor']) elif "nextCursor" in list_result: - return ListResult[WarrantObject](list_result['results'], next_cursor=list_result['nextCursor']) + return ListResult[Object](list_result['results'], next_cursor=list_result['nextCursor']) else: - return ListResult[WarrantObject](list_result['results']) + return ListResult[Object](list_result['results']) @classmethod - def create(cls, object_type: str, object_id: str = "", meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "WarrantObject": + def create(cls, object_type: str, object_id: str = "", meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "Object": payload: Dict[str, Any] = { "objectType": object_type } @@ -33,21 +33,21 @@ def create(cls, object_type: str, object_id: str = "", meta: Dict[str, Any] = {} payload["objectId"] = object_id if meta != {}: payload["meta"] = meta - return cls._post(uri="/v2/objects", json_payload=payload, opts=opts, object_hook=WarrantObject.from_json) + return cls._post(uri="/v2/objects", json_payload=payload, opts=opts, object_hook=Object.from_json) @classmethod - def batch_create(cls, objects: List[Dict[str, Any]], opts: Dict[str, Any] = {}) -> List["WarrantObject"]: - return cls._post(uri="/v2/objects", json_payload=objects, opts=opts, object_hook=WarrantObject.from_json) + def batch_create(cls, objects: List[Dict[str, Any]], opts: Dict[str, Any] = {}) -> List["Object"]: + return cls._post(uri="/v2/objects", json_payload=objects, opts=opts, object_hook=Object.from_json) @classmethod - def get(cls, object_type: str, object_id: str, opts: Dict[str, Any] = {}) -> "WarrantObject": - return cls._get("/v2/objects/"+object_type+"/"+object_id, params={}, opts=opts, object_hook=WarrantObject.from_json) + def get(cls, object_type: str, object_id: str, opts: Dict[str, Any] = {}) -> "Object": + return cls._get("/v2/objects/"+object_type+"/"+object_id, params={}, opts=opts, object_hook=Object.from_json) def update(self, meta: Dict[str, Any], opts: Dict[str, Any] = {}) -> None: payload = { "meta": meta } - updated_obj = self._put(uri="/v2/objects/"+self.object_type+"/"+self.object_id, json_payload=payload, opts=opts, object_hook=WarrantObject.from_json) + updated_obj = self._put(uri="/v2/objects/"+self.object_type+"/"+self.object_id, json_payload=payload, opts=opts, object_hook=Object.from_json) self.meta = updated_obj.meta @classmethod @@ -65,8 +65,8 @@ def batch_delete(cls, objects: List[Dict[str, Any]], opts: Dict[str, Any] = {}) def from_json(obj): if "objectType" in obj and "objectId" in obj: if "meta" in obj: - return WarrantObject(obj["objectType"], obj["objectId"], obj["meta"]) + return Object(obj["objectType"], obj["objectId"], obj["meta"]) else: - return WarrantObject(obj["objectType"], obj["objectId"]) + return Object(obj["objectType"], obj["objectId"]) else: return obj diff --git a/warrant/permission.py b/warrant/permission.py index 5591e03..34b6e73 100644 --- a/warrant/permission.py +++ b/warrant/permission.py @@ -1,16 +1,16 @@ -from warrant import APIResource, Subject, Warrant, WarrantObject, constants, ListResult +from warrant import APIResource, Subject, Warrant, Object, constants, ListResult from typing import Any, Dict, List, Optional -class Permission(WarrantObject): +class Permission(Object): def __init__(self, id: str = "", meta: Dict[str, Any] = {}) -> None: self.id = id - WarrantObject.__init__(self, "permission", id, meta) + Object.__init__(self, "permission", id, meta) @classmethod def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): list_params['objectType'] = 'permission' - list_result = WarrantObject.list(list_params, opts=opts) + list_result = Object.list(list_params, opts=opts) permissions = map(lambda warrant_obj: Permission(warrant_obj.object_id, warrant_obj.meta), list_result.results) if list_result.prev_cursor != "" and list_result.next_cursor != "": return ListResult[Permission](list(permissions), list_result.prev_cursor, list_result.next_cursor) @@ -23,17 +23,17 @@ def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): @classmethod def get(cls, id: str, opts: Dict[str, Any] = {}) -> "Permission": - warrant_obj = WarrantObject.get("permission", id, opts=opts) + warrant_obj = Object.get("permission", id, opts=opts) return Permission.from_warrant_obj(warrant_obj) @classmethod def create(cls, id: str, meta={}, opts: Dict[str, Any] = {}) -> "Permission": - warrant_obj = WarrantObject.create("permission", id, meta, opts=opts) + warrant_obj = Object.create("permission", id, meta, opts=opts) return Permission.from_warrant_obj(warrant_obj) @classmethod def delete(cls, id: str, opts: Dict[str, Any] = {}) -> Optional[str]: - return WarrantObject.delete("permission", id, opts=opts) + return Object.delete("permission", id, opts=opts) """ Users diff --git a/warrant/pricing_tier.py b/warrant/pricing_tier.py index fb7d248..cd3e428 100644 --- a/warrant/pricing_tier.py +++ b/warrant/pricing_tier.py @@ -1,16 +1,16 @@ -from warrant import APIResource, Feature, Subject, Warrant, WarrantObject, constants, ListResult +from warrant import APIResource, Feature, Subject, Warrant, Object, constants, ListResult from typing import Any, Dict, List, Optional -class PricingTier(WarrantObject): +class PricingTier(Object): def __init__(self, id: str = "", meta: Dict[str, Any] = {}) -> None: self.id = id - WarrantObject.__init__(self, "pricing-tier", id, meta) + Object.__init__(self, "pricing-tier", id, meta) @classmethod def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): list_params['objectType'] = 'pricing-tier' - list_result = WarrantObject.list(list_params, opts=opts) + list_result = Object.list(list_params, opts=opts) pricing_tiers = map(lambda warrant_obj: PricingTier(warrant_obj.object_id, warrant_obj.meta), list_result.results) if list_result.prev_cursor != "" and list_result.next_cursor != "": return ListResult[PricingTier](list(pricing_tiers), list_result.prev_cursor, list_result.next_cursor) @@ -23,17 +23,17 @@ def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): @classmethod def get(cls, id: str, opts: Dict[str, Any] = {}) -> "PricingTier": - warrant_obj = WarrantObject.get("pricing-tier", id, opts=opts) + warrant_obj = Object.get("pricing-tier", id, opts=opts) return PricingTier.from_warrant_obj(warrant_obj) @classmethod def create(cls, id: str, meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "PricingTier": - warrant_obj = WarrantObject.create("pricing-tier", id, meta, opts=opts) + warrant_obj = Object.create("pricing-tier", id, meta, opts=opts) return PricingTier.from_warrant_obj(warrant_obj) @classmethod def delete(cls, id: str, opts: Dict[str, Any] = {}): - return WarrantObject.delete("pricing-tier", id, opts=opts) + return Object.delete("pricing-tier", id, opts=opts) """ Features diff --git a/warrant/role.py b/warrant/role.py index c26e477..e20c6bd 100644 --- a/warrant/role.py +++ b/warrant/role.py @@ -1,16 +1,16 @@ -from warrant import APIResource, Permission, Subject, Warrant, WarrantObject, constants, ListResult +from warrant import APIResource, Permission, Subject, Warrant, Object, constants, ListResult from typing import Any, Dict, List, Optional -class Role(WarrantObject): +class Role(Object): def __init__(self, id: str = "", meta: Dict[str, Any] = {}) -> None: self.id = id - WarrantObject.__init__(self, "role", id, meta) + Object.__init__(self, "role", id, meta) @classmethod def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): list_params['objectType'] = 'role' - list_result = WarrantObject.list(list_params, opts=opts) + list_result = Object.list(list_params, opts=opts) roles = map(lambda warrant_obj: Role(warrant_obj.object_id, warrant_obj.meta), list_result.results) if list_result.prev_cursor != "" and list_result.next_cursor != "": return ListResult[Role](list(roles), list_result.prev_cursor, list_result.next_cursor) @@ -23,17 +23,17 @@ def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): @classmethod def get(cls, id: str, opts: Dict[str, Any] = {}) -> "Role": - warrant_obj = WarrantObject.get("role", id, opts=opts) + warrant_obj = Object.get("role", id, opts=opts) return Role.from_warrant_obj(warrant_obj) @classmethod def create(cls, id: str = "", meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "Role": - warrant_obj = WarrantObject.create("role", id, meta, opts=opts) + warrant_obj = Object.create("role", id, meta, opts=opts) return Role.from_warrant_obj(warrant_obj) @classmethod def delete(cls, id: str, opts: Dict[str, Any] = {}) -> Optional[str]: - return WarrantObject.delete("role", id, opts=opts) + return Object.delete("role", id, opts=opts) """ Users diff --git a/warrant/tenant.py b/warrant/tenant.py index e566b96..f8c92d4 100644 --- a/warrant/tenant.py +++ b/warrant/tenant.py @@ -1,16 +1,16 @@ -from warrant import APIResource, PricingTier, Feature, User, Authz, Subject, Warrant, WarrantObject, ListResult +from warrant import APIResource, PricingTier, Feature, User, Authz, Subject, Warrant, Object, ListResult from typing import Any, Dict, List, Optional -class Tenant(WarrantObject): +class Tenant(Object): def __init__(self, id: str = "", meta: Dict[str, Any] = {}) -> None: self.id = id - WarrantObject.__init__(self, "tenant", id, meta) + Object.__init__(self, "tenant", id, meta) @classmethod def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): list_params['objectType'] = 'tenant' - list_result = WarrantObject.list(list_params, opts=opts) + list_result = Object.list(list_params, opts=opts) tenants = map(lambda warrant_obj: Tenant(warrant_obj.object_id, warrant_obj.meta), list_result.results) if list_result.prev_cursor != "" and list_result.next_cursor != "": return ListResult[Tenant](list(tenants), list_result.prev_cursor, list_result.next_cursor) @@ -23,12 +23,12 @@ def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): @classmethod def get(cls, id: str, opts: Dict[str, Any] = {}) -> "Tenant": - warrant_obj = WarrantObject.get("tenant", id, opts=opts) + warrant_obj = Object.get("tenant", id, opts=opts) return Tenant.from_warrant_obj(warrant_obj) @classmethod def create(cls, id: str = "", meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "Tenant": - warrant_obj = WarrantObject.create("tenant", id, meta, opts=opts) + warrant_obj = Object.create("tenant", id, meta, opts=opts) return Tenant.from_warrant_obj(warrant_obj) @classmethod @@ -37,18 +37,18 @@ def batch_create(cls, tenants: List[Dict[str, Any]], opts: Dict[str, Any] = {}) lambda tenant: {"objectType": "tenant", "objectId": tenant['tenantId'], "meta": tenant['meta']} if "meta" in tenant.keys() else {"objectType": "tenant", "objectId": tenant['tenantId']}, tenants ) - created_objects = WarrantObject.batch_create(list(objects), opts) + created_objects = Object.batch_create(list(objects), opts) created_tenants = map(lambda warrant_obj: Tenant(warrant_obj.object_id, warrant_obj.meta), created_objects) return list(created_tenants) @classmethod def delete(cls, id: str, opts: Dict[str, Any] = {}) -> Optional[str]: - return WarrantObject.delete("tenant", id, opts=opts) + return Object.delete("tenant", id, opts=opts) @classmethod def batch_delete(cls, tenants: List[Dict[str, Any]], opts: Dict[str, Any] = {}) -> Optional[str]: objects = map(lambda tenant: {"objectType": "tenant", "objectId": tenant['tenantId']}, tenants) - return WarrantObject.batch_delete(list(objects), opts) + return Object.batch_delete(list(objects), opts) @classmethod def list_for_user(cls, user_id: str, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> ListResult["Tenant"]: diff --git a/warrant/user.py b/warrant/user.py index b5e4ee7..b15b3ae 100644 --- a/warrant/user.py +++ b/warrant/user.py @@ -1,16 +1,16 @@ -from warrant import APIResource, PricingTier, Feature, Role, Permission, Authz, Subject, Warrant, WarrantObject, constants, ListResult +from warrant import APIResource, PricingTier, Feature, Role, Permission, Authz, Subject, Warrant, Object, constants, ListResult from typing import Any, Dict, List, Optional, Sequence -class User(WarrantObject): +class User(Object): def __init__(self, id: str = "", meta: Dict[str, Any] = {}) -> None: self.id = id - WarrantObject.__init__(self, "user", id, meta) + Object.__init__(self, "user", id, meta) @classmethod def list(cls, list_params: Dict[str, Any] = {}, opts: Dict[str, Any] = {}): list_params['objectType'] = 'user' - list_result = WarrantObject.list(list_params, opts=opts) + list_result = Object.list(list_params, opts=opts) users = map(lambda warrant_obj: User(warrant_obj.object_id, warrant_obj.meta), list_result.results) if list_result.prev_cursor != "" and list_result.next_cursor != "": return ListResult[User](list(users), list_result.prev_cursor, list_result.next_cursor) @@ -36,29 +36,29 @@ def list_for_tenant(cls, tenant_id: str, list_params: Dict[str, Any] = {}, opts: @classmethod def get(cls, id: str, opts: Dict[str, Any] = {}) -> "User": - warrant_obj = WarrantObject.get("user", id, opts=opts) + warrant_obj = Object.get("user", id, opts=opts) return User.from_warrant_obj(warrant_obj) @classmethod def create(cls, id: str = "", meta: Dict[str, Any] = {}, opts: Dict[str, Any] = {}) -> "User": - warrant_obj = WarrantObject.create("user", id, meta, opts=opts) + warrant_obj = Object.create("user", id, meta, opts=opts) return User.from_warrant_obj(warrant_obj) @classmethod def batch_create(cls, users: List[Dict[str, Any]], opts: Dict[str, Any] = {}) -> List["User"]: objects = map(lambda user: {"objectType": "user", "objectId": user['userId'], "meta": user['meta']} if "meta" in user.keys() else {"objectType": "user", "objectId": user['userId']}, users) - created_objects = WarrantObject.batch_create(list(objects), opts) + created_objects = Object.batch_create(list(objects), opts) created_users = list(map(lambda warrant_obj: User(warrant_obj.object_id, warrant_obj.meta), created_objects)) return created_users @classmethod def delete(cls, id: str, opts: Dict[str, Any] = {}) -> Optional[str]: - return WarrantObject.delete("user", id, opts=opts) + return Object.delete("user", id, opts=opts) @classmethod def batch_delete(cls, users: List[Dict[str, Any]], opts: Dict[str, Any] = {}) -> Optional[str]: objects = map(lambda user: {"objectType": "user", "objectId": user['userId']}, users) - return WarrantObject.batch_delete(list(objects), opts) + return Object.batch_delete(list(objects), opts) """ Tenants