Skip to content

Commit

Permalink
MINOR: Feature: Photosphere Model (#758)
Browse files Browse the repository at this point in the history
* MINOR: feat(photosphere): add PHOTOSPHERE model type

* MINOR: feat(photosphere): add create-photosphere route

* MINOR: feat: add create-photospĥere-building route

* fix: IsMetaBuilding perm classes + little opti in create-photosphere route

* fix(ifc): merge 2 migrations into 1
  • Loading branch information
Bimdata-io committed Sep 11, 2024
1 parent 67a5338 commit f718bfe
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package/src/apis/CollaborationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ export class CollaborationApi extends runtime.BaseAPI {
}

/**
* Create a document. If the document is one of {\'DXF\', \'OBJ\', \'DWG\', \'IFC\', \'GLTF\', \'POINT_CLOUD\'}, a model will be created and attached to this document Required scopes: document:write
* Create a document. If the document is one of {\'DXF\', \'POINT_CLOUD\', \'OBJ\', \'DWG\', \'IFC\', \'GLTF\'}, 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 @@ -1780,7 +1780,7 @@ export class CollaborationApi extends runtime.BaseAPI {
}

/**
* Create a document. If the document is one of {\'DXF\', \'OBJ\', \'DWG\', \'IFC\', \'GLTF\', \'POINT_CLOUD\'}, a model will be created and attached to this document Required scopes: document:write
* Create a document. If the document is one of {\'DXF\', \'POINT_CLOUD\', \'OBJ\', \'DWG\', \'IFC\', \'GLTF\'}, 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, initOverrides?: RequestInit): Promise<Document> {
Expand Down
136 changes: 136 additions & 0 deletions package/src/apis/ModelApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,18 @@ export interface CreateMultiPageModelOperationRequest {
CreateMultiPageModelRequest: CreateMultiPageModelRequest;
}

export interface CreatePhotosphereRequest {
cloud_pk: number;
project_pk: number;
CreateModelRequest: CreateModelRequest;
}

export interface CreatePhotosphereBuildingRequest {
cloud_pk: number;
project_pk: number;
CreateBuildingByNameRequest: CreateBuildingByNameRequest;
}

export interface CreatePropertySetRequest {
cloud_pk: number;
model_pk: number;
Expand Down Expand Up @@ -3465,6 +3477,128 @@ export class ModelApi extends runtime.BaseAPI {
return await response.value();
}

/**
* Create a photosphere model to be used in BIMData services Required scopes: ifc:write, model:write
* Create a photopshere model from an image file
*/
async createPhotosphereRaw(requestParameters: CreatePhotosphereRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Model>> {
if (requestParameters.cloud_pk === null || requestParameters.cloud_pk === undefined) {
throw new runtime.RequiredError('cloud_pk','Required parameter requestParameters.cloud_pk was null or undefined when calling createPhotosphere.');
}

if (requestParameters.project_pk === null || requestParameters.project_pk === undefined) {
throw new runtime.RequiredError('project_pk','Required parameter requestParameters.project_pk was null or undefined when calling createPhotosphere.');
}

if (requestParameters.CreateModelRequest === null || requestParameters.CreateModelRequest === undefined) {
throw new runtime.RequiredError('CreateModelRequest','Required parameter requestParameters.CreateModelRequest was null or undefined when calling createPhotosphere.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}

if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("BIMData_Connect", []);
}

if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("BIMData_Connect", []);
}

if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // Bearer authentication
}

const response = await this.request({
path: `/cloud/{cloud_pk}/project/{project_pk}/model/create-photosphere`.replace(`{${"cloud_pk"}}`, encodeURIComponent(String(requestParameters.cloud_pk))).replace(`{${"project_pk"}}`, encodeURIComponent(String(requestParameters.project_pk))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreateModelRequestToJSON(requestParameters.CreateModelRequest),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ModelFromJSON(jsonValue));
}

/**
* Create a photosphere model to be used in BIMData services Required scopes: ifc:write, model:write
* Create a photopshere model from an image file
*/
async createPhotosphere(cloud_pk: number, project_pk: number, CreateModelRequest: CreateModelRequest, initOverrides?: RequestInit): Promise<Model> {
const response = await this.createPhotosphereRaw({ cloud_pk: cloud_pk, project_pk: project_pk, CreateModelRequest: CreateModelRequest }, initOverrides);
return await response.value();
}

/**
* Create an empty Photosphere Building Model Required scopes: ifc:write, model:write
* Create an empty Photosphere Building Model
*/
async createPhotosphereBuildingRaw(requestParameters: CreatePhotosphereBuildingRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Model>> {
if (requestParameters.cloud_pk === null || requestParameters.cloud_pk === undefined) {
throw new runtime.RequiredError('cloud_pk','Required parameter requestParameters.cloud_pk was null or undefined when calling createPhotosphereBuilding.');
}

if (requestParameters.project_pk === null || requestParameters.project_pk === undefined) {
throw new runtime.RequiredError('project_pk','Required parameter requestParameters.project_pk was null or undefined when calling createPhotosphereBuilding.');
}

if (requestParameters.CreateBuildingByNameRequest === null || requestParameters.CreateBuildingByNameRequest === undefined) {
throw new runtime.RequiredError('CreateBuildingByNameRequest','Required parameter requestParameters.CreateBuildingByNameRequest was null or undefined when calling createPhotosphereBuilding.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}

if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("BIMData_Connect", []);
}

if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("BIMData_Connect", []);
}

if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // Bearer authentication
}

const response = await this.request({
path: `/cloud/{cloud_pk}/project/{project_pk}/model/create-photosphere-building`.replace(`{${"cloud_pk"}}`, encodeURIComponent(String(requestParameters.cloud_pk))).replace(`{${"project_pk"}}`, encodeURIComponent(String(requestParameters.project_pk))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreateBuildingByNameRequestToJSON(requestParameters.CreateBuildingByNameRequest),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ModelFromJSON(jsonValue));
}

/**
* Create an empty Photosphere Building Model Required scopes: ifc:write, model:write
* Create an empty Photosphere Building Model
*/
async createPhotosphereBuilding(cloud_pk: number, project_pk: number, CreateBuildingByNameRequest: CreateBuildingByNameRequest, initOverrides?: RequestInit): Promise<Model> {
const response = await this.createPhotosphereBuildingRaw({ cloud_pk: cloud_pk, project_pk: project_pk, CreateBuildingByNameRequest: CreateBuildingByNameRequest }, initOverrides);
return await response.value();
}

/**
* Bulk create available. You can either post an object or a list of objects. Is you post a list, the response will be a list (in the same order) of created objects or of errors if any If at least one create succeeded, the status code will be 201. If every create failed, the status code we\'ll be 400 with the list of errors Required scopes: ifc:write, model:write
* Create one or many PropertySet
Expand Down Expand Up @@ -11362,6 +11496,8 @@ export enum GetModelsTypeEnum {
Metabuilding = 'METABUILDING',
Obj = 'OBJ',
Pdf = 'PDF',
Photosphere = 'PHOTOSPHERE',
PhotosphereBuilding = 'PHOTOSPHERE_BUILDING',
Png = 'PNG',
PointCloud = 'POINT_CLOUD'
}
Expand Down
6 changes: 5 additions & 1 deletion package/src/models/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export interface Model {
* * `OBJ` - OBJ
* * `POINT_CLOUD` - POINT_CLOUD
* * `METABUILDING` - METABUILDING
* * `PHOTOSPHERE` - PHOTOSPHERE
* * `PHOTOSPHERE_BUILDING` - PHOTOSPHERE_BUILDING
* @type {string}
* @memberof Model
*/
Expand Down Expand Up @@ -259,7 +261,9 @@ export enum ModelTypeEnum {
Png = 'PNG',
Obj = 'OBJ',
PointCloud = 'POINT_CLOUD',
Metabuilding = 'METABUILDING'
Metabuilding = 'METABUILDING',
Photosphere = 'PHOTOSPHERE',
PhotosphereBuilding = 'PHOTOSPHERE_BUILDING'
}/**
* @export
* @enum {string}
Expand Down
6 changes: 5 additions & 1 deletion package/src/models/ModelSerializerWithoutChildren.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export interface ModelSerializerWithoutChildren {
* * `OBJ` - OBJ
* * `POINT_CLOUD` - POINT_CLOUD
* * `METABUILDING` - METABUILDING
* * `PHOTOSPHERE` - PHOTOSPHERE
* * `PHOTOSPHERE_BUILDING` - PHOTOSPHERE_BUILDING
* @type {string}
* @memberof ModelSerializerWithoutChildren
*/
Expand Down Expand Up @@ -247,7 +249,9 @@ export enum ModelSerializerWithoutChildrenTypeEnum {
Png = 'PNG',
Obj = 'OBJ',
PointCloud = 'POINT_CLOUD',
Metabuilding = 'METABUILDING'
Metabuilding = 'METABUILDING',
Photosphere = 'PHOTOSPHERE',
PhotosphereBuilding = 'PHOTOSPHERE_BUILDING'
}/**
* @export
* @enum {string}
Expand Down
16 changes: 8 additions & 8 deletions package/src/models/WriteFolderRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ export interface WriteFolderRequest {
* @memberof WriteFolderRequest
*/
parent_id?: number | null;
/**
* Name of the folder
* @type {string}
* @memberof WriteFolderRequest
*/
name: string;
/**
* Permission for a Folder
*
Expand All @@ -41,6 +35,12 @@ export interface WriteFolderRequest {
* @memberof WriteFolderRequest
*/
default_permission?: WriteFolderRequestDefaultPermissionEnum;
/**
* Name of the folder
* @type {string}
* @memberof WriteFolderRequest
*/
name: string;
/**
*
* @type {Array<WriteFolderRequest>}
Expand Down Expand Up @@ -70,8 +70,8 @@ export function WriteFolderRequestFromJSONTyped(json: any, ignoreDiscriminator:
return {

'parent_id': !exists(json, 'parent_id') ? undefined : json['parent_id'],
'name': json['name'],
'default_permission': !exists(json, 'default_permission') ? undefined : json['default_permission'],
'name': json['name'],
'children': !exists(json, 'children') ? undefined : (json['children'] === null ? null : (json['children'] as Array<any>).map(WriteFolderRequestFromJSON)),
};
}
Expand All @@ -86,8 +86,8 @@ export function WriteFolderRequestToJSON(value?: WriteFolderRequest | null): any
return {

'parent_id': value.parent_id,
'name': value.name,
'default_permission': value.default_permission,
'name': value.name,
'children': value.children === undefined ? undefined : (value.children === null ? null : (value.children as Array<any>).map(WriteFolderRequestToJSON)),
};
}
Expand Down

0 comments on commit f718bfe

Please sign in to comment.