Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 1.08 KB

README.md

File metadata and controls

46 lines (29 loc) · 1.08 KB

Grapevine API

Getting Started

The Grapevine API is defined with Protobuf. Download the compiler here.

Usage

Writing protos

Use the latest proto3 syntax.

Using the generated stubs

TypeScript stubs are copied to the app/api directory. They can be imported with the @api alias.

import { Messages, Message } from '@api/message';

The imports double as interfaces and factory methods. Full usage.

// api/message.ts

interface Message {
  content: string
}

const Message = {
  encode(person): Writer { ... }
  decode(reader): Message { ... }
  toJSON(person): unknown { ... }
  fromJSON(data): Message { ... }
}

Compilation

The Protobufs must be recompiled after any changes are made to the *.proto files so the consumers have the latest version.

./compile.sh