Exemple #1
0
class GitHub(uplink.Consumer):
    @uplink.returns(User)
    @uplink.get("/users/{user}")
    def get_user(self, user):
        pass

    @uplink.returns.from_json(type=Repo)
    @uplink.get("/users/{user}/repos/{repo}")
    def get_repo(self, user, repo):
        pass

    @uplink.returns.from_json(type=uplink.types.List[Repo], key="data")
    @uplink.get("/users/{user}/repos")
    def get_repos(self, user):
        pass

    @uplink.json
    @uplink.post("/users/{user}/repos", args={"repo": uplink.Body(Repo)})
    def create_repo(self, user, repo):
        pass
Exemple #2
0
class GitHub(uplink.Consumer):
    @uplink.returns(User)
    @uplink.get("/users/{user}")
    def get_user(self, user):
        pass

    @uplink.returns.from_json(type=Repo)
    @uplink.get("/users/{user}/repos/{repo}")
    def get_repo(self, user, repo):
        pass

    @uplink.returns.from_json(key="data")
    @uplink.returns.schema(uplink.types.List[Repo])
    @uplink.get("/users/{user}/repos")
    def get_repos(self, user):
        pass

    @uplink.returns.from_json(key=("data", 0, "size"))
    @uplink.get("/users/{user}/repos")
    def get_first_repo_size(self, user):
        pass

    @uplink.returns.from_json(key=("data", 0, "stars"), type=int)
    @uplink.get("/users/{user}/repos")
    def get_first_repo_stars(self, user):
        pass

    @uplink.json
    @uplink.post("/users/{user}/repos", args={"repo": uplink.Body(Repo)})
    def create_repo(self, user, repo):
        pass

    @uplink.returns(object)
    @uplink.get("/users")
    def list_users(self):
        pass
Exemple #3
0
 def put(self, body: uplink.Body(), p: uplink.Query("param") = None):
     pass