Skip to content

Commit

Permalink
Implement workflow operations
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMarble committed Jul 16, 2024
1 parent 9259851 commit 1c9fd77
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions osidb_bindings/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ def __init__(self, base_url, auth=None, verify_ssl=True):
"list",
"create",
"search",
"promote",
"reject"
),
subresources={
"comments": {"allowed_operations": ["retrieve", "list", "create"]},
Expand Down Expand Up @@ -524,6 +526,35 @@ def bulk_delete(self, form_data: Dict[str, Any], *args, **kwargs):
else:
self.__raise_operation_unsupported("bulk_delete")

def promote(self, id, *args, **kwargs):
if "promote" in self.allowed_operations:
method_module = self.__get_method_module(
resource_name=self.resource_name, method="promote_create"
)
sync_fn = get_sync_function(method_module)
return sync_fn(
id,
*args,
client=self.client(),
**kwargs,
)
else:
self.__raise_operation_unsupported("promote")

def reject(self, id, *args, **kwargs):
if "reject" in self.allowed_operations:
method_module = self.__get_method_module(
resource_name=self.resource_name, method="reject_create"
)
sync_fn = get_sync_function(method_module)
return sync_fn(
id,
*args,
client=self.client(),
**kwargs,
)
else:
self.__raise_operation_unsupported("reject")
# Extra operations

def count(self, *args, **kwargs):
Expand Down

0 comments on commit 1c9fd77

Please sign in to comment.