Updates page API interactions and regenerates Kiota client

Refactors page-related API interactions and client-side logic to align with an updated Kiota client and recent backend API changes.

*   Regenerates Kiota client with `--clear-cache` to ensure integration with the latest OpenAPI specification.
*   Adapts page data mapping to handle Kiota's improved type generation for `content`, `parentPageId`, `createdAt`, `updatedAt`, and `sortOrder`, which now correctly map to primitive types.
*   Updates page listing and detail fetching to consume responses wrapped in `PageListResponseDto` instead of direct arrays.
*   Removes explicit `userId` parameters from `createPage`, `updatePage`, and `deletePage` functions, as user context is now handled by server-side authentication.
*   Extends the `updatePage` functionality to allow modifications of `parentId` and `sortOrder`.
*   Standardizes API error responses across Kiota-generated endpoints to use a generic `ErrorResponseDto`.
*   Corrects Kiota-generated response types for several primitive endpoints from `ArrayBuffer` to `string`.
*   Enhances the UI to support space-aware page creation and navigation flows, including a new "Add Sub Page" option directly from the sidebar for hierarchical page management.
This commit is contained in:
dahyeon committed 2025-11-11 17:13:58 +00:00
1 parent 712dce8391
commit 0a718651b2
17 files changed
+444 -331

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
Here’s a concise **English version** of the essential Kiota-compatibility guidelines, suitable for giving to another AI agent or automated generator:
---
## 🧩 **Kiota Compatibility Guidelines for NestJS Swagger APIs**
**Goal:** Ensure the OpenAPI spec generated by NestJS Swagger can be fully parsed by Kiota without losing endpoints or models.
---
### ✅ 1. OpenAPI Version
* Use **OpenAPI 3.0.x** (Kiota doesn’t support 3.1).
* Avoid non-standard or experimental extensions.
---
### ✅ 2. Request & Response Schemas
* Always define a **schema** for every request and 2XX response.
* Use `application/json` as the single content type.
* Avoid multiple response formats per endpoint.
* Empty 204 responses → no `type`, only `description`.
---
### ✅ 3. Error Handling
* Define object-type **error schemas** for 4XX/5XX responses.
* Avoid array-type root errors (`[{message}]` → `{ errors: [...] }`).
* Kiota maps errors to typed exceptions only if schema exists.
---
### ✅ 4. Models & Polymorphism
* Use **`allOf` + `discriminator`** for inheritance.
* Avoid `oneOf`/`anyOf` unless you add a `discriminator` and reference named components.
* Never use anonymous inline schemas or `type: any`.
---
### ✅ 5. Query & Header Parameters
* Define query params individually (`@ApiQuery` per field).
* Avoid `deepObject` style; use simple `form` style.
* Enums in queries become **strings** in Kiota.
* Kiota does **not** auto-generate custom header fields — document required headers.
---
### ✅ 6. Authentication
* Use standard `Bearer`, `OAuth2`, or `openIdConnect` security schemes.
* Include `openIdConnectUrl` or token endpoint if applicable.
* Apply `@ApiBearerAuth()` on secured endpoints.
---
### ✅ 7. File Uploads
* Prefer JSON metadata + binary file upload separately.
* If multipart is required, use Kiota form-serialization packages (`@microsoft/kiota-serialization-form`).
---
### ✅ 8. Validation & Generation
* Check for Kiota CLI warnings (`kiota generate --log-level info`).
* Verify all endpoints produce request builders.
* Re-generate after Swagger or Kiota updates.
---
**Outcome:** Following these rules ensures every NestJS API route and model is fully generated by Kiota’s TypeScript client without loss of fidelity.
---
+1 -1
View File
@@ -1,4 +1,4 @@
$ENDPOINT = "https://wiki.dahyeon.us/v1"
# $ENDPOINT = "https://dev.dahyeon.us/v1"
kiota generate --openapi $ENDPOINT/api-yaml --language Typescript --output ./src/kiota --clean-output
kiota generate --openapi $ENDPOINT/api-yaml --language Typescript --output ./src/kiota --clean-output --clear-cache
+61 -32
View File
@@ -1,28 +1,68 @@
import type { Page, CreatePageData, UpdatePageData } from './types';
import type { ApiClient } from '../../kiota/apiClient';
import type { PageResponseDto, CreatePageDto, UpdatePageDto } from '../../kiota/models';
import type { PageResponseDto } from '../../kiota/models';
import type { PagePostRequestBody } from '../../kiota/v1/page';
import type { WithPagePutRequestBody } from '../../kiota/v1/page/item';
import type { Guid } from '@microsoft/kiota-abstractions';
/**
* Convert PageResponseDto to local Page type
*/
function mapPageResponseToPage(dto: PageResponseDto): Page {
// Handle content - it comes as a string from the server despite the Kiota type
// The API now returns these fields as object types due to Kiota limitations
// We need to extract the actual values from the serialized objects
const content = (dto.content as any) || '';
const contentStr = typeof content === 'string' ? content : '';
// Handle parentPageId - it comes as a Guid/string from the server despite the Kiota type
const parentPageId = (dto.parentPageId as any);
const parentIdStr = parentPageId?.toString() || null;
// Check if parentPageId is a valid GUID string or object with a value
let parentIdStr: string | null = null;
if (parentPageId) {
if (typeof parentPageId === 'string') {
parentIdStr = parentPageId;
} else if (typeof parentPageId === 'object') {
// Try multiple ways to extract the GUID
const keys = Object.keys(parentPageId);
if (keys.length === 0) {
// Empty object means null
parentIdStr = null;
} else {
// Try to find the actual GUID value
// Check common property names first
const guidValue = parentPageId.value ||
parentPageId.id ||
parentPageId.guid ||
parentPageId[keys[0]]; // Use first key if exists
if (typeof guidValue === 'string' && guidValue !== '[object Object]') {
parentIdStr = guidValue;
} else {
// Last resort: check if the object itself can be converted to a valid GUID
const strValue = parentPageId.toString();
parentIdStr = strValue !== '[object Object]' ? strValue : null;
}
}
}
}
const createdAt = (dto.createdAt as any);
const createdAtStr = createdAt ? (typeof createdAt === 'string' ? createdAt : new Date().toISOString()) : new Date().toISOString();
const updatedAt = (dto.updatedAt as any);
const updatedAtStr = updatedAt ? (typeof updatedAt === 'string' ? updatedAt : new Date().toISOString()) : new Date().toISOString();
const sortOrder = (dto.sortOrder as any);
const sortOrderNum = sortOrder ? (typeof sortOrder === 'number' ? sortOrder : undefined) : undefined;
return {
id: dto.pageId?.toString() || '',
title: dto.title || '',
content: contentStr,
parentId: parentIdStr,
order: dto.sortOrder || undefined,
createdAt: dto.createdAt?.toISOString() || new Date().toISOString(),
updatedAt: dto.updatedAt?.toISOString() || new Date().toISOString(),
order: sortOrderNum,
createdAt: createdAtStr,
updatedAt: updatedAtStr,
};
}
@@ -34,11 +74,11 @@ export async function getPages(apiClient: ApiClient, spaceId?: string): Promise<
queryParameters: spaceId ? { spaceId: spaceId as Guid } : undefined,
});
if (!response) {
if (!response || !response.pages) {
return [];
}
return response.map(mapPageResponseToPage);
return response.pages.map(mapPageResponseToPage);
}
/**
@@ -52,21 +92,15 @@ export async function getPage(apiClient: ApiClient, pageId: string): Promise<Pag
});
console.log('API response:', response);
if (!response) {
if (!response || !response.pages) {
throw new Error(`Page with id ${pageId} not found - response is undefined`);
}
// API always returns an array
if (!Array.isArray(response)) {
console.error('Unexpected response type:', typeof response, response);
throw new Error(`Unexpected response type for page ${pageId}`);
}
if (response.length === 0) {
if (response.pages.length === 0) {
throw new Error(`Page with id ${pageId} not found - empty response`);
}
const pageData = response[0];
const pageData = response.pages[0];
console.log('Page data:', pageData);
return mapPageResponseToPage(pageData);
@@ -82,19 +116,17 @@ export async function getPage(apiClient: ApiClient, pageId: string): Promise<Pag
export async function createPage(
apiClient: ApiClient,
data: CreatePageData,
userId: string,
spaceId: string
): Promise<Page> {
const createDto: CreatePageDto = {
const requestBody: PagePostRequestBody = {
title: data.title,
content: data.content,
parentPageId: data.parentId as Guid | null | undefined,
sortOrder: data.order,
spaceId: spaceId as Guid,
userId: userId as Guid,
};
const response = await apiClient.v1.page.post(createDto);
const response = await apiClient.v1.page.post(requestBody);
if (!response) {
throw new Error('Failed to create page');
@@ -109,16 +141,16 @@ export async function createPage(
export async function updatePage(
apiClient: ApiClient,
pageId: string,
data: UpdatePageData,
userId: string
data: UpdatePageData
): Promise<Page> {
const updateDto: UpdatePageDto = {
const requestBody: WithPagePutRequestBody = {
title: data.title,
content: data.content,
userId: userId as Guid,
parentPageId: data.parentId as Guid | null | undefined,
sortOrder: data.order,
};
const response = await apiClient.v1.page.byPageId(pageId as Guid).put(updateDto);
const response = await apiClient.v1.page.byPageId(pageId as Guid).put(requestBody);
if (!response) {
throw new Error(`Failed to update page ${pageId}`);
@@ -132,10 +164,7 @@ export async function updatePage(
*/
export async function deletePage(
apiClient: ApiClient,
pageId: string,
userId: string
pageId: string
): Promise<void> {
await apiClient.v1.page.byPageId(pageId as Guid).delete({
userId: userId as Guid,
});
await apiClient.v1.page.byPageId(pageId as Guid).delete();
}
+2
View File
@@ -18,4 +18,6 @@ export interface CreatePageData {
export interface UpdatePageData {
title: string;
content: string;
parentId?: string | null;
order?: number;
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"descriptionHash": "C64A91036F62D15D93162E3F7F5EE01034379FC42298C27FCC2D9B38675AD428119460B568D89EC1A9B819B52FD11892B94DEC504EE319DD5FDEA1A4032450A4",
"descriptionHash": "A4E87469774A711C65C7C38D1FFF5D2AE8A03EB6DCF7EAAF17C32D88B642FB38D172697FBC5C22F9955B0487E7AC11061A94CA71B0C1479B601A4292AA1F7090",
"descriptionLocation": "https://wiki.dahyeon.us/v1/api-yaml",
"lockFileVersion": "1.0.0",
"kiotaVersion": "1.28.0",
+88 -140
View File
@@ -34,20 +34,20 @@ export function createDeleteSpaceResponseDtoFromDiscriminatorValue(parseNode: Pa
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {PageResponseDto_content}
* @returns {ErrorResponseDto}
*/
// @ts-ignore
export function createPageResponseDto_contentFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoPageResponseDto_content;
export function createErrorResponseDtoFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoErrorResponseDto;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {PageResponseDto_parentPageId}
* @returns {PageListResponseDto}
*/
// @ts-ignore
export function createPageResponseDto_parentPageIdFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoPageResponseDto_parentPageId;
export function createPageListResponseDtoFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoPageListResponseDto;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
@@ -94,24 +94,6 @@ export function createSpaceStatisticsDto_statisticsFromDiscriminatorValue(parseN
export function createSpaceStatisticsDtoFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoSpaceStatisticsDto;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {TokenInfoDto_description}
*/
// @ts-ignore
export function createTokenInfoDto_descriptionFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoTokenInfoDto_description;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {TokenInfoDto_expiresAt}
*/
// @ts-ignore
export function createTokenInfoDto_expiresAtFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoTokenInfoDto_expiresAt;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
@@ -201,6 +183,30 @@ export function deserializeIntoDeleteSpaceResponseDto(deleteSpaceResponseDto: Pa
"spaceId": n => { deleteSpaceResponseDto.spaceId = n.getGuidValue(); },
}
}
/**
* The deserialization information for the current model
* @param ErrorResponseDto The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoErrorResponseDto(errorResponseDto: Partial<ErrorResponseDto> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
"error": n => { errorResponseDto.errorEscaped = n.getStringValue(); },
"message": n => { errorResponseDto.messageEscaped = n.getStringValue(); },
"statusCode": n => { errorResponseDto.statusCode = n.getNumberValue(); },
}
}
/**
* The deserialization information for the current model
* @param PageListResponseDto The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoPageListResponseDto(pageListResponseDto: Partial<PageListResponseDto> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
"pages": n => { pageListResponseDto.pages = n.getCollectionOfObjectValues<PageResponseDto>(createPageResponseDtoFromDiscriminatorValue); },
}
}
/**
* The deserialization information for the current model
* @param PageResponseDto The instance to deserialize into.
@@ -209,12 +215,12 @@ export function deserializeIntoDeleteSpaceResponseDto(deleteSpaceResponseDto: Pa
// @ts-ignore
export function deserializeIntoPageResponseDto(pageResponseDto: Partial<PageResponseDto> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
"content": n => { pageResponseDto.content = n.getObjectValue<PageResponseDto_content>(createPageResponseDto_contentFromDiscriminatorValue); },
"content": n => { pageResponseDto.content = n.getStringValue(); },
"createdAt": n => { pageResponseDto.createdAt = n.getDateValue(); },
"createdByUserId": n => { pageResponseDto.createdByUserId = n.getGuidValue(); },
"isDeleted": n => { pageResponseDto.isDeleted = n.getBooleanValue(); },
"pageId": n => { pageResponseDto.pageId = n.getGuidValue(); },
"parentPageId": n => { pageResponseDto.parentPageId = n.getObjectValue<PageResponseDto_parentPageId>(createPageResponseDto_parentPageIdFromDiscriminatorValue); },
"parentPageId": n => { pageResponseDto.parentPageId = n.getGuidValue(); },
"sortOrder": n => { pageResponseDto.sortOrder = n.getNumberValue(); },
"spaceId": n => { pageResponseDto.spaceId = n.getGuidValue(); },
"title": n => { pageResponseDto.title = n.getStringValue(); },
@@ -222,26 +228,6 @@ export function deserializeIntoPageResponseDto(pageResponseDto: Partial<PageResp
"updatedByUserId": n => { pageResponseDto.updatedByUserId = n.getGuidValue(); },
}
}
/**
* The deserialization information for the current model
* @param PageResponseDto_content The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoPageResponseDto_content(pageResponseDto_content: Partial<PageResponseDto_content> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
}
}
/**
* The deserialization information for the current model
* @param PageResponseDto_parentPageId The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoPageResponseDto_parentPageId(pageResponseDto_parentPageId: Partial<PageResponseDto_parentPageId> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
}
}
/**
* The deserialization information for the current model
* @param SpaceResponseDto The instance to deserialize into.
@@ -299,32 +285,12 @@ export function deserializeIntoSpaceStatisticsDto_statistics(spaceStatisticsDto_
export function deserializeIntoTokenInfoDto(tokenInfoDto: Partial<TokenInfoDto> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
"createdAt": n => { tokenInfoDto.createdAt = n.getDateValue(); },
"description": n => { tokenInfoDto.description = n.getObjectValue<TokenInfoDto_description>(createTokenInfoDto_descriptionFromDiscriminatorValue); },
"expiresAt": n => { tokenInfoDto.expiresAt = n.getObjectValue<TokenInfoDto_expiresAt>(createTokenInfoDto_expiresAtFromDiscriminatorValue); },
"description": n => { tokenInfoDto.description = n.getStringValue(); },
"expiresAt": n => { tokenInfoDto.expiresAt = n.getDateValue(); },
"tokenId": n => { tokenInfoDto.tokenId = n.getGuidValue(); },
"tokenValue": n => { tokenInfoDto.tokenValue = n.getStringValue(); },
}
}
/**
* The deserialization information for the current model
* @param TokenInfoDto_description The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoTokenInfoDto_description(tokenInfoDto_description: Partial<TokenInfoDto_description> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
}
}
/**
* The deserialization information for the current model
* @param TokenInfoDto_expiresAt The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoTokenInfoDto_expiresAt(tokenInfoDto_expiresAt: Partial<TokenInfoDto_expiresAt> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
}
}
/**
* The deserialization information for the current model
* @param TokenPermissionsDto The instance to deserialize into.
@@ -337,11 +303,31 @@ export function deserializeIntoTokenPermissionsDto(tokenPermissionsDto: Partial<
"spaceIds": n => { tokenPermissionsDto.spaceIds = n.getCollectionOfPrimitiveValues<string>(); },
}
}
export interface ErrorResponseDto extends AdditionalDataHolder, ApiError, Parsable {
/**
* 에러 상세 정보
*/
errorEscaped?: string | null;
/**
* 에러 메시지
*/
messageEscaped?: string | null;
/**
* HTTP 상태 코드
*/
statusCode?: number | null;
}
export interface PageListResponseDto extends AdditionalDataHolder, ApiError, Parsable {
/**
* 페이지 목록
*/
pages?: PageResponseDto[] | null;
}
export interface PageResponseDto extends AdditionalDataHolder, ApiError, Parsable {
/**
* 페이지 내용
*/
content?: PageResponseDto_content | null;
content?: string | null;
/**
* 생성 시간
*/
@@ -361,7 +347,7 @@ export interface PageResponseDto extends AdditionalDataHolder, ApiError, Parsabl
/**
* 부모 페이지 ID
*/
parentPageId?: PageResponseDto_parentPageId | null;
parentPageId?: Guid | null;
/**
* 정렬 순서
*/
@@ -383,16 +369,6 @@ export interface PageResponseDto extends AdditionalDataHolder, ApiError, Parsabl
*/
updatedByUserId?: Guid | null;
}
/**
* 페이지 내용
*/
export interface PageResponseDto_content extends AdditionalDataHolder, Parsable {
}
/**
* 부모 페이지 ID
*/
export interface PageResponseDto_parentPageId extends AdditionalDataHolder, Parsable {
}
/**
* Serializes information the current object
* @param CreateTokenResponseDto The instance to serialize from.
@@ -433,6 +409,32 @@ export function serializeDeleteSpaceResponseDto(writer: SerializationWriter, del
writer.writeGuidValue("spaceId", deleteSpaceResponseDto.spaceId);
writer.writeAdditionalData(deleteSpaceResponseDto.additionalData);
}
/**
* Serializes information the current object
* @param ErrorResponseDto The instance to serialize from.
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializeErrorResponseDto(writer: SerializationWriter, errorResponseDto: Partial<ErrorResponseDto> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!errorResponseDto || isSerializingDerivedType) { return; }
writer.writeStringValue("error", errorResponseDto.errorEscaped);
writer.writeStringValue("message", errorResponseDto.messageEscaped);
writer.writeNumberValue("statusCode", errorResponseDto.statusCode);
writer.writeAdditionalData(errorResponseDto.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param PageListResponseDto The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializePageListResponseDto(writer: SerializationWriter, pageListResponseDto: Partial<PageListResponseDto> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!pageListResponseDto || isSerializingDerivedType) { return; }
writer.writeCollectionOfObjectValues<PageResponseDto>("pages", pageListResponseDto.pages, serializePageResponseDto);
writer.writeAdditionalData(pageListResponseDto.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
@@ -442,12 +444,12 @@ export function serializeDeleteSpaceResponseDto(writer: SerializationWriter, del
// @ts-ignore
export function serializePageResponseDto(writer: SerializationWriter, pageResponseDto: Partial<PageResponseDto> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!pageResponseDto || isSerializingDerivedType) { return; }
writer.writeObjectValue<PageResponseDto_content>("content", pageResponseDto.content, serializePageResponseDto_content);
writer.writeStringValue("content", pageResponseDto.content);
writer.writeDateValue("createdAt", pageResponseDto.createdAt);
writer.writeGuidValue("createdByUserId", pageResponseDto.createdByUserId);
writer.writeBooleanValue("isDeleted", pageResponseDto.isDeleted);
writer.writeGuidValue("pageId", pageResponseDto.pageId);
writer.writeObjectValue<PageResponseDto_parentPageId>("parentPageId", pageResponseDto.parentPageId, serializePageResponseDto_parentPageId);
writer.writeGuidValue("parentPageId", pageResponseDto.parentPageId);
writer.writeNumberValue("sortOrder", pageResponseDto.sortOrder);
writer.writeGuidValue("spaceId", pageResponseDto.spaceId);
writer.writeStringValue("title", pageResponseDto.title);
@@ -455,28 +457,6 @@ export function serializePageResponseDto(writer: SerializationWriter, pageRespon
writer.writeGuidValue("updatedByUserId", pageResponseDto.updatedByUserId);
writer.writeAdditionalData(pageResponseDto.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param PageResponseDto_content The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializePageResponseDto_content(writer: SerializationWriter, pageResponseDto_content: Partial<PageResponseDto_content> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!pageResponseDto_content || isSerializingDerivedType) { return; }
writer.writeAdditionalData(pageResponseDto_content.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param PageResponseDto_parentPageId The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializePageResponseDto_parentPageId(writer: SerializationWriter, pageResponseDto_parentPageId: Partial<PageResponseDto_parentPageId> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!pageResponseDto_parentPageId || isSerializingDerivedType) { return; }
writer.writeAdditionalData(pageResponseDto_parentPageId.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
@@ -539,34 +519,12 @@ export function serializeSpaceStatisticsDto_statistics(writer: SerializationWrit
export function serializeTokenInfoDto(writer: SerializationWriter, tokenInfoDto: Partial<TokenInfoDto> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!tokenInfoDto || isSerializingDerivedType) { return; }
writer.writeDateValue("createdAt", tokenInfoDto.createdAt);
writer.writeObjectValue<TokenInfoDto_description>("description", tokenInfoDto.description, serializeTokenInfoDto_description);
writer.writeObjectValue<TokenInfoDto_expiresAt>("expiresAt", tokenInfoDto.expiresAt, serializeTokenInfoDto_expiresAt);
writer.writeStringValue("description", tokenInfoDto.description);
writer.writeDateValue("expiresAt", tokenInfoDto.expiresAt);
writer.writeGuidValue("tokenId", tokenInfoDto.tokenId);
writer.writeStringValue("tokenValue", tokenInfoDto.tokenValue);
writer.writeAdditionalData(tokenInfoDto.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param TokenInfoDto_description The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializeTokenInfoDto_description(writer: SerializationWriter, tokenInfoDto_description: Partial<TokenInfoDto_description> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!tokenInfoDto_description || isSerializingDerivedType) { return; }
writer.writeAdditionalData(tokenInfoDto_description.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param TokenInfoDto_expiresAt The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializeTokenInfoDto_expiresAt(writer: SerializationWriter, tokenInfoDto_expiresAt: Partial<TokenInfoDto_expiresAt> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!tokenInfoDto_expiresAt || isSerializingDerivedType) { return; }
writer.writeAdditionalData(tokenInfoDto_expiresAt.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
@@ -634,11 +592,11 @@ export interface TokenInfoDto extends AdditionalDataHolder, Parsable {
/**
* 토큰 설명
*/
description?: TokenInfoDto_description | null;
description?: string | null;
/**
* 만료 시간
*/
expiresAt?: TokenInfoDto_expiresAt | null;
expiresAt?: Date | null;
/**
* 토큰 ID
*/
@@ -648,16 +606,6 @@ export interface TokenInfoDto extends AdditionalDataHolder, Parsable {
*/
tokenValue?: string | null;
}
/**
* 토큰 설명
*/
export interface TokenInfoDto_description extends AdditionalDataHolder, Parsable {
}
/**
* 만료 시간
*/
export interface TokenInfoDto_expiresAt extends AdditionalDataHolder, Parsable {
}
export interface TokenPermissionsDto extends AdditionalDataHolder, Parsable {
/**
* 권한이 부여된 페이지 ID 목록
+5 -3
View File
@@ -15,11 +15,13 @@ export interface AccountRequestBuilder extends BaseRequestBuilder<AccountRequest
*/
get signin(): SigninRequestBuilder;
/**
* 현재 로그인한 사용자의 계정 정보 조회
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<ArrayBuffer>}
* @returns {Promise<string>}
*/
get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<ArrayBuffer | undefined>;
get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<string | undefined>;
/**
* 현재 로그인한 사용자의 계정 정보 조회
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {RequestInformation}
*/
@@ -45,7 +47,7 @@ export const AccountRequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: AccountRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
adapterMethodName: "sendPrimitive",
responseBodyFactory: "ArrayBuffer",
responseBodyFactory: "string",
},
};
/* tslint:enable */
+5 -3
View File
@@ -9,11 +9,13 @@ import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type Requ
*/
export interface SigninRequestBuilder extends BaseRequestBuilder<SigninRequestBuilder> {
/**
* 사용자 로그인
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<ArrayBuffer>}
* @returns {Promise<string>}
*/
get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<ArrayBuffer | undefined>;
get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<string | undefined>;
/**
* 사용자 로그인
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {RequestInformation}
*/
@@ -31,7 +33,7 @@ export const SigninRequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: SigninRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
adapterMethodName: "sendPrimitive",
responseBodyFactory: "ArrayBuffer",
responseBodyFactory: "string",
},
};
/* tslint:enable */
+12 -5
View File
@@ -2,22 +2,26 @@
/* eslint-disable */
// Generated by Microsoft Kiota
// @ts-ignore
import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions';
import { MultipartBody, serializeMultipartBody, type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions';
/**
* Builds and executes requests for operations under /v1/image
*/
export interface ImageRequestBuilder extends BaseRequestBuilder<ImageRequestBuilder> {
/**
* 이미지 파일을 업로드합니다
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<ArrayBuffer>}
* @returns {Promise<string>}
*/
post(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<ArrayBuffer | undefined>;
post(body: MultipartBody, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<string | undefined>;
/**
* 이미지 파일을 업로드합니다
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {RequestInformation}
*/
toPostRequestInformation(requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
toPostRequestInformation(body: MultipartBody, requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
}
/**
* Uri template for the request builder.
@@ -31,7 +35,10 @@ export const ImageRequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: ImageRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
adapterMethodName: "sendPrimitive",
responseBodyFactory: "ArrayBuffer",
responseBodyFactory: "string",
requestBodyContentType: "multipart/form-data",
requestBodySerializer: serializeMultipartBody,
requestInformationContentSetMethod: "setContentFromParsable",
},
};
/* tslint:enable */
+5 -3
View File
@@ -33,11 +33,13 @@ export interface V1RequestBuilder extends BaseRequestBuilder<V1RequestBuilder> {
*/
get space(): SpaceRequestBuilder;
/**
* 서버 상태 확인
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<ArrayBuffer>}
* @returns {Promise<string>}
*/
get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<ArrayBuffer | undefined>;
get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<string | undefined>;
/**
* 서버 상태 확인
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {RequestInformation}
*/
@@ -75,7 +77,7 @@ export const V1RequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: V1RequestBuilderUriTemplate,
responseBodyContentType: "application/json",
adapterMethodName: "sendPrimitive",
responseBodyFactory: "ArrayBuffer",
responseBodyFactory: "string",
},
};
/* tslint:enable */
+18 -74
View File
@@ -2,32 +2,14 @@
/* eslint-disable */
// Generated by Microsoft Kiota
// @ts-ignore
import { createPageResponseDtoFromDiscriminatorValue, serializePageResponseDto, type PageResponseDto } from '../../models/index.js';
import { createErrorResponseDtoFromDiscriminatorValue, createPageListResponseDtoFromDiscriminatorValue, createPageResponseDtoFromDiscriminatorValue, serializePageResponseDto, type ErrorResponseDto, type PageListResponseDto, type PageResponseDto } from '../../models/index.js';
// @ts-ignore
import { type WithPageItemRequestBuilder, WithPageItemRequestBuilderRequestsMetadata } from './item/index.js';
// @ts-ignore
import { TemporaryAccessTokenRequestBuilderRequestsMetadata, type TemporaryAccessTokenRequestBuilder } from './temporaryAccessToken/index.js';
// @ts-ignore
import { type AdditionalDataHolder, type ApiError, type BaseRequestBuilder, type Guid, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type ParseNode, type RequestConfiguration, type RequestInformation, type RequestsMetadata, type SerializationWriter } from '@microsoft/kiota-abstractions';
import { type AdditionalDataHolder, type BaseRequestBuilder, type Guid, type KeysToExcludeForNavigationMetadata, type NavigationMetadata, type Parsable, type ParsableFactory, type ParseNode, type RequestConfiguration, type RequestInformation, type RequestsMetadata, type SerializationWriter } from '@microsoft/kiota-abstractions';
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {Page4XXError}
*/
// @ts-ignore
export function createPage4XXErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoPage4XXError;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {Page5XXError}
*/
// @ts-ignore
export function createPage5XXErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoPage5XXError;
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
@@ -37,26 +19,6 @@ export function createPage5XXErrorFromDiscriminatorValue(parseNode: ParseNode |
export function createPagePostRequestBodyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
return deserializeIntoPagePostRequestBody;
}
/**
* The deserialization information for the current model
* @param Page4XXError The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoPage4XXError(page4XXError: Partial<Page4XXError> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
}
}
/**
* The deserialization information for the current model
* @param Page5XXError The instance to deserialize into.
* @returns {Record<string, (node: ParseNode) => void>}
*/
// @ts-ignore
export function deserializeIntoPage5XXError(page5XXError: Partial<Page5XXError> | undefined = {}) : Record<string, (node: ParseNode) => void> {
return {
}
}
/**
* The deserialization information for the current model
* @param PagePostRequestBody The instance to deserialize into.
@@ -72,10 +34,6 @@ export function deserializeIntoPagePostRequestBody(pagePostRequestBody: Partial<
"title": n => { pagePostRequestBody.title = n.getStringValue(); },
}
}
export interface Page4XXError extends AdditionalDataHolder, ApiError, Parsable {
}
export interface Page5XXError extends AdditionalDataHolder, ApiError, Parsable {
}
export interface PagePostRequestBody extends AdditionalDataHolder, Parsable {
/**
* 페이지 내용 (Markdown)
@@ -115,16 +73,20 @@ export interface PageRequestBuilder extends BaseRequestBuilder<PageRequestBuilde
/**
* pageId로 특정 페이지를 조회하거나, spaceId로 스페이스의 모든 페이지를 조회합니다. (공개 접근 가능)
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<PageResponseDto[]>}
* @throws {Page4XXError} error when the service returns a 4XX status code
* @throws {Page5XXError} error when the service returns a 5XX status code
* @returns {Promise<PageListResponseDto>}
* @throws {ErrorResponseDto} error when the service returns a 400 status code
* @throws {ErrorResponseDto} error when the service returns a 404 status code
* @throws {PageListResponseDto} error when the service returns a 4XX or 5XX status code
*/
get(requestConfiguration?: RequestConfiguration<PageRequestBuilderGetQueryParameters> | undefined) : Promise<PageResponseDto| PageResponseDto[] | undefined>;
get(requestConfiguration?: RequestConfiguration<PageRequestBuilderGetQueryParameters> | undefined) : Promise<PageListResponseDto | undefined>;
/**
* 새로운 페이지를 생성합니다. 스페이스 내에서 계층 구조를 가질 수 있습니다. (인증 필요)
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<PageResponseDto>}
* @throws {ErrorResponseDto} error when the service returns a 400 status code
* @throws {ErrorResponseDto} error when the service returns a 401 status code
* @throws {ErrorResponseDto} error when the service returns a 404 status code
* @throws {PageResponseDto} error when the service returns a 4XX or 5XX status code
*/
post(body: PagePostRequestBody, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<PageResponseDto | undefined>;
@@ -155,28 +117,6 @@ export interface PageRequestBuilderGetQueryParameters {
*/
spaceId?: Guid;
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param Page4XXError The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializePage4XXError(writer: SerializationWriter, page4XXError: Partial<Page4XXError> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!page4XXError || isSerializingDerivedType) { return; }
writer.writeAdditionalData(page4XXError.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
* @param Page5XXError The instance to serialize from.
* @param writer Serialization writer to use to serialize this model
*/
// @ts-ignore
export function serializePage5XXError(writer: SerializationWriter, page5XXError: Partial<Page5XXError> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
if (!page5XXError || isSerializingDerivedType) { return; }
writer.writeAdditionalData(page5XXError.additionalData);
}
/**
* Serializes information the current object
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
@@ -217,16 +157,20 @@ export const PageRequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: PageRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
errorMappings: {
_4XX: createPage4XXErrorFromDiscriminatorValue as ParsableFactory<Parsable>,
_5XX: createPage5XXErrorFromDiscriminatorValue as ParsableFactory<Parsable>,
400: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
XXX: createPageListResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
},
adapterMethodName: "sendCollection",
responseBodyFactory: createPageResponseDtoFromDiscriminatorValue,
adapterMethodName: "send",
responseBodyFactory: createPageListResponseDtoFromDiscriminatorValue,
},
post: {
uriTemplate: PageRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
errorMappings: {
400: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
401: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
XXX: createPageResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
},
adapterMethodName: "send",
+11 -1
View File
@@ -2,7 +2,7 @@
/* eslint-disable */
// Generated by Microsoft Kiota
// @ts-ignore
import { createDeleteResponseDtoFromDiscriminatorValue, createPageResponseDtoFromDiscriminatorValue, serializePageResponseDto, type DeleteResponseDto, type PageResponseDto } from '../../../models/index.js';
import { createDeleteResponseDtoFromDiscriminatorValue, createErrorResponseDtoFromDiscriminatorValue, createPageResponseDtoFromDiscriminatorValue, serializePageResponseDto, type DeleteResponseDto, type ErrorResponseDto, type PageResponseDto } from '../../../models/index.js';
// @ts-ignore
import { type AdditionalDataHolder, type BaseRequestBuilder, type Guid, type Parsable, type ParsableFactory, type ParseNode, type RequestConfiguration, type RequestInformation, type RequestsMetadata, type SerializationWriter } from '@microsoft/kiota-abstractions';
@@ -52,6 +52,8 @@ export interface WithPageItemRequestBuilder extends BaseRequestBuilder<WithPageI
* 페이지를 소프트 삭제합니다 (isDeleted 플래그를 true로 설정). (인증 필요)
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<DeleteResponseDto>}
* @throws {ErrorResponseDto} error when the service returns a 401 status code
* @throws {ErrorResponseDto} error when the service returns a 404 status code
* @throws {DeleteResponseDto} error when the service returns a 4XX or 5XX status code
*/
delete(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<DeleteResponseDto | undefined>;
@@ -60,6 +62,9 @@ export interface WithPageItemRequestBuilder extends BaseRequestBuilder<WithPageI
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<PageResponseDto>}
* @throws {ErrorResponseDto} error when the service returns a 400 status code
* @throws {ErrorResponseDto} error when the service returns a 401 status code
* @throws {ErrorResponseDto} error when the service returns a 404 status code
* @throws {PageResponseDto} error when the service returns a 4XX or 5XX status code
*/
put(body: WithPagePutRequestBody, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<PageResponseDto | undefined>;
@@ -107,6 +112,8 @@ export const WithPageItemRequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: WithPageItemRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
errorMappings: {
401: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
XXX: createDeleteResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
},
adapterMethodName: "send",
@@ -116,6 +123,9 @@ export const WithPageItemRequestBuilderRequestsMetadata: RequestsMetadata = {
uriTemplate: WithPageItemRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
errorMappings: {
400: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
401: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
XXX: createPageResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
},
adapterMethodName: "send",
@@ -2,7 +2,7 @@
/* eslint-disable */
// Generated by Microsoft Kiota
// @ts-ignore
import { createCreateTokenResponseDtoFromDiscriminatorValue, createDeleteResponseDtoFromDiscriminatorValue, serializeCreateTokenResponseDto, serializeDeleteResponseDto, type CreateTokenResponseDto, type DeleteResponseDto } from '../../../models/index.js';
import { createCreateTokenResponseDtoFromDiscriminatorValue, createDeleteResponseDtoFromDiscriminatorValue, createErrorResponseDtoFromDiscriminatorValue, serializeCreateTokenResponseDto, serializeDeleteResponseDto, type CreateTokenResponseDto, type DeleteResponseDto, type ErrorResponseDto } from '../../../models/index.js';
// @ts-ignore
import { type AdditionalDataHolder, type BaseRequestBuilder, type Guid, type Parsable, type ParsableFactory, type ParseNode, type RequestConfiguration, type RequestInformation, type RequestsMetadata, type SerializationWriter } from '@microsoft/kiota-abstractions';
@@ -109,6 +109,8 @@ export interface TemporaryAccessTokenRequestBuilder extends BaseRequestBuilder<T
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<DeleteResponseDto>}
* @throws {ErrorResponseDto} error when the service returns a 401 status code
* @throws {ErrorResponseDto} error when the service returns a 404 status code
* @throws {DeleteResponseDto} error when the service returns a 4XX or 5XX status code
*/
delete(body: TemporaryAccessTokenDeleteRequestBody, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<DeleteResponseDto | undefined>;
@@ -117,6 +119,9 @@ export interface TemporaryAccessTokenRequestBuilder extends BaseRequestBuilder<T
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns {Promise<CreateTokenResponseDto>}
* @throws {ErrorResponseDto} error when the service returns a 400 status code
* @throws {ErrorResponseDto} error when the service returns a 401 status code
* @throws {ErrorResponseDto} error when the service returns a 404 status code
* @throws {CreateTokenResponseDto} error when the service returns a 4XX or 5XX status code
*/
post(body: TemporaryAccessTokenPostRequestBody, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<CreateTokenResponseDto | undefined>;
@@ -147,6 +152,8 @@ export const TemporaryAccessTokenRequestBuilderRequestsMetadata: RequestsMetadat
uriTemplate: TemporaryAccessTokenRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
errorMappings: {
401: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
XXX: createDeleteResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
},
adapterMethodName: "send",
@@ -159,6 +166,9 @@ export const TemporaryAccessTokenRequestBuilderRequestsMetadata: RequestsMetadat
uriTemplate: TemporaryAccessTokenRequestBuilderUriTemplate,
responseBodyContentType: "application/json",
errorMappings: {
400: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
401: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
XXX: createCreateTokenResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
},
adapterMethodName: "send",
+2 -4
View File
@@ -8,7 +8,7 @@ import { LexicalViewer } from '../shared/LexicalViewer';
import * as AlertDialog from '@radix-ui/react-alert-dialog';
import { Pencil1Icon, TrashIcon } from '@radix-ui/react-icons';
import { useState } from 'react';
import { useApiClient, useUserId } from '../shared/hooks/useApiClient';
import { useApiClient } from '../shared/hooks/useApiClient';
function PageDetailContent() {
const { spaceKey, id } = useParams<{ spaceKey: string; id: string }>();
@@ -16,7 +16,6 @@ function PageDetailContent() {
const queryClient = useQueryClient();
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
const apiClient = useApiClient();
const userId = useUserId();
const { data: page, isLoading, error } = useQuery({
queryKey: ['page', id],
@@ -26,8 +25,7 @@ function PageDetailContent() {
const deleteMutation = useMutation({
mutationFn: () => {
if (!userId) throw new Error('User not authenticated');
return deletePage(apiClient, id!, userId);
return deletePage(apiClient, id!);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['pages'] });
+14 -8
View File
@@ -1,19 +1,20 @@
import { useParams, useNavigate } from 'react-router-dom';
import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { getPage, createPage, updatePage } from '../entities/page';
import { getSpaceByKey } from '../entities/space';
import { PageForm } from '../features/page';
import { Layout } from '../shared/Layout';
import { Breadcrumb } from '../shared/Breadcrumb';
import { useApiClient, useUserId } from '../shared/hooks/useApiClient';
import { useApiClient } from '../shared/hooks/useApiClient';
export function PageEditPage() {
const { spaceKey, id } = useParams<{ spaceKey: string; id: string }>();
const [searchParams] = useSearchParams();
const navigate = useNavigate();
const queryClient = useQueryClient();
const isNew = !id;
const apiClient = useApiClient();
const userId = useUserId();
const parentId = searchParams.get('parentId');
const { data: space } = useQuery({
queryKey: ['space', spaceKey],
@@ -27,11 +28,16 @@ export function PageEditPage() {
enabled: !isNew,
});
const { data: parentPage } = useQuery({
queryKey: ['page', parentId],
queryFn: () => getPage(apiClient, parentId!),
enabled: !!parentId && isNew,
});
const createMutation = useMutation({
mutationFn: (data: { title: string; content: string }) => {
if (!userId) throw new Error('User not authenticated');
if (!space?.id) throw new Error('Space not found');
return createPage(apiClient, data, userId, space.id);
return createPage(apiClient, { ...data, parentId: parentId || undefined }, space.id);
},
onSuccess: (newPage) => {
queryClient.invalidateQueries({ queryKey: ['pages', space?.id] });
@@ -41,8 +47,7 @@ export function PageEditPage() {
const updateMutation = useMutation({
mutationFn: (data: { title: string; content: string }) => {
if (!userId) throw new Error('User not authenticated');
return updatePage(apiClient, id!, data, userId);
return updatePage(apiClient, id!, data);
},
onSuccess: (updatedPage) => {
queryClient.setQueryData(['page', id], updatedPage);
@@ -81,13 +86,14 @@ export function PageEditPage() {
items={[
{ label: 'Spaces', path: '/' },
{ label: space?.name || spaceKey || '', path: `/spaces/${spaceKey}` },
...(parentPage ? [{ label: parentPage.title, path: `/spaces/${spaceKey}/pages/${parentPage.id}` }] : []),
{ label: isNew ? '새 페이지 만들기' : page?.title || '편집' },
]}
/>
<div className="max-w-4xl">
<h1 className="text-4xl font-bold text-[#e4e4e4] mb-8">
{isNew ? '새 페이지 만들기' : '페이지 편집'}
{isNew ? (parentPage ? `"${parentPage.title}"의 하위 페이지 만들기` : '새 페이지 만들기') : '페이지 편집'}
</h1>
<PageForm
initialData={page}
+7 -4
View File
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react';
import { useState } from 'react';
import { Link } from 'react-router-dom';
import { Link, useParams } from 'react-router-dom';
import { HamburgerMenuIcon, Cross1Icon } from '@radix-ui/react-icons';
import { LeftSidebar } from './LeftSidebar';
import { AuthButton } from './AuthButton';
@@ -13,6 +13,7 @@ interface LayoutProps {
export function Layout({ children, showSidebar = true, rightSidebar }: LayoutProps) {
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
const { spaceKey } = useParams<{ spaceKey: string }>();
return (
<div className="min-h-screen bg-[#1e1e1e]">
@@ -52,9 +53,11 @@ export function Layout({ children, showSidebar = true, rightSidebar }: LayoutPro
<Link to="/" className="text-[#9d9d9d] hover:text-[#e4e4e4] transition-colors hidden md:inline">
Learn
</Link>
<Link to="/pages/new" className="px-3 md:px-4 py-1.5 bg-[#0078d4] hover:bg-[#106ebe] text-white rounded transition-colors text-xs md:text-sm">
새 페이지
</Link>
{spaceKey && (
<Link to={`/spaces/${spaceKey}/pages/new`} className="px-3 md:px-4 py-1.5 bg-[#0078d4] hover:bg-[#106ebe] text-white rounded transition-colors text-xs md:text-sm">
새 페이지
</Link>
)}
<AuthButton />
</nav>
</div>
+124 -51
View File
@@ -1,8 +1,10 @@
import { useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { Link, useLocation, useParams, useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { getPages, type Page } from '../entities/page';
import { MagnifyingGlassIcon, FileTextIcon, PlusIcon, ChevronRightIcon, ChevronDownIcon } from '@radix-ui/react-icons';
import { getSpaceByKey } from '../entities/space';
import { useApiClient } from './hooks/useApiClient';
import { MagnifyingGlassIcon, FileTextIcon, PlusIcon, ChevronRightIcon, ChevronDownIcon, DotsHorizontalIcon } from '@radix-ui/react-icons';
interface TreeNodeProps {
page: Page;
@@ -10,13 +12,16 @@ interface TreeNodeProps {
allPages: Page[];
searchQuery: string;
level: number;
spaceKey: string;
onLinkClick: () => void;
}
function TreeNode({ page, children, allPages, searchQuery, level, onLinkClick }: TreeNodeProps) {
function TreeNode({ page, children, allPages, searchQuery, level, spaceKey, onLinkClick }: TreeNodeProps) {
const location = useLocation();
const navigate = useNavigate();
const [isExpanded, setIsExpanded] = useState(true);
const isActive = location.pathname === `/pages/${page.id}`;
const [isHovered, setIsHovered] = useState(false);
const isActive = location.pathname === `/spaces/${spaceKey}/pages/${page.id}`;
const hasChildren = children.length > 0;
const matchesSearch = searchQuery === '' || page.title.toLowerCase().includes(searchQuery.toLowerCase());
@@ -25,36 +30,74 @@ function TreeNode({ page, children, allPages, searchQuery, level, onLinkClick }:
return null;
}
const handleAddSubPage = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
// Navigate to new page creation with parent page ID
navigate(`/spaces/${spaceKey}/pages/new?parentId=${page.id}`);
};
const handleMenuClick = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
// TODO: Show context menu
};
return (
<div>
<div className="flex items-center">
{hasChildren && (
<div
className="relative group"
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
<div className={`flex items-center transition-all ${isHovered ? 'pr-16' : 'pr-1'}`}>
<button
onClick={() => setIsExpanded(!isExpanded)}
className="p-1 hover:bg-[#2d2d30] rounded transition-colors flex-shrink-0"
>
{isExpanded ? (
<ChevronDownIcon className="h-3 w-3 text-[#9d9d9d]" />
{hasChildren ? (
isExpanded ? (
<ChevronDownIcon className="h-3 w-3 text-[#9d9d9d]" />
) : (
<ChevronRightIcon className="h-3 w-3 text-[#9d9d9d]" />
)
) : (
<ChevronRightIcon className="h-3 w-3 text-[#9d9d9d]" />
<div className="w-5" />
)}
</button>
)}
{!hasChildren && <div className="w-5" />}
<Link
to={`/pages/${page.id}`}
onClick={onLinkClick}
className={`flex-1 flex items-center gap-2 px-2 py-1.5 text-sm rounded transition-colors ${
isActive
? 'bg-[#0078d4] text-white'
: 'text-[#e4e4e4] hover:bg-[#2d2d30]'
}`}
style={{ paddingLeft: `${level * 12 + 8}px` }}
>
<FileTextIcon className="h-3.5 w-3.5 flex-shrink-0" />
<span className="truncate">{page.title}</span>
</Link>
<Link
to={`/spaces/${spaceKey}/pages/${page.id}`}
onClick={onLinkClick}
className={`flex-1 flex items-center gap-2 px-2 py-1.5 text-sm rounded transition-colors min-w-0 ${
isActive
? 'bg-[#0078d4] text-white'
: 'text-[#e4e4e4] hover:bg-[#2d2d30]'
}`}
style={{ paddingLeft: `${level * 12 + 8}px` }}
>
<FileTextIcon className="h-3.5 w-3.5 flex-shrink-0" />
<span className="truncate">{page.title}</span>
</Link>
</div>
{/* Action buttons - fixed on the right side, shown on hover */}
<div className={`absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 bg-[#252526] transition-opacity ${isHovered ? 'opacity-100' : 'opacity-0'}`}>
<button
onClick={handleAddSubPage}
className="p-1 hover:bg-[#3e3e42] rounded transition-colors"
title="하위 페이지 추가"
>
<PlusIcon className="h-3.5 w-3.5 text-[#9d9d9d] hover:text-[#e4e4e4]" />
</button>
<button
onClick={handleMenuClick}
className="p-1 hover:bg-[#3e3e42] rounded transition-colors"
title="더보기"
>
<DotsHorizontalIcon className="h-3.5 w-3.5 text-[#9d9d9d] hover:text-[#e4e4e4]" />
</button>
</div>
</div>
{hasChildren && isExpanded && (
@@ -69,6 +112,7 @@ function TreeNode({ page, children, allPages, searchQuery, level, onLinkClick }:
allPages={allPages}
searchQuery={searchQuery}
level={level + 1}
spaceKey={spaceKey}
onLinkClick={onLinkClick}
/>
);
@@ -86,9 +130,21 @@ interface LeftSidebarProps {
export function LeftSidebar({ isMobileOpen, onMobileClose }: LeftSidebarProps) {
const [searchQuery, setSearchQuery] = useState('');
const { data: pages = [] } = useQuery({
queryKey: ['pages'],
queryFn: getPages,
const { spaceKey } = useParams<{ spaceKey: string }>();
const apiClient = useApiClient();
// Get space info to fetch its pages
const { data: space, isLoading: isLoadingSpace, error: spaceError } = useQuery({
queryKey: ['space', spaceKey],
queryFn: () => getSpaceByKey(apiClient, spaceKey!),
enabled: !!spaceKey,
});
// Fetch pages for the current space
const { data: pages = [], isLoading: isLoadingPages, error: pagesError } = useQuery({
queryKey: ['pages', space?.id],
queryFn: () => getPages(apiClient, space!.id),
enabled: !!space?.id,
});
// Build tree structure
@@ -137,31 +193,48 @@ export function LeftSidebar({ isMobileOpen, onMobileClose }: LeftSidebarProps) {
{/* Navigation */}
<div className="flex-1 overflow-y-auto">
<nav className="p-2">
<div className="mb-2">
<Link
to="/pages/new"
className="flex items-center gap-2 px-3 py-2 text-sm rounded hover:bg-[#2d2d30] text-[#4db8ff] transition-colors"
>
<PlusIcon className="h-4 w-4" />
새 페이지 만들기
</Link>
</div>
{spaceKey && (
<div className="mb-2">
<Link
to={`/spaces/${spaceKey}/pages/new`}
className="flex items-center gap-2 px-3 py-2 text-sm rounded hover:bg-[#2d2d30] text-[#4db8ff] transition-colors"
>
<PlusIcon className="h-4 w-4" />
새 페이지 만들기
</Link>
</div>
)}
<div className="space-y-0.5">
{rootPages.map(page => {
const children = pages.filter(p => p.parentId === page.id).sort((a, b) => (a.order || 0) - (b.order || 0));
return (
<TreeNode
key={page.id}
page={page}
children={children}
allPages={pages}
searchQuery={searchQuery}
level={0}
onLinkClick={handleLinkClick}
/>
);
})}
{isLoadingSpace || isLoadingPages ? (
<div className="px-3 py-2 text-sm text-[#9d9d9d]">
불러오는 중...
</div>
) : spaceError || pagesError ? (
<div className="px-3 py-2 text-sm text-red-400">
오류: {(spaceError || pagesError)?.message}
</div>
) : rootPages.length === 0 ? (
<div className="px-3 py-2 text-sm text-[#9d9d9d]">
페이지가 없습니다
</div>
) : (
rootPages.map(page => {
const children = pages.filter(p => p.parentId === page.id).sort((a, b) => (a.order || 0) - (b.order || 0));
return (
<TreeNode
key={page.id}
page={page}
children={children}
allPages={pages}
searchQuery={searchQuery}
level={0}
spaceKey={spaceKey || ''}
onLinkClick={handleLinkClick}
/>
);
})
)}
</div>
</nav>
</div>