-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(grpc): update gRPC document (#1353)
- Loading branch information
Showing
20 changed files
with
5,514 additions
and
10,544 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 |
---|---|---|
|
@@ -20,7 +20,7 @@ devtools: | |
go install google.golang.org/protobuf/cmd/[email protected] | ||
go install google.golang.org/grpc/cmd/[email protected] | ||
go install github.com/NathanBaulch/[email protected] | ||
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5 | ||
go install github.com/pactus-project/protoc-gen-doc/cmd/protoc-gen-doc@master | ||
go install github.com/bufbuild/buf/cmd/[email protected] | ||
go install mvdan.cc/gofumpt@latest | ||
go install github.com/rakyll/[email protected] | ||
|
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 |
---|---|---|
@@ -1,110 +1,175 @@ | ||
{{/* This template generates gRPC document for https://pactus.org/ */}}--- | ||
layout: learn | ||
title: gRPC API Reference | ||
sidebar: gRPC API Reference | ||
title: GRPC API Reference | ||
weight: 1 | ||
--- | ||
|
||
<h1 id="title">gRPC API Reference</h1> | ||
|
||
Each node in the Pactus network can be configured to use the [gRPC](https://grpc.io/) protocol for communication. | ||
Here you can find the list of all gRPC methods and messages. | ||
|
||
All the amounts and values in gRPC endpoints are in NanoPAC units, which are atomic and the smallest unit in the Pactus blockchain. | ||
Each PAC is equivalent to 1,000,000,000 or 10<sup>9</sup> NanoPACs. | ||
|
||
<h2>Table of Contents</h2> | ||
<h2>gRPC Services</h2> | ||
|
||
<div id="toc-container"> | ||
<ul class="">{{range .Files}} {{range .Services}} | ||
<ul class=""> | ||
{{range .Files}}{{- print "" -}} | ||
{{range .Services}}{{- print "" -}} | ||
<li> {{.Name}} Service | ||
<ul> {{$service_name := .FullName}} {{range .Methods}} | ||
<ul> {{$service_name := .FullName}} | ||
{{range .Methods}}{{- print "" -}} | ||
<li> | ||
<a href="#{{$service_name}}.{{.Name}}"> | ||
<span class="badge text-bg-primary">rpc</span> {{.Name}}</a> | ||
</li> {{end}} | ||
</ul> | ||
</li>{{end}} {{end}} | ||
<li>Messages and Enums | ||
<ul>{{range .Files}} {{range .Messages}} | ||
<li> | ||
<a href="#{{.FullName}}"> | ||
<span class="badge text-bg-secondary">msg</span> {{.LongName}} | ||
</a> | ||
</li> {{end}} {{end}} | ||
{{range .Files}} {{range .Enums}} | ||
<li> | ||
<a href="#{{.FullName}}"> | ||
<span class="badge text-bg-info">enum</span> {{.LongName}} | ||
</a> | ||
</li>{{end}} {{end}} | ||
<li> | ||
<a href="#scalar-value-types">Scalar Value Types</a> | ||
<span class="rpc-badge"></span> {{.Name}}</a> | ||
</li> | ||
{{end}}{{- print "" -}} | ||
</ul> | ||
</li> | ||
{{end}}{{- print "" -}} | ||
{{end}}{{- print "" -}} | ||
</ul> | ||
</div> | ||
{{range .Files}} {{$file_name := .Name}} {{range .Services}} | ||
<h2>{{.Name}} Service <span class="badge text-bg-warning fs-6 align-top">{{ $file_name }}</span></h2> | ||
{{p .Description}} {{$service_name := .FullName}} {{range .Methods}} | ||
<h3 id="{{$service_name}}.{{.Name}}">{{.Name}} <span class="badge text-bg-primary fs-6 align-top">rpc</span></h3> | ||
<div class="request pt-3">Request message: <a href="#{{.RequestFullType}}">{{.RequestLongType}}</a></div> | ||
<div class="response pb-3">Response message: <a href="#{{.ResponseFullType}}">{{.ResponseLongType}}</a></div> | ||
{{p .Description}} {{end}} {{end}} {{end}} | ||
<h2>Messages and Enums</h2>{{range .Files}} {{range .Messages}} | ||
<h3 id="{{.FullName}}"> | ||
{{.LongName}} | ||
<span class="badge text-bg-secondary fs-6 align-top">msg</span> | ||
</h3> | ||
{{p .Description}} | ||
{{if .HasFields}} | ||
<table class="table table-bordered table-sm"> | ||
|
||
<div class="api-doc"> | ||
{{range .Files}}{{range .Services}}{{- print "\n" -}} | ||
|
||
## {{.Name}} Service | ||
|
||
{{p .Description}} | ||
{{$service_name := .FullName}}{{range .Methods}}{{- print "\n" -}} | ||
|
||
### {{.Name}} <span id="{{$service_name}}.{{.Name}}" class="rpc-badge"></span> | ||
|
||
{{p .Description}} | ||
|
||
<h4>{{.RequestLongType}} <span class="badge text-bg-info fs-6 align-top">Request</span></h4> | ||
|
||
{{with getMessage .RequestLongType }}{{- print "" -}} | ||
{{if .HasFields}}{{- print "" -}} | ||
<table class="table table-bordered table-responsive table-sm"> | ||
<thead> | ||
<tr><td>Field</td><td>Type</td><td>Description</td></tr> | ||
</thead> | ||
<tbody class="table-group-divider"> | ||
{{range .Fields}}<tr> | ||
<td class="fw-bold">{{.Name}}</td> | ||
<td>{{.Label}} | ||
<a href="#{{.FullType}}">{{.LongType}}</a> | ||
</td> | ||
<td>{{if (index .Options "deprecated"|default false)}}<strong>Deprecated.</strong> {{end}}{{.Description}} {{if .DefaultValue}}Default: {{.DefaultValue}}{{end}}</td> | ||
</tr>{{end}} | ||
{{range .Fields}}{{- print "" -}} | ||
<tr> | ||
<td class="fw-bold">{{.Name}}</td> | ||
<td>{{.Label}} {{.LongType}}</td> | ||
<td> | ||
{{if .IsEnum}}(Enum) {{end}}{{- print "" -}} | ||
{{if .IsOneOf}}(OneOf) {{end}}{{- print "" -}} | ||
{{if (index .Options "deprecated"|default false)}}<strong>(Deprecated) </strong>{{end}}{{- print "" -}} | ||
{{.Description}} | ||
{{if .DefaultValue}}Default: {{.DefaultValue}}{{end}}{{- print "" -}} | ||
{{with getEnum .LongType }}{{- print "" -}} | ||
<br>Available values:<ul> | ||
{{range .Values}}{{- print "" -}} | ||
<li>{{ .Name}} = {{ .Description }}</li> | ||
{{end}}{{- print "" -}} | ||
</ul> | ||
{{end}}{{- print "" -}} | ||
</td> | ||
</tr> | ||
{{end}}{{- print "" -}} | ||
</tbody> | ||
</table> {{else}} Message has no fields. {{end}} {{end}} {{end}} | ||
{{range .Files}} {{range .Enums}} | ||
<h3 id="{{.FullName}}"> | ||
{{.LongName}} | ||
<span class="badge text-bg-info fs-6 align-top">enum</span> | ||
</h3> | ||
{{p .Description}} | ||
<table class="table table-bordered table-sm"> | ||
</table> | ||
{{else}}{{- print "" -}} | ||
Message has no fields. | ||
{{end}}{{- print "" -}} | ||
{{end}}{{- print "" -}} | ||
|
||
<h4>{{.ResponseLongType}} <span class="badge text-bg-warning fs-6 align-top">Response</span></h4> | ||
|
||
{{with getMessage .ResponseLongType }}{{- print "" -}} | ||
<table class="table table-bordered table-responsive table-sm"> | ||
<thead> | ||
<tr><td>Name</td><td>Number</td><td>Description</td></tr> | ||
<tr><td>Field</td><td>Type</td><td>Description</td></tr> | ||
</thead> | ||
<tbody class="table-group-divider"> | ||
{{range .Values}}<tr> | ||
<td class="fw-bold">{{.Name}}</td> | ||
<td>{{.Number}}</td> | ||
<td>{{.Description}}</td> | ||
</tr>{{end}} | ||
{{range .Fields}}{{- print "" -}} | ||
<tr> | ||
<td class="fw-bold">{{.Name}}</td> | ||
<td>{{.Label}} {{.LongType}}</td> | ||
<td> | ||
{{if .IsEnum}}(Enum) {{end}}{{- print "" -}} | ||
{{if .IsOneOf}}(OneOf) {{end}}{{- print "" -}} | ||
{{if (index .Options "deprecated"|default false)}}<strong>(Deprecated) </strong>{{end}}{{- print "" -}} | ||
{{.Description}} | ||
{{if .DefaultValue}}Default: {{.DefaultValue}}{{end}}{{- print "" -}} | ||
{{with getEnum .LongType }}{{- print "" -}} | ||
<br>Available values:<ul> | ||
{{range .Values}}{{- print "" -}} | ||
<li>{{ .Name}} = {{ .Description }}</li> | ||
{{end}}{{- print "" -}} | ||
</ul> | ||
{{end}}{{- print "" -}} | ||
</td> | ||
</tr> | ||
{{$msg0 := .}} {{with getMessage .LongType }}{{- print "" -}} | ||
{{range .Fields}}{{- print "" -}} | ||
<tr> | ||
<td class="fw-bold">{{$msg0.Name}}{{if $msg0.IsRepeated}}[]{{end}}.{{.Name}}</td> | ||
<td>{{.Label}} {{.LongType}}</td> | ||
<td> | ||
{{if .IsEnum}}(Enum) {{end}}{{- print "" -}} | ||
{{if .IsOneOf}}(OneOf) {{end}}{{- print "" -}} | ||
{{if (index .Options "deprecated"|default false)}}<strong>(Deprecated) </strong>{{end}}{{- print "" -}} | ||
{{.Description}} | ||
{{if .DefaultValue}}Default: {{.DefaultValue}}{{end}}{{- print "" -}} | ||
{{with getEnum .LongType }}{{- print "" -}} | ||
<br>Available values:<ul> | ||
{{range .Values}}{{- print "" -}} | ||
<li>{{ .Name}} = {{ .Description }}</li> | ||
{{end}}{{- print "" -}} | ||
</ul> | ||
{{end}}{{- print "" -}} | ||
</td> | ||
</tr> | ||
{{$msg1 := .}} {{with getMessage .LongType }}{{- print "" -}} | ||
{{range .Fields}}{{- print "" -}} | ||
<tr> | ||
<td class="fw-bold">{{$msg0.Name}}{{if $msg0.IsRepeated}}[]{{end}}.{{$msg1.Name}}{{if $msg1.IsRepeated}}[]{{end}}.{{.Name}}</td> | ||
<td>{{.Label}} {{.LongType}}</td> | ||
<td> | ||
{{if .IsEnum}}(Enum) {{end}}{{- print "" -}} | ||
{{if .IsOneOf}}(OneOf) {{end}}{{- print "" -}} | ||
{{if (index .Options "deprecated"|default false)}}<strong>(Deprecated) </strong>{{end}}{{- print "" -}} | ||
{{.Description}} | ||
{{if .DefaultValue}}Default: {{.DefaultValue}}{{end}}{{- print "" -}} | ||
{{with getEnum .LongType }}{{- print "" -}} | ||
<br>Available values:<ul> | ||
{{range .Values}}{{- print "" -}} | ||
<li>{{ .Name}} = {{ .Description }}</li> | ||
{{end}}{{- print "" -}} | ||
</ul> | ||
{{end}}{{- print "" -}} | ||
</td> | ||
</tr> | ||
{{end}}{{- print "" -}} | ||
{{end}}{{- print "" -}} | ||
{{end}}{{- print "" -}} | ||
{{end}}{{- print "" -}} | ||
{{end}}{{- print "" -}} | ||
</tbody> | ||
</table> {{end}} {{end}} | ||
{{end}}{{- print "" -}} | ||
</table> | ||
{{end}}{{end}}{{end}}{{- print "\n" -}} | ||
|
||
## Scalar Value Types | ||
|
||
<h3 id="scalar-value-types">Scalar Value Types</h3> | ||
<table class="table table-bordered table-sm"> | ||
<thead> | ||
<tr><td>.proto Type</td><td>C++</td><td>Java</td><td>Python</td><td>Go</td><td>C#</td><td>PHP</td></tr> | ||
<tr><td>.proto Type</td><td>Go</td><td>C++</td><td>Rust</td><td>Java</td><td>Python</td><td>C#</td></tr> | ||
</thead> | ||
<tbody class="table-group-divider"> {{range .Scalars}} | ||
<tr id="{{.ProtoType}}"> | ||
<td class="fw-bold">{{.ProtoType}}</td> | ||
<td>{{.GoType}}</td> | ||
<td>{{.CppType}}</td> | ||
<td>{{.RustType}}</td> | ||
<td>{{.JavaType}}</td> | ||
<td>{{.PythonType}}</td> | ||
<td>{{.GoType}}</td> | ||
<td>{{.CSharp}}</td> | ||
<td>{{.PhpType}}</td> | ||
</tr> {{end}} | ||
</tbody> | ||
</table> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.