Create Lark package

monorepo/app-store-lark
Joe Au-Yeung 2022-03-10 10:07:54 -05:00
parent 26db39f98b
commit 5ba094964d
9 changed files with 201 additions and 1297 deletions

View File

@ -0,0 +1,39 @@
Since Cal.com is open source we encourage developers to create new apps for others to use. This guide is to help you get started.
## Structure
All apps can be found under `packages/app-store`. In this folder is `_example` which shows the general structure of an app.
```
_example
| index.ts
| package.json
| .env.example
|
|---api
| | example.ts
| | index.ts
|
|---lib
| | adaptor.ts
| | index.ts
|
|---static
| | icon.svg
```
## Getting Started
In the `package.json` name your package appropriately and list the dependencies needed for the package.
Next in the `.env.example` specify the environmental variables (ex. auth token, API secrets) that your app will need. In a comment add a link to instructions on how to obtain the credentials. Create a `.env` with your the filled in environmental variables.
In `index.js` fill out the meta data that will be rendered on the app page. Under `packages/app-store/index.ts`, import your app and add it under `appStore`. Your app should now appear in the app store.
Under the `/api` folder, this is where any API calls that are associated with your app will be handled. Since cal.com uses Next.js we use dynamic API routes. In this example if we want to hit `/api/example.ts` the route would be `{BASE_URL}/api/integrations/_example/example`. Export your endpoints in an `index.ts` file under `/api` folder and import them in your main `index.ts` file.
The `/lib` folder is where the functions of your app live. For example, when creating a booking with a MS Teams link the function to make the call to grab the link lives in the `/lib` folder. Export your endpoints in an `index.ts` file under `/lib` folder and import them in your main `index.ts` file.
The `/static` folder is where your assets live.
If you need any help feel free to join us on Slack: <https://cal.com/slack>

View File

@ -0,0 +1,10 @@
import type { NextApiRequest, NextApiResponse } from "next";
/**
* This is an example endoint for an app, these will run under `/api/integrations/[...args]`
* @param req
* @param res
*/
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
res.status(200);
}

View File

@ -0,0 +1 @@
export { default as example } from "./example";

View File

@ -0,0 +1,26 @@
import type { App } from "@calcom/types/App";
import _package from "./package.json";
export const metadata = {
name: _package.name,
description: _package.description,
installed: true,
category: "video",
imageSrc: "cal-com-icon.svg",
label: "Example App",
logo: "cal-com-icon.svg",
publisher: "Cal.com",
rating: 5,
reviews: 69,
slug: "example_video",
title: "Example App",
trending: true,
type: "example_video",
url: "https://cal.com/",
variant: "conferencing",
verified: true,
} as App;
export * as api from "./api";
export * as lib from "./lib";

View File

@ -0,0 +1,36 @@
import type { VideoApiAdapterFactory } from "@calcom/types/VideoApiAdapter";
/** This is a barebones factory function for a video integration */
const ExampleVideoApiAdapter: VideoApiAdapterFactory = (credential) => {
return {
getAvailability: async () => {
try {
return [];
} catch (err) {
console.error(err);
return [];
}
},
createMeeting: async (event) => {
return Promise.resolve({
type: "example_video",
id: "",
password: "",
url: "",
});
},
deleteMeeting: async (uid) => {
return Promise.resolve();
},
updateMeeting: async (bookingRef, event) => {
return Promise.resolve({
type: "example_video",
id: bookingRef.meetingId as string,
password: bookingRef.meetingPassword as string,
url: bookingRef.meetingUrl as string,
});
},
};
};
export default ExampleVideoApiAdapter;

View File

@ -0,0 +1 @@
export { default as VideoApiAdapter } from "./VideoApiAdapter";

View File

@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"name": "@calcom/example-app",
"version": "0.0.0",
"main": "./index.ts",
"description": "This is a brief description for the Example App.",
"dependencies": {
"@calcom/prisma": "*"
},
"devDependencies": {
"@calcom/types": "*"
}
}

View File

@ -0,0 +1,6 @@
<svg width="56" height="56" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="56" height="56" rx="12" fill="#292929" />
<path
d="M18.628 36.781c2.846 0 4.946-1.096 6.183-2.59l-2.38-2.03c-.957 1.05-2.147 1.587-3.733 1.587-3.22 0-5.204-2.427-5.204-5.413 0-2.987 1.984-5.46 5.134-5.46 1.47 0 2.683.513 3.663 1.54l2.31-2.007c-1.47-1.75-3.313-2.567-5.973-2.567-5.04 0-8.517 3.803-8.517 8.493 0 4.667 3.663 8.447 8.517 8.447ZM31.69 36.781c2.17 0 3.267-.91 3.92-2.286v1.983h3.057V24.344H35.54v1.914c-.653-1.307-1.75-2.17-3.85-2.17-3.337 0-5.997 2.87-5.997 6.37s2.66 6.323 5.997 6.323Zm-2.847-6.346c0-1.89 1.354-3.5 3.36-3.5 2.077 0 3.407 1.633 3.407 3.523 0 1.89-1.33 3.477-3.407 3.477-2.006 0-3.36-1.657-3.36-3.5ZM41.472 36.478h3.15V19.444h-3.15v17.034Z"
fill="#fff" />
</svg>

After

Width:  |  Height:  |  Size: 806 B

1365
yarn.lock

File diff suppressed because it is too large Load Diff