Skip to content

Commit

Permalink
MINOR: remove some document fields in model.document serialization
Browse files Browse the repository at this point in the history
* improve storey performances

* add comments
  • Loading branch information
Bimdata-io committed Jan 8, 2025
1 parent 9350b26 commit ee0d684
Show file tree
Hide file tree
Showing 8 changed files with 281 additions and 26 deletions.
2 changes: 2 additions & 0 deletions package/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ src/models/MaterialListComponentRequest.ts
src/models/MaterialOption.ts
src/models/MaterialRequest.ts
src/models/Model.ts
src/models/ModelDocument.ts
src/models/ModelDocumentRequest.ts
src/models/ModelErrors.ts
src/models/ModelErrorsRequest.ts
src/models/ModelFiles.ts
Expand Down
4 changes: 2 additions & 2 deletions package/src/apis/CollaborationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ export class CollaborationApi extends runtime.BaseAPI {
}

/**
* Create a document. If the document is one of {\'OBJ\', \'IFC\', \'GLTF\', \'DXF\', \'POINT_CLOUD\', \'DWG\'}, a model will be created and attached to this document Required scopes: document:write
* Create a document. If the document is one of {\'DXF\', \'GLTF\', \'POINT_CLOUD\', \'OBJ\', \'DWG\', \'IFC\'}, a model will be created and attached to this document Required scopes: document:write
* Create a document
*/
async createDocumentRaw(requestParameters: CreateDocumentRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Document>> {
Expand Down Expand Up @@ -1778,7 +1778,7 @@ export class CollaborationApi extends runtime.BaseAPI {
}

/**
* Create a document. If the document is one of {\'OBJ\', \'IFC\', \'GLTF\', \'DXF\', \'POINT_CLOUD\', \'DWG\'}, a model will be created and attached to this document Required scopes: document:write
* Create a document. If the document is one of {\'DXF\', \'GLTF\', \'POINT_CLOUD\', \'OBJ\', \'DWG\', \'IFC\'}, a model will be created and attached to this document Required scopes: document:write
* Create a document
*/
async createDocument(cloud_pk: number, project_pk: number, name: string, file: Blob, parent_id?: number | null, file_name?: string, description?: string | null, model_source?: CreateDocumentModelSourceEnum, ifc_source?: CreateDocumentIfcSourceEnum, successor_of?: number, process_hint?: CreateDocumentProcessHintEnum, initOverrides?: RequestInit): Promise<Document> {
Expand Down
16 changes: 8 additions & 8 deletions package/src/models/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import { exists, mapValues } from '../runtime';
import {
Document,
DocumentFromJSON,
DocumentFromJSONTyped,
DocumentToJSON,
} from './Document';
ModelDocument,
ModelDocumentFromJSON,
ModelDocumentFromJSONTyped,
ModelDocumentToJSON,
} from './ModelDocument';
import {
ModelSerializerWithoutChildren,
ModelSerializerWithoutChildrenFromJSON,
Expand Down Expand Up @@ -115,10 +115,10 @@ export interface Model {
readonly document_id: number | null;
/**
*
* @type {Document}
* @type {ModelDocument}
* @memberof Model
*/
readonly document: Document | null;
readonly document: ModelDocument | null;
/**
*
* @type {string}
Expand Down Expand Up @@ -301,7 +301,7 @@ export function ModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): Mod
'created_at': (new Date(json['created_at'])),
'updated_at': (new Date(json['updated_at'])),
'document_id': json['document_id'],
'document': DocumentFromJSON(json['document']),
'document': ModelDocumentFromJSON(json['document']),
'structure_file': json['structure_file'],
'systems_file': json['systems_file'],
'map_file': json['map_file'],
Expand Down
153 changes: 153 additions & 0 deletions package/src/models/ModelDocument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/* tslint:disable */
/* eslint-disable */
/**
* BIMData API
* BIMData API is a tool to interact with your models stored on BIMData’s servers. Through the API, you can manage your projects, the clouds, upload your IFC files and manage them through endpoints.
*
* The version of the OpenAPI document: v1 (v1)
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ModelDocument
*/
export interface ModelDocument {
/**
*
* @type {number}
* @memberof ModelDocument
*/
readonly id: number;
/**
* Shown name of the file
* @type {string}
* @memberof ModelDocument
*/
name: string;
/**
* Full name of the file
* @type {string}
* @memberof ModelDocument
*/
file_name?: string;
/**
* Description of the file
* @type {string}
* @memberof ModelDocument
*/
description?: string | null;
/**
*
* @type {string}
* @memberof ModelDocument
*/
file: string;
/**
* Size of the file.
* @type {number}
* @memberof ModelDocument
*/
readonly size: number | null;
/**
* Creation date
* @type {Date}
* @memberof ModelDocument
*/
readonly created_at: Date;
/**
* Date of the last update
* @type {Date}
* @memberof ModelDocument
*/
readonly updated_at: Date;
/**
* Document id of head version
* @type {number}
* @memberof ModelDocument
*/
readonly head_id: number | null;
/**
* Document is a head of version or is owned by another document
* @type {boolean}
* @memberof ModelDocument
*/
readonly is_head_version: boolean;
/**
* Number of previous versions
* @type {number}
* @memberof ModelDocument
*/
readonly history_count: number | null;
/**
* Aggregate of group user permissions and folder default permission
* @type {number}
* @memberof ModelDocument
*/
readonly user_permission: ModelDocumentUserPermissionEnum;
/**
* Office files will be converted as pdf to provide a web preview. Supported extensions are .ppt, .pptx, .odp, .xls, .xlsx, .ods, .doc, .docx, .odt
* @type {string}
* @memberof ModelDocument
*/
readonly office_preview: string | null;
}

/**
* @export
* @enum {string}
*/
export enum ModelDocumentUserPermissionEnum {
NUMBER_1 = 1,
NUMBER_50 = 50,
NUMBER_100 = 100
}

export function ModelDocumentFromJSON(json: any): ModelDocument {
return ModelDocumentFromJSONTyped(json, false);
}

export function ModelDocumentFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelDocument {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'id': json['id'],
'name': json['name'],
'file_name': !exists(json, 'file_name') ? undefined : json['file_name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'file': json['file'],
'size': json['size'],
'created_at': (new Date(json['created_at'])),
'updated_at': (new Date(json['updated_at'])),
'head_id': json['head_id'],
'is_head_version': json['is_head_version'],
'history_count': json['history_count'],
'user_permission': json['user_permission'],
'office_preview': json['office_preview'],
};
}

export function ModelDocumentToJSON(value?: ModelDocument | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'name': value.name,
'file_name': value.file_name,
'description': value.description,
'file': value.file,
};
}

98 changes: 98 additions & 0 deletions package/src/models/ModelDocumentRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/* tslint:disable */
/* eslint-disable */
/**
* BIMData API
* BIMData API is a tool to interact with your models stored on BIMData’s servers. Through the API, you can manage your projects, the clouds, upload your IFC files and manage them through endpoints.
*
* The version of the OpenAPI document: v1 (v1)
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ModelDocumentRequest
*/
export interface ModelDocumentRequest {
/**
* Shown name of the file
* @type {string}
* @memberof ModelDocumentRequest
*/
name: string;
/**
* Full name of the file
* @type {string}
* @memberof ModelDocumentRequest
*/
file_name?: string;
/**
* Description of the file
* @type {string}
* @memberof ModelDocumentRequest
*/
description?: string | null;
/**
*
* @type {Blob}
* @memberof ModelDocumentRequest
*/
file: Blob;
/**
* Provide a info about the document in order to customize the way it is processed.
*
* * `PHOTOSPHERE` - PHOTOSPHERE
* @type {string}
* @memberof ModelDocumentRequest
*/
process_hint?: ModelDocumentRequestProcessHintEnum;
}

/**
* @export
* @enum {string}
*/
export enum ModelDocumentRequestProcessHintEnum {
Photosphere = 'PHOTOSPHERE'
}

export function ModelDocumentRequestFromJSON(json: any): ModelDocumentRequest {
return ModelDocumentRequestFromJSONTyped(json, false);
}

export function ModelDocumentRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelDocumentRequest {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'name': json['name'],
'file_name': !exists(json, 'file_name') ? undefined : json['file_name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'file': json['file'],
'process_hint': !exists(json, 'process_hint') ? undefined : json['process_hint'],
};
}

export function ModelDocumentRequestToJSON(value?: ModelDocumentRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'name': value.name,
'file_name': value.file_name,
'description': value.description,
'file': value.file,
'process_hint': value.process_hint,
};
}

16 changes: 8 additions & 8 deletions package/src/models/ModelSerializerWithoutChildren.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import { exists, mapValues } from '../runtime';
import {
Document,
DocumentFromJSON,
DocumentFromJSONTyped,
DocumentToJSON,
} from './Document';
ModelDocument,
ModelDocumentFromJSON,
ModelDocumentFromJSONTyped,
ModelDocumentToJSON,
} from './ModelDocument';
import {
User,
UserFromJSON,
Expand Down Expand Up @@ -109,10 +109,10 @@ export interface ModelSerializerWithoutChildren {
readonly document_id: number | null;
/**
*
* @type {Document}
* @type {ModelDocument}
* @memberof ModelSerializerWithoutChildren
*/
readonly document: Document | null;
readonly document: ModelDocument | null;
/**
*
* @type {string}
Expand Down Expand Up @@ -289,7 +289,7 @@ export function ModelSerializerWithoutChildrenFromJSONTyped(json: any, ignoreDis
'created_at': (new Date(json['created_at'])),
'updated_at': (new Date(json['updated_at'])),
'document_id': json['document_id'],
'document': DocumentFromJSON(json['document']),
'document': ModelDocumentFromJSON(json['document']),
'structure_file': json['structure_file'],
'systems_file': json['systems_file'],
'map_file': json['map_file'],
Expand Down
Loading

0 comments on commit ee0d684

Please sign in to comment.