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.
140 lines
7.3 KiB
TypeScript
140 lines
7.3 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
// Generated by Microsoft Kiota
|
|
// @ts-ignore
|
|
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';
|
|
|
|
/**
|
|
* 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 {WithPagePutRequestBody}
|
|
*/
|
|
// @ts-ignore
|
|
export function createWithPagePutRequestBodyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record<string, (node: ParseNode) => void>) {
|
|
return deserializeIntoWithPagePutRequestBody;
|
|
}
|
|
/**
|
|
* The deserialization information for the current model
|
|
* @param WithPagePutRequestBody The instance to deserialize into.
|
|
* @returns {Record<string, (node: ParseNode) => void>}
|
|
*/
|
|
// @ts-ignore
|
|
export function deserializeIntoWithPagePutRequestBody(withPagePutRequestBody: Partial<WithPagePutRequestBody> | undefined = {}) : Record<string, (node: ParseNode) => void> {
|
|
return {
|
|
"content": n => { withPagePutRequestBody.content = n.getStringValue(); },
|
|
"parentPageId": n => { withPagePutRequestBody.parentPageId = n.getGuidValue(); },
|
|
"sortOrder": n => { withPagePutRequestBody.sortOrder = n.getNumberValue(); },
|
|
"title": n => { withPagePutRequestBody.title = n.getStringValue(); },
|
|
}
|
|
}
|
|
/**
|
|
* Serializes information the current object
|
|
* @param isSerializingDerivedType A boolean indicating whether the serialization is for a derived type.
|
|
* @param WithPagePutRequestBody The instance to serialize from.
|
|
* @param writer Serialization writer to use to serialize this model
|
|
*/
|
|
// @ts-ignore
|
|
export function serializeWithPagePutRequestBody(writer: SerializationWriter, withPagePutRequestBody: Partial<WithPagePutRequestBody> | undefined | null = {}, isSerializingDerivedType: boolean = false) : void {
|
|
if (!withPagePutRequestBody || isSerializingDerivedType) { return; }
|
|
writer.writeStringValue("content", withPagePutRequestBody.content);
|
|
writer.writeGuidValue("parentPageId", withPagePutRequestBody.parentPageId);
|
|
writer.writeNumberValue("sortOrder", withPagePutRequestBody.sortOrder);
|
|
writer.writeStringValue("title", withPagePutRequestBody.title);
|
|
writer.writeAdditionalData(withPagePutRequestBody.additionalData);
|
|
}
|
|
/**
|
|
* Builds and executes requests for operations under /v1/page/{pageId}
|
|
*/
|
|
export interface WithPageItemRequestBuilder extends BaseRequestBuilder<WithPageItemRequestBuilder> {
|
|
/**
|
|
* 페이지를 소프트 삭제합니다 (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>;
|
|
/**
|
|
* 페이지의 제목, 내용, 부모 페이지, 정렬 순서 등을 업데이트합니다. (인증 필요)
|
|
* @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>;
|
|
/**
|
|
* 페이지를 소프트 삭제합니다 (isDeleted 플래그를 true로 설정). (인증 필요)
|
|
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
|
|
* @returns {RequestInformation}
|
|
*/
|
|
toDeleteRequestInformation(requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
|
|
/**
|
|
* 페이지의 제목, 내용, 부모 페이지, 정렬 순서 등을 업데이트합니다. (인증 필요)
|
|
* @param body The request body
|
|
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
|
|
* @returns {RequestInformation}
|
|
*/
|
|
toPutRequestInformation(body: WithPagePutRequestBody, requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
|
|
}
|
|
export interface WithPagePutRequestBody extends AdditionalDataHolder, Parsable {
|
|
/**
|
|
* 페이지 내용 (Markdown)
|
|
*/
|
|
content?: string | null;
|
|
/**
|
|
* 부모 페이지 ID (null로 설정하면 루트 페이지가 됨)
|
|
*/
|
|
parentPageId?: Guid | null;
|
|
/**
|
|
* 정렬 순서
|
|
*/
|
|
sortOrder?: number | null;
|
|
/**
|
|
* 페이지 제목
|
|
*/
|
|
title?: string | null;
|
|
}
|
|
/**
|
|
* Uri template for the request builder.
|
|
*/
|
|
export const WithPageItemRequestBuilderUriTemplate = "{+baseurl}/v1/page/{pageId}";
|
|
/**
|
|
* Metadata for all the requests in the request builder.
|
|
*/
|
|
export const WithPageItemRequestBuilderRequestsMetadata: RequestsMetadata = {
|
|
delete: {
|
|
uriTemplate: WithPageItemRequestBuilderUriTemplate,
|
|
responseBodyContentType: "application/json",
|
|
errorMappings: {
|
|
401: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
|
|
404: createErrorResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
|
|
XXX: createDeleteResponseDtoFromDiscriminatorValue as ParsableFactory<Parsable>,
|
|
},
|
|
adapterMethodName: "send",
|
|
responseBodyFactory: createDeleteResponseDtoFromDiscriminatorValue,
|
|
},
|
|
put: {
|
|
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",
|
|
responseBodyFactory: createPageResponseDtoFromDiscriminatorValue,
|
|
requestBodyContentType: "application/json",
|
|
requestBodySerializer: serializeWithPagePutRequestBody,
|
|
requestInformationContentSetMethod: "setContentFromParsable",
|
|
},
|
|
};
|
|
/* tslint:enable */
|
|
/* eslint-enable */
|