OpenAPI/swagger file to auto generate SDK

  • 17 March 2020
  • 3 replies
  • 1344 views

Userlevel 3
Badge

 

Do you have a OpenAPI/swagger file for the Miro REST API? We want to auto generate a SDK for TypeScript/NodeJS SDK.

In case you don’t have this, we saw this Typescript definition file on your Github: https://github.com/miroapp/app-examples/blob/master/miro.d.ts - Is the idea that we copy this for our usage (better: can we link it somehow, so we get updates when you adjust it)?

Many thanks!


3 replies

Userlevel 4
Badge +1

Hi Ronny.

We do not have a swagger file unfortunately =(

 

The typescript d.ts you found should be used as part of your web-plugin system, read more about it here: 

In other words, it allows you to use specific API methods directly on the board, but it is not a wrapper around REST API, it basically a different tool for a different task. 

 

https://developers.miro.com/openapi/5f8d7f6a34ac11001889fc6e

 

{
"openapi": "3.0.3",
"info": {
"title": "Miro API",
"version": "3.2"
},
"servers": [
{
"url": "https://api.miro.com/v1"
}
],
"components": {
"securitySchemes": {
"sec0": {
"type": "oauth2",
"in": "query",
"_id": "5cbee2998907980013fd2dba"
}
},
"schemas": {}
},
"security": [
{
"sec0": []
}
],
"paths": {
"/boards/{id}": {
"get": {
"tags": [],
"summary": "Get Board",
"description": "",
"operationId": "get-board",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"delete": {
"tags": [],
"summary": "Delete Board",
"description": "",
"operationId": "delete-board",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"patch": {
"tags": [],
"summary": "Update Board",
"description": "",
"operationId": "update-board",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": ""
},
"description": {
"type": "string",
"description": ""
},
"sharingPolicy": {
"type": "object",
"description": "",
"properties": {}
}
}
}
}
}
},
"deprecated": false
}
},
"/teams/{id}/boards": {
"get": {
"tags": [],
"summary": "Get Current User Boards",
"description": "",
"operationId": "get-team-boards",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 10
}
},
{
"name": "offset",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 0
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/boards": {
"post": {
"tags": [],
"summary": "Create Board",
"description": "",
"operationId": "create-board",
"parameters": [
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "",
"default": "Untitled"
},
"description": {
"type": "string",
"description": ""
},
"sharingPolicy": {
"type": "string",
"description": "**sharingPolicy.access** can be `private`, `view`, `comment` </br> **sharingPolicy.teamAccess** can be `private`, `view`, `comment`, `edit`",
"default": "{ \"access\" : \"private\", \"teamAccess\" : \"private\" }",
"format": "json"
}
}
}
}
}
},
"deprecated": false
}
},
"/teams/{id}": {
"get": {
"tags": [],
"summary": "Get Team",
"description": "",
"operationId": "get-team",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"patch": {
"tags": [],
"summary": "Update Team",
"description": "",
"operationId": "update-team",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": ""
}
}
}
}
}
},
"deprecated": false
}
},
"/boards/{id}/widgets/": {
"get": {
"tags": [],
"summary": "List All Widgets",
"description": "",
"operationId": "get-board-widgets-1",
"parameters": [
{
"name": "id",
"in": "path",
"description": "board id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "widgetType",
"in": "query",
"description": "Filter widgets by type",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/users/me": {
"get": {
"tags": [],
"summary": "Get Current User",
"description": "",
"operationId": "get-current-user",
"parameters": [
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"patch": {
"tags": [],
"summary": "Update Current User",
"description": "",
"operationId": "update-current-user",
"parameters": [
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": ""
}
}
}
}
}
},
"deprecated": false
}
},
"/users/{id}": {
"get": {
"tags": [],
"summary": "Get User",
"description": "",
"operationId": "get-user",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/{type}/{id}/picture": {
"delete": {
"tags": [],
"summary": "Delete Picture",
"description": "",
"operationId": "delete-picture",
"parameters": [
{
"name": "type",
"in": "path",
"description": "Type of picture's parental object (must be one of ```boards```,```users```,```teams```)",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "id",
"in": "path",
"description": "Identifier of picture's parental object ([User Object](ref:user-object), [Board Object](ref:board-object) or [Team Object](ref:team-object))",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"post": {
"tags": [],
"summary": "Create or Update Picture",
"description": "",
"operationId": "create-or-update-picture",
"parameters": [
{
"name": "type",
"in": "path",
"description": "Type of picture's parental object (must be one of ```boards```,```users```,```teams```)",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "id",
"in": "path",
"description": "Identifier of picture's parental object ([User Object](ref:user-object), [Board Object](ref:board-object) or [Team Object](ref:team-object))",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "Content-Type",
"in": "header",
"description": "Must be ```multipart/form-data```",
"required": false,
"schema": {
"type": "string",
"default": "multipart/form-data"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"image"
],
"properties": {
"image": {
"type": "string",
"description": "",
"format": "binary"
}
}
}
}
}
},
"deprecated": false
},
"get": {
"tags": [],
"summary": "Get Picture",
"description": "",
"operationId": "get-picture",
"parameters": [
{
"name": "type",
"in": "path",
"description": "Type of picture's parental object (must be one of ```boards```,```users```,```teams```)",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "id",
"in": "path",
"description": "Identifier of picture's parental object ([User Object](#user-object), [Board Object](#board-object) or [Team Object](#account-object))",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "redirect",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string",
"default": "false"
}
},
{
"name": "size",
"in": "query",
"description": "Must be one of ```26```, ```44```, ```50```, ```140```, ```180```, ```210```, ```420```.",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 210
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/audit/logs": {
"get": {
"tags": [],
"summary": "Get logs",
"description": "",
"operationId": "get-logs",
"parameters": [
{
"name": "createdAfter",
"in": "query",
"description": "yyyy-MM-ddThh:mm:ss.SSSZ",
"required": true,
"schema": {
"type": "string",
"format": "date"
}
},
{
"name": "createdBefore",
"in": "query",
"description": "yyyy-MM-ddThh:mm:ss.SSSZ",
"required": true,
"schema": {
"type": "string",
"format": "date"
}
},
{
"name": "limit",
"in": "query",
"description": "Max value is 500",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 10
}
},
{
"name": "offset",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 0
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/boards/{id}/widgets": {
"post": {
"tags": [],
"summary": "Create Widget",
"description": "",
"operationId": "create-board-widgets",
"parameters": [
{
"name": "id",
"in": "path",
"description": "board id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"RAW_BODY": {
"type": "string",
"description": "widget representation, paste json from the example to try",
"default": "{ \"type\": \"card\", \"title\": \"Simple card\" }",
"format": "json"
}
}
}
}
}
},
"deprecated": false
}
},
"/boards/{id}/widgets/{widgetId}": {
"patch": {
"tags": [],
"summary": "Update Widget",
"description": "",
"operationId": "update-board-widgets",
"parameters": [
{
"name": "id",
"in": "path",
"description": "board id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "widgetId",
"in": "path",
"description": "widget id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"RAW_BODY": {
"type": "string",
"description": "Partial widget representation",
"default": "",
"format": "json"
}
}
}
}
}
},
"deprecated": false
},
"delete": {
"tags": [],
"summary": "Delete Widgets",
"description": "",
"operationId": "delete-board-widgets",
"parameters": [
{
"name": "id",
"in": "path",
"description": "board id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "widgetId",
"in": "path",
"description": "widget id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"get": {
"tags": [],
"summary": "Get Widget",
"description": "",
"operationId": "get-board-widget",
"parameters": [
{
"name": "id",
"in": "path",
"description": "board id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "widgetId",
"in": "path",
"description": "widget id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/board-user-connections/{id}": {
"delete": {
"tags": [],
"summary": "Delete Board User Connection",
"description": "",
"operationId": "delete-board-user-connection",
"parameters": [],
"requestBody": null,
"deprecated": false
},
"get": {
"tags": [],
"summary": "Get Board User Connection",
"description": "",
"operationId": "get-board-user-connection",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"patch": {
"tags": [],
"summary": "Update Board User Connection",
"description": "",
"operationId": "update-board-user-connection",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"role": {
"type": "string",
"description": "Value can be ```viewer```, ```commenter```, ```editor```, ```owner```"
}
}
}
}
}
},
"deprecated": false
}
},
"/teams/{id}/user-connections": {
"get": {
"tags": [],
"summary": "List all Team Members",
"description": "",
"operationId": "get-team-user-connections",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 10
}
},
{
"name": "offset",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 0
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/oauth-token": {
"get": {
"tags": [],
"summary": "Get Authorization",
"description": "",
"operationId": "get-authorization",
"parameters": [
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/team-user-connections/{id}": {
"get": {
"tags": [],
"summary": "Get Team User Connection",
"description": "",
"operationId": "get-team-user-connection",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
},
"patch": {
"tags": [],
"summary": "Update Team User Connection",
"description": "",
"operationId": "update-team-user-connection",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fields",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"role": {
"type": "string",
"description": "Values can be `non_team`,`member` or `admin`"
}
}
}
}
}
},
"deprecated": false
},
"delete": {
"tags": [],
"summary": "Delete Team User Connection",
"description": "",
"operationId": "delete-team-user-connection",
"parameters": [],
"requestBody": null,
"deprecated": false
}
},
"/boards/{id}/share": {
"post": {
"tags": [],
"summary": "Share Board",
"description": "",
"operationId": "share-board",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"emails",
"role"
],
"properties": {
"emails": {
"type": "array",
"description": "Array of emails of users who you want to invite to the board. These users can be registered or non-registered.",
"items": {
"type": "string"
}
},
"role": {
"type": "string",
"description": "Value can be `viewer`, `commenter`, `editor`"
},
"message": {
"type": "string",
"description": "The message which will be sent to users. This parameter is optional."
},
"teamInvitationStrategy": {
"type": "string",
"description": "Value can be `invite_when_required`, `off`. This parameter is optional. Value `off` will be used by default.",
"default": "off"
}
}
}
}
}
},
"deprecated": false
}
},
"/boards/{id}/user-connections": {
"get": {
"tags": [],
"summary": "Get Board members",
"description": "Retrieves a list of team members who have access to the selected board.",
"operationId": "get-board-user-connections",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 10
}
},
{
"name": "offset",
"in": "query",
"description": "",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 0
}
}
],
"requestBody": null,
"deprecated": false
}
},
"/teams/{id}/invite": {
"post": {
"tags": [],
"summary": "Invite To Team",
"description": "",
"operationId": "invite-to-team",
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"emails": {
"type": "array",
"description": "Array of emails",
"items": {
"type": "string"
}
}
}
}
}
}
},
"deprecated": false
}
},
"/teams/{id}/user-connections/me": {
"get": {
"tags": [],
"summary": "Get Team Current User Connection",
"description": "",
"operationId": "get-team-current-user-connection",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Team ID",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": null,
"deprecated": false
}
}
},
"x-headers": [],
"x-explorer-enabled": true,
"x-proxy-enabled": true,
"x-samples-enabled": true,
"x-samples-languages": [
"curl",
"node",
"ruby",
"javascript",
"python"
]
}

 

Badge

Hi!

For those who come across this post, the @mirohq/miro-api package could be what you are searching for, it includes this OpenAPI spec:
https://github.com/miroapp/api-clients/blob/main/packages/generator/spec.json

I believe the package also contains TS code generated with the OpenAPI Generator.

Reply