This repository contains manifests that describe Stream public APIs, documentation and SDK clients can be generated using this manifests.
Stream REST API is described with OpenAPI specs, each product has its own openapi spec file.
At the moment client generation from OpenAPI specs is done inside the specific SDK repositories, generation scripts are not yet part of this repository and should be done using our dockerized fork of openapi-generator.
docker run --rm -v "${PWD}:/local" ghcr.io/getstream/openapi-generator:master generate \
-i https://raw.githubusercontent.com/GetStream/protocol/main/openapi/video-openapi.yaml \
-g typescript-fetch \
--additional-properties=supportsES6=true \
--additional-properties=modelPropertyNaming=original \
--additional-properties=enumPropertyNaming=original \
--additional-properties=withoutRuntimeChecks=true \
-o /local/src/gen/openapi-temp
Stream video servers use Twirp to expose an HTTP RPC layer. Websocket events sent by the video server are encoded using protobuf.
Before generating, you have to install necessary dependencies using ./install.sh
script.
All dependencies are installed into .protoc
directory. Some of them may be skipped if there's a missing dependency.
Swift plugins are not installed if there's no swift
executable in the PATH and so on.
You need to have realpath
. It can be installed via:
brew install coreutils
If you have an issue with realpath
in generation, try:
REALPATH=grealpath ./generate.sh
To generate Go and put artifacts into this project, just run ./generate.sh
without arguments or run go generate
.
You can also change the output directory, for example, to put generated code to the public Go SDK repo, but this will likely require
import prefix change. To change the import prefix, run ./generate.sh go <output_path> <import_prefix>
. Default import prefix
is github.com/GetStream/protocol/protobuf
.
We support generation for some client languages here:
- TypeScript
- Dart
- Swift
For detailed option settings, check out generate.sh
To generate code for your language, do this:
- Install dependencies:
./install.sh
- Generate:
./generate.sh <language> <output_dir>
language
: language to generate code for can bets
,dart
orswift
output_dir
is a directory where you want to put generated code in
For TS
docker run -v $(pwd):/local ghcr.io/getstream/protobuf-generate ts /local/packages/client/src/gen
# or
docker run --platform=linux/amd64 -v $(pwd):/local ghcr.io/getstream/protobuf-generate ts /local/packages/client/src/gen
For Dart
docker run -v $(pwd):/local ghcr.io/getstream/protobuf-generate dart /local/dart-sdk
# or
docker run --platform=linux/amd64 -v $(pwd):/local ghcr.io/getstream/protobuf-generate dart /local/dart-sdk
Where /local
is folder mounted to container from PWD
.
In this way you will find the dart-sdk
folder in your current directory.
docker run -v $(pwd):/local ghcr.io/getstream/protobuf-generate dart /local/dart-sdk --branch=my-branch
# or
docker run --platform=linux/amd64 -v $(pwd):/local ghcr.io/getstream/protobuf-generate dart /local/dart-sdk --branch=my-branch
This repository hosts the API and server-side SDK documentation for video.
For more info please see the nested readme file