-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add JobAPI and related functionality for job management
- Loading branch information
Showing
9 changed files
with
99 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
from typing import TypedDict | ||
from appier import API as BaseAPI | ||
|
||
from .job import JobAPI | ||
from .node import NodeAPI | ||
|
||
BASE_URL: str = ... | ||
|
||
class Ping(TypedDict): | ||
time: float | ||
|
||
class API(BaseAPI, NodeAPI): | ||
class API(BaseAPI, JobAPI, NodeAPI): | ||
def ping(self) -> Ping: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
from typing import Mapping, TypedDict | ||
from typing import Mapping, NotRequired, TypedDict | ||
|
||
class JobResult(TypedDict): | ||
handler: str | ||
result: str | ||
receivers: NotRequired[list[str]] | ||
output_data: NotRequired[str] | ||
|
||
class JobInfo(TypedDict): | ||
name: str | ||
node_id: str | ||
printer: str | None | ||
status: str | None | ||
result: NotRequired[JobResult] | ||
|
||
JobsResult = Mapping[str, JobInfo] | ||
|
||
class PrintResult(TypedDict): | ||
id: str | ||
name: str | ||
node_id: str | ||
printer: str | None | ||
data_length: int | ||
|
||
class JobAPI: | ||
def list_jobs(self) -> JobsResult: ... | ||
def get_job(self, id: str) -> JobInfo: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
|
||
from . import printer | ||
|
||
from .printer import print | ||
from .printer import print, save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters