-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #801 from gofractally/fracpack-port
Fracpack for Python
- Loading branch information
Showing
71 changed files
with
2,958 additions
and
31,861 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# events | ||
|
||
{{#cpp-doc ::UserService::ServiceSchema}} | ||
{{#cpp-doc ::UserService::EventIndex}} |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
|
||
#include <optional> | ||
#include <psibase/Rpc.hpp> | ||
#include <psibase/schema.hpp> | ||
#include <psio/stream.hpp> | ||
#include <psio/to_json.hpp> | ||
|
||
namespace psibase | ||
{ | ||
|
||
/// Handle `/schema` request | ||
/// | ||
/// If `request` is a GET to `/schema`, then this returns JSON for a | ||
/// ServiceSchema object. | ||
/// | ||
/// If `request` doesn't match the above, then this returns `std::nullopt`. | ||
template <typename Service> | ||
std::optional<HttpReply> serveSchema(const HttpRequest& request) | ||
{ | ||
if (request.method == "GET" && request.target == "/schema") | ||
{ | ||
HttpReply reply{.contentType = "application/json"}; | ||
psio::vector_stream stream{reply.body}; | ||
AccountNumber service = {}; | ||
if constexpr (requires { Service::service; }) | ||
{ | ||
service = Service::service; | ||
} | ||
to_json(ServiceSchema::make<Service>(service), stream); | ||
return reply; | ||
} | ||
return std::nullopt; | ||
} | ||
} // namespace psibase |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.