Skip to content

Moostodon, an example application for calling the Mastodon API

License

Notifications You must be signed in to change notification settings

APIPatterns/Moostodon

Repository files navigation

Moostodon

This repo contains a demonstration of using CADL to describe the Mastodon API and then using Kiota to generate API clients from the OpenAPI emitted from the CADL compiler.

Getting Started

Everything you need to get started designing APIs in CADL can be found in the CADL documentation. If you are looking to generate API clients from OpenAPI, you can find the documentation for Kiota here.

Running the demo

To regenerate the OpenAPI from the CADL you will need to have the CADL compiler installed. You can find instructions for installing the CADL compiler here.

From the spec directory, run the following command to generate the OpenAPI document:

cadl compile ./main.cadl

To generate the API clients, you will need to have Kiota installed. You can find instructions for installing Kiota here.

From the csharpMastodonConsole folder within the clients folder, run the following command to generate the API client:

kiota generate -l csharp  -o .\sdk -d ..\..\spec\cadl-output\openapi.json -c MastodonClient -n MastodonClientLib --co

Currently there is a minimal set of example calls in the program.cs file. You can run this using:

dotnet restore
dotnet build
dotnet run

[Moose with Canadian flag]