    def share_code_model(self, share_code, code=None):
        """Compute the REST API model for a share code"""
        model = {
            "server": self.server_model(share_code.spawner),
            "scopes": share_code.scopes,
            "id": f"sc_{share_code.id}",
            "created_at": isoformat(share_code.created_at),
            "expires_at": isoformat(share_code.expires_at),
            "exchange_count": share_code.exchange_count,
            "last_exchanged_at": isoformat(share_code.last_exchanged_at),
        }
        if code:
            model["code"] = code
            model["accept_url"] = url_concat(
                self.hub.base_url + "accept-share", {"code": code}
            )
            model["full_accept_url"] = None
            public_url = self.settings.get("public_url")
            if public_url:
                model["full_accept_url"] = urlunparse(
                    public_url._replace(path=model["accept_url"])
                )
        return model
Compute the REST API model for a share code
jupyterhub/apihandlers/shares.py