How to use the stashy.branch_permissions.BranchPermissions function in stashy

To help you get started, we’ve selected a few stashy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cosmin / stashy / stashy / projects.py View on Github external
"""
        Retrieve the access keys associated with the project
        """
        return self.paginate('/ssh', is_keys=True)

    @ok_or_error
    def add_key(self, key_text, permission):
        return self._client.post(self.url('/ssh', is_keys=True),
                                 data=dict(key=dict(text=key_text),
                                           permission=permission))


    permissions = Nested(ProjectPermissions, relative_path="/permissions")
    repos = Nested(Repos)
    settings = Nested(Settings)
    branch_permissions = Nested(BranchPermissions, relative_path=None)
    default_reviewers = Nested(DefaultReviewers, relative_path=None)


class Projects(ResourceBase, IterableResource):
    @response_or_error
    def get(self, project):
        """
        Retrieve the project matching the supplied key.
        """
        return self._client.get(self.url(project))

    def __getitem__(self, item):
        return Project(item, self.url(item), self._client, self)

    @response_or_error
    def create(self, key, name, description='', avatar=None):
github cosmin / stashy / stashy / repos.py View on Github external
"""
        params = dict(until=until, withCounts=False)
        if since is not None:
            params['since'] = since
        if path is not None:
            params['path'] = path
        return self.paginate('/commits', params=params)

    permissions = Nested(Permissions)
    repo_permissions = Nested(RepositoryPermissions,
                              relative_path="/permissions")

    pull_requests = Nested(PullRequests, relative_path="/pull-requests")
    settings = Nested(Settings)
    webhooks = Nested(Webhooks)
    branch_permissions = Nested(BranchPermissions, relative_path=None)
       
    @response_or_error
    def _get_public(self):
        """
        Args:
            N/A
        Returns:
            (bool): True if repo is public, False if it is not public
        """
        return self._client.get(self.url())

    @ok_or_error
    def _set_public(self, value):
        """
        Args:
            value (bool): True if repo should be public, False otherwise