List of gRPC proto files and compiled golang files
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
| social.pb.go | ||
| social.proto | ||
| social_grpc.pb.go | ||
| tree.pb.go | ||
| tree.proto | ||
| tree_grpc.pb.go | ||
zord-grpc-schemas
This repository contains gRPC protocol buffer definitions and generated Go code for Zord services.
Services
TreeManager (tree.proto)
The TreeManager service provides methods for interacting with a file tree structure.
GetSummery: Retrieves a summary of the file tree.GetFile: Retrieves the content of a specific file by its ID.RebuildTree: Triggers a rebuild of the tree structure (requires secret key).DownloadAttachment: Downloads an attachment as a stream of bytes.
SocialManager (social.proto)
The SocialManager service provides methods for managing social media posts and associated images.
GetSummery: Retrieves a summary of social posts (with pagination support).GetFile: Retrieves the content of a specific post by its ID.DownloadImage: Downloads a post's image as a stream of bytes.
Installation
To use these schemas in your Go project:
go get g.arns.lt/zordsdavini/zord-grpc-schemas
Usage
Example of how to import and use the generated code in your Go project:
import (
"context"
"log"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
pb "g.arns.lt/zordsdavini/zord-grpc-schemas"
)
func main() {
conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
defer conn.Close()
client := pb.NewTreeManagerClient(conn)
summary, err := client.GetSummery(context.Background(), &pb.TreeRequest{})
if err != nil {
log.Fatalf("could not get summary: %v", err)
}
log.Printf("Tree summary: %v", summary)
}
Generated Code
The repository includes generated Go code:
tree.pb.go,tree_grpc.pb.gosocial.pb.go,social_grpc.pb.go