@@ -81,10 +81,11 @@ class APIHelper(ABC):
8181 user_auth : bool = False
8282
8383 def create_resource (self , res_type : APIResourceTypes , json_data : any , parent_res_id : str = None ,
84- from_collection : bool = False , url_endpoint : str = None ):
84+ from_collection : bool = False , url_endpoint : str = None , req_headers : dict = None ):
8585 """
8686 Creates a resource of the given type with the given data, will attempt to create a sub-resource if parent_res_id
8787 is provided.
88+ :param req_headers:
8889 :param res_type:
8990 :param json_data:
9091 :param parent_res_id:
@@ -98,15 +99,16 @@ def create_resource(self, res_type: APIResourceTypes, json_data: any, parent_res
9899 else :
99100 url = f'{ self .server_url } /{ self .api_root } /{ url_endpoint } '
100101 api_request = ConnectedSystemAPIRequest (url = url , request_method = 'POST' , auth = self .get_helper_auth (),
101- body = json_data )
102+ body = json_data , headers = req_headers )
102103 return api_request .make_request ()
103104
104105 def retrieve_resource (self , res_type : APIResourceTypes , res_id : str , parent_res_id : str = None ,
105106 from_collection : bool = False ,
106- collection_id : str = None , url_endpoint : str = None ):
107+ collection_id : str = None , url_endpoint : str = None , req_headers : dict = None ):
107108 """
108109 Retrieves a resource or list of resources if no res_id is provided, will attempt to retrieve a sub-resource if
109110 parent_res_id is provided.
111+ :param req_headers:
110112 :param res_type:
111113 :param res_id:
112114 :param parent_res_id:
@@ -119,14 +121,16 @@ def retrieve_resource(self, res_type: APIResourceTypes, res_id: str, parent_res_
119121 url = self .resource_url_resolver (res_type , None , parent_res_id , from_collection )
120122 else :
121123 url = f'{ self .server_url } /{ self .api_root } /{ url_endpoint } '
122- api_request = ConnectedSystemAPIRequest (url = url , request_method = 'GET' , auth = self .get_helper_auth ())
124+ api_request = ConnectedSystemAPIRequest (url = url , request_method = 'GET' , auth = self .get_helper_auth (),
125+ headers = req_headers )
123126 return api_request .make_request ()
124127
125128 def update_resource (self , res_type : APIResourceTypes , res_id : str , json_data : any , parent_res_id : str = None ,
126- from_collection : bool = False , url_endpoint : str = None ):
129+ from_collection : bool = False , url_endpoint : str = None , req_headers : dict = None ):
127130 """
128131 Updates a resource of the given type by its id, if necessary, will attempt to update a sub-resource if
129132 parent_res_id is provided.
133+ :param req_headers:
130134 :param res_type:
131135 :param res_id:
132136 :param json_data:
@@ -140,14 +144,15 @@ def update_resource(self, res_type: APIResourceTypes, res_id: str, json_data: an
140144 else :
141145 url = f'{ self .server_url } /{ self .api_root } /{ url_endpoint } '
142146 api_request = ConnectedSystemAPIRequest (url = url , request_method = 'PUT' , auth = self .get_helper_auth (),
143- body = json_data )
147+ body = json_data , headers = req_headers )
144148 return api_request .make_request ()
145149
146150 def delete_resource (self , res_type : APIResourceTypes , res_id : str , parent_res_id : str = None ,
147- from_collection : bool = False , url_endpoint : str = None ):
151+ from_collection : bool = False , url_endpoint : str = None , req_headers : dict = None ):
148152 """
149153 Deletes a resource of the given type by its id, if necessary, will attempt to delete a sub-resource if
150154 parent_res_id is provided.
155+ :param req_headers:
151156 :param res_type:
152157 :param res_id:
153158 :param parent_res_id:
@@ -159,7 +164,8 @@ def delete_resource(self, res_type: APIResourceTypes, res_id: str, parent_res_id
159164 url = self .resource_url_resolver (res_type , None , parent_res_id , from_collection )
160165 else :
161166 url = f'{ self .server_url } /{ self .api_root } /{ url_endpoint } '
162- api_request = ConnectedSystemAPIRequest (url = url , request_method = 'DELETE' , auth = self .get_helper_auth ())
167+ api_request = ConnectedSystemAPIRequest (url = url , request_method = 'DELETE' , auth = self .get_helper_auth (),
168+ headers = req_headers )
163169 return api_request .make_request ()
164170
165171 # Helpers
0 commit comments