Skip to content

Commit

Permalink
DX-1307 Rename the package to @mirohq/miro-api
Browse files Browse the repository at this point in the history
  • Loading branch information
janza committed Jul 11, 2023
1 parent 60a3e48 commit 56ba0e9
Show file tree
Hide file tree
Showing 223 changed files with 36 additions and 36 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Miro API clients

This repository contains Miro API clients and the tools needed to generate them, based on the OpenAPI specification (OAS).
Currently, the only available client is the [Node.js client](./packages/typescript-node), written in [TypeScript](https://www.typescriptlang.org/).
Currently, the only available client is the [Node.js client](./packages/miro-api), written in [TypeScript](https://www.typescriptlang.org/).

## Install dependencies

Expand All @@ -25,9 +25,9 @@ To update the `spec.json` specs file, run the following command:
yarn update-spec
```

## Generate the `typescript-node` client
## Generate the `miro-api` client

To generate the `typescript-node` client, run the following command:
To generate the `miro-api` client, run the following command:

```bash
yarn generate
Expand All @@ -42,7 +42,7 @@ The command produces:
### 1. Low-level client methods

The command generates low-level code in the `api` and `model` subdirectories.
This command runs `openapi-generator-cli` with the `typescript-node` generator, based on the Mustache template files in the `typescript-node-template` directory.
This command runs `openapi-generator-cli` with the `miro-api` generator, based on the Mustache template files in the `miro-api-template` directory.

### 2. High-level client methods and models

Expand All @@ -53,7 +53,7 @@ To customize autogenerated models:

1. Define additional classes in the `highlevel` directory.
2. Update the extended [model definition](/packages/generator/modelDefinition.ts) to point to the new file. \
To view an example, see [`packages/typescript-node/highlevel/Team.ts`](/packages/typescript-node/highlevel/Team.ts) for an example.
To view an example, see [`packages/miro-api/highlevel/Team.ts`](/packages/miro-api/highlevel/Team.ts) for an example.

To view the generated model hierarchy, see [MODELS.md](./MODELS.md).

Expand All @@ -75,7 +75,7 @@ The resulting static HTML files and their related assets are in the `docs-out` d

## Publish the client

When the version in `package.json` changes, the [`publish`](https://github.com/miroapp/api-clients/actions/workflows/publish.yml) GitHub action publishes the `packages/typescript-node` content to the *npm* registry as [`@mirohq/miro-node`](https://www.npmjs.com/package/@mirohq/miro-node).
When the version in `package.json` changes, the [`publish`](https://github.com/miroapp/api-clients/actions/workflows/publish.yml) GitHub action publishes the `packages/miro-api` content to the *npm* registry as [`@mirohq/miro-api`](https://www.npmjs.com/package/@mirohq/miro-api).

## Publish the documentation

Expand Down
2 changes: 1 addition & 1 deletion apps/client-test-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as dotenv from 'dotenv'

dotenv.config()
import express from 'express'
import {Miro} from '@mirohq/miro-node'
import {Miro} from '@mirohq/miro-api'

const app = express()

Expand Down
2 changes: 1 addition & 1 deletion apps/client-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"express": "^4.18.1"
},
"peerDependencies": {
"@mirohq/miro-node": "*"
"@mirohq/miro-api": "*"
},
"devDependencies": {
"ejs": "^3.1.8",
Expand Down
2 changes: 1 addition & 1 deletion apps/fastify/fastify.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Miro} from '@mirohq/miro-node'
import {Miro} from '@mirohq/miro-api'
import Fastify from 'fastify'
import fastifyCookie from '@fastify/cookie'

Expand Down
6 changes: 3 additions & 3 deletions packages/generator/highlevelModelGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import * as ts from 'typescript'
import path from 'path'
import {Model, ModelProps} from './modelDefinition'

import {MiroApi} from '../typescript-node/api/apis'
import {MiroApi} from '../miro-api/api/apis'

const filePath = path.resolve('../typescript-node/api/')
const filePath = path.resolve('../miro-api/api/')
const program = ts.createProgram([filePath], {})
const source = program.getSourceFile('../typescript-node/api/apis.ts')
const source = program.getSourceFile('../miro-api/api/apis.ts')

const text = source.getFullText(source)

Expand Down
4 changes: 2 additions & 2 deletions packages/generator/scripts/generate-node-client.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail

target=../typescript-node
target=../miro-api

rm -rf "$target/"{api,model}
openapi-generator-cli generate -i 'spec.json' -o "${target}" -g 'typescript-node' -t './typescript-node-template' -p 'npmName=@mirohq/miro-node' -p "npmVersion=$(jq .version < ../../packages/typescript-node/package.json)"
openapi-generator-cli generate -i 'spec.json' -o "${target}" -g 'typescript-node' -t './typescript-node-template' -p 'npmName=@mirohq/miro-api' -p "npmVersion=$(jq .version < ../../packages/miro-api/package.json)"

./scripts/remove_duplicate_imports.sh

Expand Down
2 changes: 1 addition & 1 deletion packages/generator/scripts/remove_duplicate_imports.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

file=../typescript-node/api/apis.ts
file=../miro-api/api/apis.ts
tmpfile=_newapi.ts

awk '/import/ { if (!a[$0]++) print $0 } !/import/ { print $0}' "$file" > "$tmpfile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export async function makeJsonRequest(token: string, method: string, url: URL, b
const options: RequestInit = {
method,
headers: {
'User-Agent': `miro-node:${version}`,
'User-Agent': `miro-api:${version}`,
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can use the client to implement backend functionality in your Miro app, such
To install the Miro Node.js API client and its dependencies, run the following command in your project root directory:

```bash
npm install @miro/miro-node
npm install @miro/miro-api
```

## Import the clients
Expand All @@ -37,7 +37,7 @@ To start using the high-level `Miro` client, import it, and then create a new in

```typescript
// Import the 'Miro' object
import {Miro} from "@mirohq/miro-node"
import {Miro} from "@mirohq/miro-api"

// Create a new instance of the Miro object
const miro = new Miro()
Expand Down Expand Up @@ -154,7 +154,7 @@ By default, the client loads the app configuration from the following environmen
Alternatively, you can pass these values to the constructor when you create a new `Miro` instance:

```typescript
import {Miro} from '@mirohq/miro-node'
import {Miro} from '@mirohq/miro-api'

const miro = new Miro({
clientId: '<your_app_client_id>>',
Expand All @@ -177,7 +177,7 @@ For more information about the available options related to authorization, see t
This example implements a simple app using the [Fastify](https://www.fastify.io/) framework:

```javascript
import {Miro} from '@mirohq/miro-node'
import {Miro} from '@mirohq/miro-api'
import Fastify from 'fastify'
import fastifyCookie from '@fastify/cookie'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3798,7 +3798,7 @@ export async function makeJsonRequest(
const options: RequestInit = {
method,
headers: {
'User-Agent': `miro-node:${version}`,
'User-Agent': `miro-api:${version}`,
Accept: 'application/json',
Authorization: `Bearer ${token}`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class MiroThemeContext extends DefaultThemeRenderContext {
<div class="tree-content">
<a class="tsd-index-link" href={this.relativeURL('./index.html')}>
{this.icons[ReflectionKind.Module]()}
@mirohq/miro-node
@mirohq/miro-api
</a>
<Navigation items={items} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ npm init -y
Install the Miro Node.js client library, the Express web framework, and its dependencies:

```bash
npm install @mirohq/miro-node express express-session
npm install @mirohq/miro-api express express-session
```

### Step 4: import and initialize dependencies
Expand All @@ -73,7 +73,7 @@ Now it's time to take care of the initial setup of your project:
To work with the Miro Node.js client library and the Express web framework, you need to import and initialize the corresponding libraries:

```javascript
const {Miro} = require('@mirohq/miro-node')
const {Miro} = require('@mirohq/miro-api')
const express = require('express')
const session = require('express-session')
```
Expand Down Expand Up @@ -208,7 +208,7 @@ To verify that the app is running, open [http://127.0.0.1:4000](http://127.0.0.1

```javascript
const express = require('express')
const {Miro} = require('@mirohq/miro-node')
const {Miro} = require('@mirohq/miro-api')
const session = require('express-session')

const miro = new Miro()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Alternatively, set appropriate custom values.
Install the Miro Node.js client library:

```bash
npm install @mirohq/miro-node
npm install @mirohq/miro-api
```

### Step 4: create the project file
Expand All @@ -76,7 +76,7 @@ Now it's time to set up your project:
2. Copy the following code snippet, and paste it to the newly created `index.js` file:

```javascript
const {MiroApi} = require('@mirohq/miro-node')
const {MiroApi} = require('@mirohq/miro-api')
const api = new MiroApi('<YOUR_APP_ACCESS_TOKEN>')

const app = (async function () {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {ConnectorCreationData} from '@mirohq/miro-node/model/connectorCreationData'
import type {ItemConnectionCreationData} from '@mirohq/miro-node/model/itemConnectionCreationData'
import type {ConnectorCreationData} from '../model/connectorCreationData'
import type {ItemConnectionCreationData} from '../model/itemConnectionCreationData'
import {GenericItem} from '../model/genericItem'
import {MiroApi} from '../api'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Miro {
assert(this.clientSecret, 'MIRO_CLIENT_SECRET or options.clientSecret is required')
assert(this.redirectUrl, 'MIRO_REDIRECT_URL or options.redirectUrl is required')
if (this.storage instanceof InMemoryStorage) {
console.warn('miro-node: Default storage is not recommended, consider using a custom storage implementation')
console.warn('miro-api: Default storage is not recommended, consider using a custom storage implementation')
}
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@mirohq/miro-node",
"name": "@mirohq/miro-api",
"version": "0.0.1-alpha.10",
"description": "NodeJS client for Miro's REST API",
"repository": {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"entryPoints": ["index.ts", "api/apis.ts"],
"gitRevision": "main",
"markedOptions": {
"baseUrl": "https://miroapp.github.io/api-clients/typescript-node/"
"baseUrl": "https://miroapp.github.io/api-clients/miro-api/"
},
"exclude": ["__tests__", "test", ".turbo", "../../node_modules/"],
"excludeExternals": true,
Expand Down
8 changes: 4 additions & 4 deletions scripts/upload-docs-to-readme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ await updateDoc(
'node-api-client',
'Node.js Api Client',
categoryId,
'./packages/typescript-node/README.md'
'./packages/miro-api/README.md'
)

await updateDoc(
'get-started-with-nodejs-api-client',
'Miro Node.js client quickstart guide (Automation use case)',
categoryId,
'packages/typescript-node/docs/quickstart.md'
'packages/miro-api/docs/quickstart.md'
)

await updateDoc(
'authorization-quickstart',
'Miro Node.js client quickstart guide (Using OAuth 2.0 and Express framework)',
categoryId,
'packages/typescript-node/docs/quickstart-auth.md'
'packages/miro-api/docs/quickstart-auth.md'
)


await updateDoc(
'storage-implementation',
'Storage implementation',
categoryId,
'packages/typescript-node/docs/implementing-storage.md'
'packages/miro-api/docs/implementing-storage.md'
)

0 comments on commit 56ba0e9

Please sign in to comment.