Skip to content

Commit

Permalink
chore: SDK Fixes and add swagger docs (calcom#14218)
Browse files Browse the repository at this point in the history
* chore: fixes and add swagger docs

* chore: add script
  • Loading branch information
exception authored Apr 2, 2024
1 parent 306f53d commit 9451f38
Show file tree
Hide file tree
Showing 3 changed files with 883 additions and 8 deletions.
4 changes: 3 additions & 1 deletion packages/platform/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
],
"scripts": {
"build": "rollup -c --bundleConfigAsCjs",
"release": "release-it --only-version"
"release": "release-it --only-version",
"generate-types": "openapi-typescript http://localhost:5555/docs-yaml -o ./src/swagger-types.d.ts"
},
"packageManager": "[email protected]",
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"openapi-typescript": "^6.7.5",
"release-it": "^17.1.1",
"rollup": "^4.12.0",
"rollup-plugin-bundle-size": "^1.0.3",
Expand Down
10 changes: 3 additions & 7 deletions packages/platform/sdk/src/endpoints/events/event-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import type { BasicPlatformResponse } from "../../../types";
import { EndpointHandler } from "../../endpoint-handler";
import type { CreateEventTypeArgs, EventType, GetEventTypeByIdArgs } from "./types";

type BodyWithEventTypeResponse = {
eventType: EventType;
};

export class EventTypes extends EndpointHandler {
constructor(private readonly sdk: CalSdk) {
super("event-types", sdk);
Expand All @@ -16,20 +12,20 @@ export class EventTypes extends EndpointHandler {
async createEventType(args: CreateEventTypeArgs): Promise<EventType> {
this.assertAccessToken("createEventType");

const { data } = await this.sdk.httpCaller.post<BasicPlatformResponse<BodyWithEventTypeResponse>>(
const { data } = await this.sdk.httpCaller.post<BasicPlatformResponse<EventType>>(
Endpoints.CREATE_EVENT_TYPE,
{
body: args,
}
);

return data.eventType;
return data;
}

async getEventType(args: GetEventTypeByIdArgs): Promise<EventType> {
this.assertAccessToken("getEventType");

const { data } = await this.sdk.httpCaller.get<BasicPlatformResponse<BodyWithEventTypeResponse>>(
const { data } = await this.sdk.httpCaller.get<BasicPlatformResponse<EventType>>(
Endpoints.GET_EVENT_TYPE_BY_ID,
{
urlParams: [args.id],
Expand Down
Loading

0 comments on commit 9451f38

Please sign in to comment.