Skip to content

osmiumchat/bot-example-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Osmium API Example (Go)

Protobuf Codegen

The compileProto.sh script compiles all .proto files in the proto/ directory into Go code. It automatically discovers proto files, generates import mappings for cross-references, and outputs the generated code to bot/proto/ with each proto file in its own package to avoid type conflicts.

For more information on Protocol Buffers in Go, see the official Go tutorial.

Request/Response Ergonomics

requests.go provides an easy to use sendRequest() to which you can directly pass your message, and it will send it and wait for a response.

To make this work, we use a code-generated wrapMessage function (see wrap_message_gen.go).

How to update the wrapper:

go generate wrap_message_gen.go

This will automatically regenerate the wrapper for all supported message types.

See exampleGetCommunities() for a usage example.

About

Osmium API Example (Go)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published