semaphoreui-client 0.2.0__tar.gz → 0.2.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semaphoreui-client
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: An api client for interacting with Semaphore UI
5
5
  Project-URL: Documentation, https://github.com/rockstar/semaphoreui-client#readme
6
6
  Project-URL: Issues, https://github.com/rockstar/semaphoreui-client/issues
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2"
@@ -749,6 +749,23 @@ class Template:
749
749
  response = self.client.http.delete(self.url)
750
750
  assert response.status_code == 204
751
751
 
752
+ def last_tasks(self, limit: typing.Optional[int] = None) -> typing.List["Task"]:
753
+ """Get the last tasks.
754
+
755
+ This function is _technically_ undocumented in the SemaphoreUI
756
+ swagger doc. It was sleuthed out in the UI, so it may be
757
+ an unstable function.
758
+ """
759
+ params = {}
760
+ if limit is not None:
761
+ params["limit"] = limit
762
+ response = self.client.http.get(
763
+ f"{self.url}/tasks/last",
764
+ params=params,
765
+ )
766
+ assert response.status_code == 200
767
+ return [Task(**task, client=self.client) for task in response.json()]
768
+
752
769
 
753
770
  @dataclass
754
771
  class Schedule:
@@ -830,8 +847,8 @@ class Task:
830
847
  def url(self) -> str:
831
848
  return f"{self.client.api_endpoint}/project/{self.project_id}/tasks/{self.id}"
832
849
 
833
- def stop(self) -> None:
834
- response = self.client.http.post(f"{self.url}/stop")
850
+ def stop(self, force: bool = False) -> None:
851
+ response = self.client.http.post(f"{self.url}/stop", json={"force": force})
835
852
  assert response.status_code == 204
836
853
 
837
854
  def delete(self) -> None:
@@ -1 +0,0 @@
1
- __version__ = "0.2.0"