chore: remove /ee from apiv2 urls (#14568)
* chore: remove /ee from apiv2 urls * fixup! chore: remove /ee from apiv2 urls * chore: remove /ee from apiv2 urls * fixup! chore: remove /ee from apiv2 urls * fixup! fixup! chore: remove /ee from apiv2 urls * fixup! fixup! fixup! chore: remove /ee from apiv2 urls
This commit is contained in:
@@ -7,6 +7,9 @@ export class RewriterMiddleware implements NestMiddleware {
|
||||
if (req.url.startsWith("/api/v2")) {
|
||||
req.url = req.url.replace("/api/v2", "/v2");
|
||||
}
|
||||
if (req.url.startsWith("/v2/ee")) {
|
||||
req.url = req.url.replace("/v2/ee", "/v2");
|
||||
}
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ describe("Bookings Endpoints", () => {
|
||||
};
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.post("/api/v2/ee/bookings")
|
||||
.post("/v2/bookings")
|
||||
.send(body)
|
||||
.expect(201)
|
||||
.then(async (response) => {
|
||||
@@ -138,7 +138,7 @@ describe("Bookings Endpoints", () => {
|
||||
|
||||
it("should get bookings", async () => {
|
||||
return request(app.getHttpServer())
|
||||
.get("/api/v2/ee/bookings?filters[status]=upcoming")
|
||||
.get("/v2/bookings?filters[status]=upcoming")
|
||||
.then((response) => {
|
||||
console.log("asap responseBody", JSON.stringify(response.body, null, 2));
|
||||
const responseBody: GetBookingsOutput = response.body;
|
||||
@@ -159,7 +159,7 @@ describe("Bookings Endpoints", () => {
|
||||
|
||||
it("should get booking", async () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/api/v2/ee/bookings/${createdBooking.uid}`)
|
||||
.get(`/v2/bookings/${createdBooking.uid}`)
|
||||
.then((response) => {
|
||||
const responseBody: GetBookingOutput = response.body;
|
||||
const bookingInfo = responseBody.data;
|
||||
@@ -199,7 +199,7 @@ describe("Bookings Endpoints", () => {
|
||||
// };
|
||||
|
||||
// return request(app.getHttpServer())
|
||||
// .post("/api/v2/ee/bookings/reccuring")
|
||||
// .post("/v2/bookings/reccuring")
|
||||
// .send(body)
|
||||
// .expect(201)
|
||||
// .then((response) => {
|
||||
@@ -231,7 +231,7 @@ describe("Bookings Endpoints", () => {
|
||||
// };
|
||||
|
||||
// return request(app.getHttpServer())
|
||||
// .post("/api/v2/ee/bookings/instant")
|
||||
// .post("/v2/bookings/instant")
|
||||
// .send(body)
|
||||
// .expect(201)
|
||||
// .then((response) => {
|
||||
@@ -250,7 +250,7 @@ describe("Bookings Endpoints", () => {
|
||||
};
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.post(`/api/v2/ee/bookings/${bookingId}/cancel`)
|
||||
.post(`/v2/bookings/${bookingId}/cancel`)
|
||||
.send(body)
|
||||
.expect(201)
|
||||
.then((response) => {
|
||||
|
||||
@@ -68,7 +68,7 @@ const DEFAULT_PLATFORM_PARAMS = {
|
||||
};
|
||||
|
||||
@Controller({
|
||||
path: "ee/bookings",
|
||||
path: "/bookings",
|
||||
version: "2",
|
||||
})
|
||||
@UseGuards(PermissionsGuard)
|
||||
|
||||
@@ -11,7 +11,7 @@ import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
import { CalendarBusyTimesInput } from "@calcom/platform-types";
|
||||
|
||||
@Controller({
|
||||
path: "ee/calendars",
|
||||
path: "/calendars",
|
||||
version: "2",
|
||||
})
|
||||
@UseGuards(AccessTokenGuard)
|
||||
|
||||
@@ -85,14 +85,14 @@ describe("Platform Gcal Endpoints", () => {
|
||||
|
||||
it(`/GET/ee/gcal/oauth/auth-url: it should respond 401 with invalid access token`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(`/api/v2/ee/gcal/oauth/auth-url`)
|
||||
.get(`/v2/gcal/oauth/auth-url`)
|
||||
.set("Authorization", `Bearer invalid_access_token`)
|
||||
.expect(401);
|
||||
});
|
||||
|
||||
it(`/GET/ee/gcal/oauth/auth-url: it should auth-url to google oauth with valid access token `, async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.get(`/api/v2/ee/gcal/oauth/auth-url`)
|
||||
.get(`/v2/gcal/oauth/auth-url`)
|
||||
.set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
.set("Origin", CLIENT_REDIRECT_URI)
|
||||
.expect(200);
|
||||
@@ -103,7 +103,7 @@ describe("Platform Gcal Endpoints", () => {
|
||||
it(`/GET/ee/gcal/oauth/save: without oauth code`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(
|
||||
`/api/v2/ee/gcal/oauth/save?state=accessToken=${accessTokenSecret}&origin%3D${CLIENT_REDIRECT_URI}&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
`/v2/gcal/oauth/save?state=accessToken=${accessTokenSecret}&origin%3D${CLIENT_REDIRECT_URI}&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
)
|
||||
.expect(400);
|
||||
});
|
||||
@@ -111,7 +111,7 @@ describe("Platform Gcal Endpoints", () => {
|
||||
it(`/GET/ee/gcal/oauth/save: without access token`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(
|
||||
`/api/v2/ee/gcal/oauth/save?state=origin%3D${CLIENT_REDIRECT_URI}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
`/v2/gcal/oauth/save?state=origin%3D${CLIENT_REDIRECT_URI}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
)
|
||||
.expect(400);
|
||||
});
|
||||
@@ -119,25 +119,25 @@ describe("Platform Gcal Endpoints", () => {
|
||||
it(`/GET/ee/gcal/oauth/save: without origin`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(
|
||||
`/api/v2/ee/gcal/oauth/save?state=accessToken=${accessTokenSecret}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
`/v2/gcal/oauth/save?state=accessToken=${accessTokenSecret}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
)
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it(`/GET/ee/gcal/check with access token but without origin`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(`/api/v2/ee/gcal/check`)
|
||||
.get(`/v2/gcal/check`)
|
||||
.set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it(`/GET/ee/gcal/check without access token`, async () => {
|
||||
await request(app.getHttpServer()).get(`/api/v2/ee/gcal/check`).expect(401);
|
||||
await request(app.getHttpServer()).get(`/v2/gcal/check`).expect(401);
|
||||
});
|
||||
|
||||
it(`/GET/ee/gcal/check with access token and origin but no credentials`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(`/api/v2/ee/gcal/check`)
|
||||
.get(`/v2/gcal/check`)
|
||||
.set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
.set("Origin", CLIENT_REDIRECT_URI)
|
||||
.expect(400);
|
||||
@@ -151,7 +151,7 @@ describe("Platform Gcal Endpoints", () => {
|
||||
"google-calendar"
|
||||
);
|
||||
await request(app.getHttpServer())
|
||||
.get(`/api/v2/ee/gcal/check`)
|
||||
.get(`/v2/gcal/check`)
|
||||
.set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
.set("Origin", CLIENT_REDIRECT_URI)
|
||||
.expect(200);
|
||||
|
||||
@@ -44,7 +44,7 @@ const CALENDAR_SCOPES = [
|
||||
|
||||
// Controller for the GCalConnect Atom
|
||||
@Controller({
|
||||
path: "ee/gcal",
|
||||
path: "/gcal",
|
||||
version: "2",
|
||||
})
|
||||
@DocsTags("Google Calendar")
|
||||
@@ -60,7 +60,7 @@ export class GcalController {
|
||||
private readonly calendarsService: CalendarsService
|
||||
) {}
|
||||
|
||||
private redirectUri = `${this.config.get("api.url")}/ee/gcal/oauth/save`;
|
||||
private redirectUri = `${this.config.get("api.url")}/gcal/oauth/save`;
|
||||
|
||||
@Get("/oauth/auth-url")
|
||||
@HttpCode(HttpStatus.OK)
|
||||
|
||||
@@ -71,7 +71,7 @@ describe("Me Endpoints", () => {
|
||||
|
||||
it("should get user associated with access token", async () => {
|
||||
return request(app.getHttpServer())
|
||||
.get("/api/v2/ee/me")
|
||||
.get("/v2/me")
|
||||
.expect(200)
|
||||
.then((response) => {
|
||||
const responseBody: ApiSuccessResponse<UserResponse> = response.body;
|
||||
@@ -90,7 +90,7 @@ describe("Me Endpoints", () => {
|
||||
const body: UpdateManagedUserInput = { timeZone: "Europe/Rome" };
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.patch("/api/v2/ee/me")
|
||||
.patch("/v2/me")
|
||||
.send(body)
|
||||
.expect(200)
|
||||
.then(async (response) => {
|
||||
@@ -114,22 +114,19 @@ describe("Me Endpoints", () => {
|
||||
it("should not update user associated with access token given invalid timezone", async () => {
|
||||
const bodyWithIncorrectTimeZone: UpdateManagedUserInput = { timeZone: "Narnia/Woods" };
|
||||
|
||||
return request(app.getHttpServer()).patch("/api/v2/ee/me").send(bodyWithIncorrectTimeZone).expect(400);
|
||||
return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectTimeZone).expect(400);
|
||||
});
|
||||
|
||||
it("should not update user associated with access token given invalid time format", async () => {
|
||||
const bodyWithIncorrectTimeFormat: UpdateManagedUserInput = { timeFormat: 100 };
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.patch("/api/v2/ee/me")
|
||||
.send(bodyWithIncorrectTimeFormat)
|
||||
.expect(400);
|
||||
return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectTimeFormat).expect(400);
|
||||
});
|
||||
|
||||
it("should not update user associated with access token given invalid week start", async () => {
|
||||
const bodyWithIncorrectWeekStart: UpdateManagedUserInput = { weekStart: "waba luba dub dub" };
|
||||
|
||||
return request(app.getHttpServer()).patch("/api/v2/ee/me").send(bodyWithIncorrectWeekStart).expect(400);
|
||||
return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectWeekStart).expect(400);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { PROFILE_READ, PROFILE_WRITE, SUCCESS_STATUS } from "@calcom/platform-co
|
||||
import { userSchemaResponse } from "@calcom/platform-types";
|
||||
|
||||
@Controller({
|
||||
path: "ee/me",
|
||||
path: "/me",
|
||||
version: "2",
|
||||
})
|
||||
@UseGuards(AccessTokenGuard, PermissionsGuard)
|
||||
|
||||
@@ -20,7 +20,7 @@ import { ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
|
||||
@Controller({
|
||||
path: "ee/provider",
|
||||
path: "/provider",
|
||||
version: "2",
|
||||
})
|
||||
@DocsTags("Cal provider")
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth-clients/{clientId}/users": {
|
||||
"/v2/oauth-clients/{clientId}/users": {
|
||||
"get": {
|
||||
"operationId": "OAuthClientUsersController_getManagedUsers",
|
||||
"parameters": [
|
||||
@@ -90,7 +90,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth-clients/{clientId}/users/{userId}": {
|
||||
"/v2/oauth-clients/{clientId}/users/{userId}": {
|
||||
"get": {
|
||||
"operationId": "OAuthClientUsersController_getUserById",
|
||||
"parameters": [
|
||||
@@ -210,7 +210,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth-clients/{clientId}/users/{userId}/force-refresh": {
|
||||
"/v2/oauth-clients/{clientId}/users/{userId}/force-refresh": {
|
||||
"post": {
|
||||
"operationId": "OAuthClientUsersController_forceRefresh",
|
||||
"parameters": [
|
||||
@@ -248,7 +248,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth-clients": {
|
||||
"/v2/oauth-clients": {
|
||||
"post": {
|
||||
"operationId": "OAuthClientsController_createOAuthClient",
|
||||
"summary": "",
|
||||
@@ -302,7 +302,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth-clients/{clientId}": {
|
||||
"/v2/oauth-clients/{clientId}": {
|
||||
"get": {
|
||||
"operationId": "OAuthClientsController_getOAuthClientById",
|
||||
"summary": "",
|
||||
@@ -404,7 +404,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth/{clientId}/authorize": {
|
||||
"/v2/oauth/{clientId}/authorize": {
|
||||
"post": {
|
||||
"operationId": "OAuthFlowController_authorize",
|
||||
"summary": "Authorize an OAuth client",
|
||||
@@ -442,7 +442,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth/{clientId}/exchange": {
|
||||
"/v2/oauth/{clientId}/exchange": {
|
||||
"post": {
|
||||
"operationId": "OAuthFlowController_exchange",
|
||||
"summary": "Exchange authorization code for access tokens",
|
||||
@@ -495,7 +495,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/oauth/{clientId}/refresh": {
|
||||
"/v2/oauth/{clientId}/refresh": {
|
||||
"post": {
|
||||
"operationId": "OAuthFlowController_refreshAccessToken",
|
||||
"parameters": [
|
||||
@@ -543,7 +543,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/event-types": {
|
||||
"/v2/event-types": {
|
||||
"post": {
|
||||
"operationId": "EventTypesController_createEventType",
|
||||
"parameters": [],
|
||||
@@ -593,7 +593,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/event-types/{eventTypeId}": {
|
||||
"/v2/event-types/{eventTypeId}": {
|
||||
"get": {
|
||||
"operationId": "EventTypesController_getEventType",
|
||||
"parameters": [
|
||||
@@ -689,7 +689,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/event-types/{username}/{eventSlug}/public": {
|
||||
"/v2/event-types/{username}/{eventSlug}/public": {
|
||||
"get": {
|
||||
"operationId": "EventTypesController_getPublicEventType",
|
||||
"parameters": [
|
||||
@@ -743,7 +743,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/event-types/{username}/public": {
|
||||
"/v2/event-types/{username}/public": {
|
||||
"get": {
|
||||
"operationId": "EventTypesController_getPublicEventTypes",
|
||||
"parameters": [
|
||||
@@ -773,7 +773,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/gcal/oauth/auth-url": {
|
||||
"/v2/gcal/oauth/auth-url": {
|
||||
"get": {
|
||||
"operationId": "GcalController_redirect",
|
||||
"parameters": [
|
||||
@@ -803,7 +803,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/gcal/oauth/save": {
|
||||
"/v2/gcal/oauth/save": {
|
||||
"get": {
|
||||
"operationId": "GcalController_save",
|
||||
"parameters": [
|
||||
@@ -841,7 +841,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/gcal/check": {
|
||||
"/v2/gcal/check": {
|
||||
"get": {
|
||||
"operationId": "GcalController_check",
|
||||
"parameters": [],
|
||||
@@ -862,7 +862,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/provider/{clientId}": {
|
||||
"/v2/provider/{clientId}": {
|
||||
"get": {
|
||||
"operationId": "CalProviderController_verifyClientId",
|
||||
"parameters": [
|
||||
@@ -892,7 +892,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/provider/{clientId}/access-token": {
|
||||
"/v2/provider/{clientId}/access-token": {
|
||||
"get": {
|
||||
"operationId": "CalProviderController_verifyAccessToken",
|
||||
"parameters": [
|
||||
@@ -922,7 +922,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/schedules": {
|
||||
"/v2/schedules": {
|
||||
"post": {
|
||||
"operationId": "SchedulesController_createSchedule",
|
||||
"parameters": [],
|
||||
@@ -972,7 +972,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/schedules/default": {
|
||||
"/v2/schedules/default": {
|
||||
"get": {
|
||||
"operationId": "SchedulesController_getDefaultSchedule",
|
||||
"parameters": [],
|
||||
@@ -993,7 +993,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/schedules/{scheduleId}": {
|
||||
"/v2/schedules/{scheduleId}": {
|
||||
"get": {
|
||||
"operationId": "SchedulesController_getSchedule",
|
||||
"parameters": [
|
||||
@@ -1089,7 +1089,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/me": {
|
||||
"/v2/me": {
|
||||
"get": {
|
||||
"operationId": "MeController_getMe",
|
||||
"parameters": [],
|
||||
@@ -1139,7 +1139,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/calendars/busy-times": {
|
||||
"/v2/calendars/busy-times": {
|
||||
"get": {
|
||||
"operationId": "CalendarsController_getBusyTimes",
|
||||
"parameters": [],
|
||||
@@ -1160,7 +1160,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/calendars": {
|
||||
"/v2/calendars": {
|
||||
"get": {
|
||||
"operationId": "CalendarsController_getCalendars",
|
||||
"parameters": [],
|
||||
@@ -1181,7 +1181,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/bookings": {
|
||||
"/v2/bookings": {
|
||||
"get": {
|
||||
"operationId": "BookingsController_getBookings",
|
||||
"parameters": [
|
||||
@@ -1235,7 +1235,16 @@
|
||||
},
|
||||
"post": {
|
||||
"operationId": "BookingsController_createBooking",
|
||||
"parameters": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "x-cal-client-id",
|
||||
"required": true,
|
||||
"in": "header",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
@@ -1263,7 +1272,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/bookings/{bookingUid}": {
|
||||
"/v2/bookings/{bookingUid}": {
|
||||
"get": {
|
||||
"operationId": "BookingsController_getBooking",
|
||||
"parameters": [
|
||||
@@ -1293,7 +1302,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/bookings/{bookingUid}/reschedule": {
|
||||
"/v2/bookings/{bookingUid}/reschedule": {
|
||||
"get": {
|
||||
"operationId": "BookingsController_getBookingForReschedule",
|
||||
"parameters": [
|
||||
@@ -1323,7 +1332,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/bookings/{bookingId}/cancel": {
|
||||
"/v2/bookings/{bookingId}/cancel": {
|
||||
"post": {
|
||||
"operationId": "BookingsController_cancelBooking",
|
||||
"parameters": [
|
||||
@@ -1334,6 +1343,14 @@
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x-cal-client-id",
|
||||
"required": true,
|
||||
"in": "header",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
@@ -1363,10 +1380,19 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/bookings/reccuring": {
|
||||
"/v2/bookings/reccuring": {
|
||||
"post": {
|
||||
"operationId": "BookingsController_createReccuringBooking",
|
||||
"parameters": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "x-cal-client-id",
|
||||
"required": true,
|
||||
"in": "header",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
@@ -1397,10 +1423,19 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/ee/bookings/instant": {
|
||||
"/v2/bookings/instant": {
|
||||
"post": {
|
||||
"operationId": "BookingsController_createInstantBooking",
|
||||
"parameters": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "x-cal-client-id",
|
||||
"required": true,
|
||||
"in": "header",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
@@ -1428,7 +1463,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/slots/reserve": {
|
||||
"/v2/slots/reserve": {
|
||||
"post": {
|
||||
"operationId": "SlotsController_reserveSlot",
|
||||
"parameters": [],
|
||||
@@ -1459,7 +1494,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/slots/selected-slot": {
|
||||
"/v2/slots/selected-slot": {
|
||||
"delete": {
|
||||
"operationId": "SlotsController_deleteSelectedSlot",
|
||||
"parameters": [],
|
||||
@@ -1480,7 +1515,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/slots/available": {
|
||||
"/v2/slots/available": {
|
||||
"get": {
|
||||
"operationId": "SlotsController_getAvailableSlots",
|
||||
"parameters": [],
|
||||
@@ -1501,7 +1536,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/timezones": {
|
||||
"/v2/timezones": {
|
||||
"get": {
|
||||
"operationId": "TimezonesController_getTimeZones",
|
||||
"parameters": [],
|
||||
|
||||
@@ -21,7 +21,7 @@ export const useCalendarsBusyTimes = ({ onError, enabled, ...rest }: UseCalendar
|
||||
],
|
||||
queryFn: () => {
|
||||
return http
|
||||
.get<ApiResponse<EventBusyDate[]>>("/ee/calendars/busy-times", {
|
||||
.get<ApiResponse<EventBusyDate[]>>("/calendars/busy-times", {
|
||||
params: rest,
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
@@ -11,7 +11,7 @@ export const useConnectedCalendars = (props: { enabled?: boolean }) => {
|
||||
const calendars = useQuery({
|
||||
queryKey: [QUERY_KEY],
|
||||
queryFn: () => {
|
||||
return http.get<ApiResponse<ConnectedDestinationCalendars>>("/ee/calendars").then((res) => {
|
||||
return http.get<ApiResponse<ConnectedDestinationCalendars>>("/calendars").then((res) => {
|
||||
if (res.data.status === SUCCESS_STATUS) {
|
||||
return (res.data as ApiSuccessResponse<ConnectedDestinationCalendars>)?.data;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export const useCreateBooking = (
|
||||
) => {
|
||||
const createBooking = useMutation<ApiResponse<BookingResponse>, Error, BookingCreateBody>({
|
||||
mutationFn: (data) => {
|
||||
return http.post<ApiResponse<BookingResponse>>("/ee/bookings", data).then((res) => {
|
||||
return http.post<ApiResponse<BookingResponse>>("/bookings", data).then((res) => {
|
||||
if (res.data.status === SUCCESS_STATUS) {
|
||||
return res.data;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export const useCreateInstantBooking = (
|
||||
) => {
|
||||
const createInstantBooking = useMutation<ApiResponse<BookingResponse>, Error, BookingCreateBody>({
|
||||
mutationFn: (data) => {
|
||||
return http.post<ApiResponse<BookingResponse>>("/ee/bookings/instant", data).then((res) => {
|
||||
return http.post<ApiResponse<BookingResponse>>("/bookings/instant", data).then((res) => {
|
||||
if (res.data.status === SUCCESS_STATUS) {
|
||||
return res.data;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@ export const useCreateRecurringBooking = (
|
||||
RecurringBookingCreateBody[]
|
||||
>({
|
||||
mutationFn: (data) => {
|
||||
return http
|
||||
.post<ApiResponse<BookingResponse[]>>("/ee/bookings/recurring", data)
|
||||
.then((res) => res.data);
|
||||
return http.post<ApiResponse<BookingResponse[]>>("/bookings/recurring", data).then((res) => res.data);
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
if (data.status === SUCCESS_STATUS) {
|
||||
|
||||
@@ -16,7 +16,7 @@ export const useGcal = ({ isAuth, onCheckError }: useGcalProps) => {
|
||||
|
||||
const redirectToGcalOAuth = () => {
|
||||
http
|
||||
?.get("/ee/gcal/oauth/auth-url")
|
||||
?.get("/gcal/oauth/auth-url")
|
||||
.then(({ data: responseBody }) => {
|
||||
if (responseBody.data?.authUrl) {
|
||||
window.location.href = responseBody.data.authUrl;
|
||||
@@ -28,7 +28,7 @@ export const useGcal = ({ isAuth, onCheckError }: useGcalProps) => {
|
||||
useEffect(() => {
|
||||
if (isAuth) {
|
||||
http
|
||||
?.get("/ee/gcal/check")
|
||||
?.get("/gcal/check")
|
||||
.then(() => setAllowConnect(false))
|
||||
.catch((err) => {
|
||||
setAllowConnect(true);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export const BASE_URL = "http://localhost:5555";
|
||||
export const API_VERSION = "v2";
|
||||
export const V2_ENDPOINTS = {
|
||||
me: "ee/me",
|
||||
me: "me",
|
||||
availability: "schedules",
|
||||
eventTypes: "event-types",
|
||||
bookings: "ee/bookings",
|
||||
bookings: "bookings",
|
||||
};
|
||||
|
||||
export const SUCCESS_STATUS = "success";
|
||||
|
||||
@@ -29,7 +29,7 @@ REDIS_URL="redis://localhost:6379"
|
||||
2. Open ".env" file and paste client id from step 8 in `NEXT_PUBLIC_X_CAL_ID` and client secret in `X_CAL_SECRET_KEY`. If in step 2 you used the same environment variables, then `NEXT_PUBLIC_CALCOM_API_URL` can stay as is. Otherwise adjust the port to point to the same `API_PORT` as you used in step 2.
|
||||
10. Navigate to example app and setup database by running `rm -f prisma/dev.db && yarn prisma db push`.
|
||||
11. Start the example app by running `yarn dev` and go to `http://localhost:4321`.
|
||||
12. In the Google Cloud Console "API & Services" "Credentials" `https://console.cloud.google.com/apis/credentials` open web project setup in step 1 and add `http://localhost:5555/api/v2/ee/gcal/oauth/save` to the authorized redirect URIs.
|
||||
12. In the Google Cloud Console "API & Services" "Credentials" `https://console.cloud.google.com/apis/credentials` open web project setup in step 1 and add `http://localhost:5555/v2/gcal/oauth/save` to the authorized redirect URIs.
|
||||
|
||||
<img width="1000" alt="Screenshot 2024-03-21 at 09 42 36" src="https://github.com/calcom/atoms-examples/assets/42170848/82ce4d7a-fc08-489a-ab06-a8eb41a68a2a">
|
||||
|
||||
|
||||
+29
-29
@@ -7,18 +7,18 @@ export interface paths {
|
||||
"/health": {
|
||||
get: operations["AppController_getHealth"];
|
||||
};
|
||||
"/api/v2/events/public": {
|
||||
"/v2/events/public": {
|
||||
get: operations["EventsController_getPublicEvent"];
|
||||
};
|
||||
"/api/v2/oauth-clients/{clientId}/users": {
|
||||
"/v2/oauth-clients/{clientId}/users": {
|
||||
post: operations["OAuthClientUsersController_createUser"];
|
||||
};
|
||||
"/api/v2/oauth-clients/{clientId}/users/{userId}": {
|
||||
"/v2/oauth-clients/{clientId}/users/{userId}": {
|
||||
get: operations["OAuthClientUsersController_getUserById"];
|
||||
delete: operations["OAuthClientUsersController_deleteUser"];
|
||||
patch: operations["OAuthClientUsersController_updateUser"];
|
||||
};
|
||||
"/api/v2/oauth-clients": {
|
||||
"/v2/oauth-clients": {
|
||||
/**
|
||||
* @description ⚠️ First, this endpoint requires `Cookie: next-auth.session-token=eyJhbGciOiJ` header. Log into Cal web app using owner of organization that was created after visiting `/settings/organizations/new`, refresh swagger docs, and the cookie will be added to requests automatically to pass the NextAuthGuard.
|
||||
* Second, make sure that the logged in user has organizationId set to pass the OrganizationRolesGuard guard.
|
||||
@@ -30,7 +30,7 @@ export interface paths {
|
||||
*/
|
||||
post: operations["OAuthClientsController_createOAuthClient"];
|
||||
};
|
||||
"/api/v2/oauth-clients/{clientId}": {
|
||||
"/v2/oauth-clients/{clientId}": {
|
||||
/**
|
||||
* @description ⚠️ First, this endpoint requires `Cookie: next-auth.session-token=eyJhbGciOiJ` header. Log into Cal web app using owner of organization that was created after visiting `/settings/organizations/new`, refresh swagger docs, and the cookie will be added to requests automatically to pass the NextAuthGuard.
|
||||
* Second, make sure that the logged in user has organizationId set to pass the OrganizationRolesGuard guard.
|
||||
@@ -47,89 +47,89 @@ export interface paths {
|
||||
*/
|
||||
patch: operations["OAuthClientsController_updateOAuthClient"];
|
||||
};
|
||||
"/api/v2/oauth/{clientId}/authorize": {
|
||||
"/v2/oauth/{clientId}/authorize": {
|
||||
/**
|
||||
* Authorize an OAuth client
|
||||
* @description Redirects the user to the specified 'redirect_uri' with an authorization code in query parameter if the client is authorized successfully. The code is then exchanged for access and refresh tokens via the `/exchange` endpoint.
|
||||
*/
|
||||
post: operations["OAuthFlowController_authorize"];
|
||||
};
|
||||
"/api/v2/oauth/{clientId}/exchange": {
|
||||
"/v2/oauth/{clientId}/exchange": {
|
||||
/**
|
||||
* Exchange authorization code for access tokens
|
||||
* @description Exchanges the authorization code received from the `/authorize` endpoint for access and refresh tokens. The authorization code should be provided in the 'Authorization' header prefixed with 'Bearer '.
|
||||
*/
|
||||
post: operations["OAuthFlowController_exchange"];
|
||||
};
|
||||
"/api/v2/oauth/{clientId}/refresh": {
|
||||
"/v2/oauth/{clientId}/refresh": {
|
||||
post: operations["OAuthFlowController_refreshAccessToken"];
|
||||
};
|
||||
"/api/v2/event-types": {
|
||||
"/v2/event-types": {
|
||||
get: operations["EventTypesController_getEventTypes"];
|
||||
post: operations["EventTypesController_createEventType"];
|
||||
};
|
||||
"/api/v2/event-types/{eventTypeId}": {
|
||||
"/v2/event-types/{eventTypeId}": {
|
||||
get: operations["EventTypesController_getEventType"];
|
||||
};
|
||||
"/api/v2/event-types/{username}/public": {
|
||||
"/v2/event-types/{username}/public": {
|
||||
get: operations["EventTypesController_getPublicEventTypes"];
|
||||
};
|
||||
"/api/v2/platform/gcal/oauth/auth-url": {
|
||||
"/v2/gcal/oauth/auth-url": {
|
||||
get: operations["GcalController_redirect"];
|
||||
};
|
||||
"/api/v2/platform/gcal/oauth/save": {
|
||||
"/v2/gcal/oauth/save": {
|
||||
get: operations["GcalController_save"];
|
||||
};
|
||||
"/api/v2/platform/gcal/check": {
|
||||
"/v2/gcal/check": {
|
||||
get: operations["GcalController_check"];
|
||||
};
|
||||
"/api/v2/platform/provider/{clientId}": {
|
||||
"/v2/provider/{clientId}": {
|
||||
get: operations["CalProviderController_verifyClientId"];
|
||||
};
|
||||
"/api/v2/platform/provider/{clientId}/access-token": {
|
||||
"/v2/provider/{clientId}/access-token": {
|
||||
get: operations["CalProviderController_verifyAccessToken"];
|
||||
};
|
||||
"/api/v2/schedules": {
|
||||
"/v2/schedules": {
|
||||
get: operations["SchedulesController_getSchedules"];
|
||||
post: operations["SchedulesController_createSchedule"];
|
||||
};
|
||||
"/api/v2/schedules/default": {
|
||||
"/v2/schedules/default": {
|
||||
get: operations["SchedulesController_getDefaultSchedule"];
|
||||
};
|
||||
"/api/v2/schedules/time-zones": {
|
||||
"/v2/schedules/time-zones": {
|
||||
get: operations["SchedulesController_getTimeZones"];
|
||||
};
|
||||
"/api/v2/schedules/{scheduleId}": {
|
||||
"/v2/schedules/{scheduleId}": {
|
||||
get: operations["SchedulesController_getSchedule"];
|
||||
delete: operations["SchedulesController_deleteSchedule"];
|
||||
patch: operations["SchedulesController_updateSchedule"];
|
||||
};
|
||||
"/api/v2/me": {
|
||||
"/v2/me": {
|
||||
get: operations["MeController_getMe"];
|
||||
patch: operations["MeController_updateMe"];
|
||||
};
|
||||
"/api/v2/ee/calendars/busy-times": {
|
||||
"/v2/calendars/busy-times": {
|
||||
get: operations["CalendarsController_getBusyTimes"];
|
||||
};
|
||||
"/api/v2/ee/calendars": {
|
||||
"/v2/calendars": {
|
||||
get: operations["CalendarsController_getCalendars"];
|
||||
};
|
||||
"/api/v2/ee/bookings": {
|
||||
"/v2/bookings": {
|
||||
post: operations["BookingsController_createBooking"];
|
||||
};
|
||||
"/api/v2/ee/bookings/reccuring": {
|
||||
"/v2/bookings/reccuring": {
|
||||
post: operations["BookingsController_createReccuringBooking"];
|
||||
};
|
||||
"/api/v2/ee/bookings/instant": {
|
||||
"/v2/bookings/instant": {
|
||||
post: operations["BookingsController_createInstantBooking"];
|
||||
};
|
||||
"/api/v2/slots/reserve": {
|
||||
"/v2/slots/reserve": {
|
||||
post: operations["SlotsController_reserveSlot"];
|
||||
};
|
||||
"/api/v2/slots/selected-slot": {
|
||||
"/v2/slots/selected-slot": {
|
||||
delete: operations["SlotsController_deleteSelectedSlot"];
|
||||
};
|
||||
"/api/v2/slots/available": {
|
||||
"/v2/slots/available": {
|
||||
get: operations["SlotsController_getAvailableSlots"];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user