@@ -183,6 +183,20 @@ def is_empty(self) -> bool:
183183 return self .limit is None and self .offset is None
184184
185185
186+ class DeltaPushResponse (TypedDict ):
187+ """Represents the structure of the response for pushing a delta file.
188+
189+ Attributes:
190+ status: The status of the response.
191+ message: A message providing additional information about the response.
192+ details: Additional details about the delta push operation.
193+ """
194+
195+ status : str
196+ message : Optional [str ]
197+ details : Optional [Dict [str , Any ]]
198+
199+
186200class Client :
187201 """The core component of the QFieldCloud SDK, providing methods for interacting with the QFieldCloud platform.
188202
@@ -617,34 +631,25 @@ def job_status(self, job_id: str) -> Dict[str, Any]:
617631
618632 return resp .json ()
619633
620- def push_delta (self , project_id : str , delta_filename : str ) -> Dict [ str , Any ] :
634+ def push_delta (self , project_id : str , delta_filename : str ) -> DeltaPushResponse :
621635 """Push a delta file to a project.
622636
623637 Args:
624638 project_id: Project ID.
625639 delta_filename: Path to the delta JSON file.
626640
627641 Returns:
628- A dictionary containing the response from the server.
642+ A DeltaPushResponse containing the response from the server.
629643 """
630- try :
631- with open (delta_filename , "r" ) as delta_file :
632- files = {"file" : delta_file }
633- resp = self ._request (
634- "POST" ,
635- f"deltas/{ project_id } /" ,
636- files = {
637- "file" : delta_file
638- },
639- )
640- print (f"Response status code: { resp .status_code } " )
644+ with open (delta_filename , "r" ) as delta_file :
645+ files = {"file" : delta_file }
646+ response = self ._request (
647+ "POST" ,
648+ f"deltas/{ project_id } /" ,
649+ files = files ,
650+ )
641651
642- if resp .content :
643- return resp .json ()
644- else :
645- return {"message" : "Delta pushed successfully" }
646- except Exception as e :
647- raise RuntimeError (f"Failed to push delta: { e } " )
652+ return cast (DeltaPushResponse , response )
648653
649654 def delete_files (
650655 self ,
0 commit comments