sfq 0.0.28__py3-none-any.whl → 0.0.30__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sfq/__init__.py CHANGED
@@ -99,7 +99,7 @@ class SFAuth:
99
99
  access_token: Optional[str] = None,
100
100
  token_expiration_time: Optional[float] = None,
101
101
  token_lifetime: int = 15 * 60,
102
- user_agent: str = "sfq/0.0.28",
102
+ user_agent: str = "sfq/0.0.30",
103
103
  sforce_client: str = "_auto",
104
104
  proxy: str = "_auto",
105
105
  ) -> None:
@@ -1099,6 +1099,7 @@ class SFAuth:
1099
1099
  insert_list: List[Dict[str, Any]],
1100
1100
  batch_size: int = 200,
1101
1101
  max_workers: int = None,
1102
+ api_type: Literal["enterprise", "tooling", "metadata"] = "enterprise",
1102
1103
  ) -> Optional[Dict[str, Any]]:
1103
1104
  """
1104
1105
  Execute the Insert API to insert multiple records via SOAP calls.
@@ -1110,7 +1111,19 @@ class SFAuth:
1110
1111
  :return: JSON response from the insert request or None on failure.
1111
1112
  """
1112
1113
 
1113
- endpoint = f"/services/Soap/c/{self.api_version}"
1114
+ endpoint = "/services/Soap/"
1115
+ if api_type == "enterprise":
1116
+ endpoint += f"c/{self.api_version}"
1117
+ elif api_type == "tooling":
1118
+ endpoint += f"T/{self.api_version}"
1119
+ elif api_type == "metadata":
1120
+ endpoint += f"m/{self.api_version}"
1121
+ else:
1122
+ logger.error(
1123
+ "Invalid API type: %s. Must be one of: 'enterprise', 'tooling', 'metadata'.",
1124
+ api_type,
1125
+ )
1126
+ return None
1114
1127
 
1115
1128
  if isinstance(insert_list, dict):
1116
1129
  insert_list = [insert_list]
@@ -1165,3 +1178,23 @@ class SFAuth:
1165
1178
  ]
1166
1179
 
1167
1180
  return combined_response or None
1181
+
1182
+ def _debug_cleanup_apex_logs(self):
1183
+ """
1184
+ This function performs cleanup operations for Apex debug logs.
1185
+ """
1186
+ apex_logs = self.query("SELECT Id FROM ApexLog ORDER BY LogLength DESC")
1187
+ if apex_logs and apex_logs.get("records"):
1188
+ log_ids = [log["Id"] for log in apex_logs["records"]]
1189
+ if log_ids:
1190
+ delete_response = self.cdelete(log_ids)
1191
+ logger.debug("Deleted Apex logs: %s", delete_response)
1192
+ else:
1193
+ logger.debug("No Apex logs found to delete.")
1194
+
1195
+ def debug_cleanup(self, apex_logs: bool = True) -> None:
1196
+ """
1197
+ Perform cleanup operations for Apex debug logs.
1198
+ """
1199
+ if apex_logs:
1200
+ self._debug_cleanup_apex_logs()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sfq
3
- Version: 0.0.28
3
+ Version: 0.0.30
4
4
  Summary: Python wrapper for the Salesforce's Query API.
5
5
  Author-email: David Moruzzi <sfq.pypi@dmoruzi.com>
6
6
  Keywords: salesforce,salesforce query
@@ -0,0 +1,6 @@
1
+ sfq/__init__.py,sha256=MpqXIfKQW1XRGBAh_uYBpdF5tj2Mxdzf3cCNO77yyd0,45630
2
+ sfq/_cometd.py,sha256=XimQEubmJwUmbWe85TxH_cuhGvWVuiHHrVr41tguuiI,10508
3
+ sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ sfq-0.0.30.dist-info/METADATA,sha256=ieHDwbhGy16xT_kAIEWVnQIWxVHnMN1vxenlIrHypas,6899
5
+ sfq-0.0.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ sfq-0.0.30.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- sfq/__init__.py,sha256=NNtMkZ9nLn4ItJ2vhBHlHViJ_c2OWFZM6NUbUnOnrtE,44356
2
- sfq/_cometd.py,sha256=XimQEubmJwUmbWe85TxH_cuhGvWVuiHHrVr41tguuiI,10508
3
- sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- sfq-0.0.28.dist-info/METADATA,sha256=Loc_qnLzns7FfFK9ZfBUHreeWqyQMYNQQTs81_jKeR0,6899
5
- sfq-0.0.28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- sfq-0.0.28.dist-info/RECORD,,
File without changes