onshape-clients
Version:
The meta package for creating the various Onshape clients
1,037 lines (882 loc) • 76.9 kB
text/typescript
/**
* Onshape REST API
* The Onshape REST API consumed by all clients.
*
* OpenAPI spec version: 1.93
* Contact: api-support@onshape.zendesk.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */
import { BTBoundingBox } from '../model/bTBoundingBox';
import { BTDocumentElementInfo } from '../model/bTDocumentElementInfo';
import { BTExportModelBodiesResponse } from '../model/bTExportModelBodiesResponse';
import { BTExportTessellatedEdgesResponse } from '../model/bTExportTessellatedEdgesResponse';
import { BTExportTessellatedFacesResponse } from '../model/bTExportTessellatedFacesResponse';
import { BTFeatureDefinitionResponse } from '../model/bTFeatureDefinitionResponse';
import { BTFeatureListResponse } from '../model/bTFeatureListResponse';
import { BTIdTranslationInfo } from '../model/bTIdTranslationInfo';
import { BTIdTranslationParams } from '../model/bTIdTranslationParams';
import { BTMassPropResponse } from '../model/bTMassPropResponse';
import { BTModelElementParams } from '../model/bTModelElementParams';
import { BTModelFormatInfo } from '../model/bTModelFormatInfo';
import { BTNamedViewsInfo } from '../model/bTNamedViewsInfo';
import { BTShadedRenderDocumentResponse } from '../model/bTShadedRenderDocumentResponse';
import { BTTranslateFormatParams } from '../model/bTTranslateFormatParams';
import { BTTranslationRequestInfo } from '../model/bTTranslationRequestInfo';
import { OpenAPI } from '../model/openAPI';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models';
let defaultBasePath = 'http://localhost';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
export enum DefaultApiApiKeys {
}
export class DefaultApi {
protected _basePath = defaultBasePath;
protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false;
protected authentications = {
'default': <Authentication>new VoidAuth(),
'OAuth2': new OAuth(),
}
constructor(basePath?: string);
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
set useQuerystring(value: boolean) {
this._useQuerystring = value;
}
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setDefaultAuthentication(auth: Authentication) {
this.authentications.default = auth;
}
public setApiKey(key: DefaultApiApiKeys, value: string) {
(this.authentications as any)[DefaultApiApiKeys[key]].apiKey = value;
}
set accessToken(token: string) {
this.authentications.OAuth2.accessToken = token;
}
/**
*
* @summary Add Feature
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param body feature The serialized feature definition
*/
public addFeature1 (did: string, wvm: string, wvmid: string, eid: string, body?: string) : Promise<{ response: http.ClientResponse; body: BTFeatureDefinitionResponse; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/features'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling addFeature1.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling addFeature1.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling addFeature1.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling addFeature1.');
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(body, "string")
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: BTFeatureDefinitionResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "BTFeatureDefinitionResponse");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Create Part Studio
* @param did Document ID.
* @param wid Workspace ID.
* @param bTModelElementParams
*/
public createPartStudio (did: string, wid: string, bTModelElementParams: BTModelElementParams) : Promise<{ response: http.ClientResponse; body: BTDocumentElementInfo; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/w/{wid}'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wid' + '}', encodeURIComponent(String(wid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling createPartStudio.');
}
// verify required parameter 'wid' is not null or undefined
if (wid === null || wid === undefined) {
throw new Error('Required parameter wid was null or undefined when calling createPartStudio.');
}
// verify required parameter 'bTModelElementParams' is not null or undefined
if (bTModelElementParams === null || bTModelElementParams === undefined) {
throw new Error('Required parameter bTModelElementParams was null or undefined when calling createPartStudio.');
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(bTModelElementParams, "BTModelElementParams")
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: BTDocumentElementInfo; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "BTDocumentElementInfo");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Export Part Studio to Parasolid
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param partIds IDs of the parts to retrieve. Repeat query param to add more than one, i.e. partId=JHK&partId=JHD). May not be combined with other ID filters
* @param version Parasolid version
* @param includeExportIds Whether topolgy ids should be exported as parasolid attributes
* @param configuration Configuration string.
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
*/
public exportPS1 (did: string, wvm: string, wvmid: string, eid: string, partIds?: string, version?: string, includeExportIds?: boolean, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/parasolid'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling exportPS1.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling exportPS1.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling exportPS1.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling exportPS1.');
}
if (partIds !== undefined) {
localVarQueryParameters['partIds'] = ObjectSerializer.serialize(partIds, "string");
}
if (version !== undefined) {
localVarQueryParameters['version'] = ObjectSerializer.serialize(version, "string");
}
if (includeExportIds !== undefined) {
localVarQueryParameters['includeExportIds'] = ObjectSerializer.serialize(includeExportIds, "boolean");
}
if (configuration !== undefined) {
localVarQueryParameters['configuration'] = ObjectSerializer.serialize(configuration, "string");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Export Part Studio to STL
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param partIds IDs of the parts to retrieve. Repeat query param to add more than one, i.e. partId=JHK&partId=JHD). May not be combined with other ID filters
* @param mode Type of file: text, binary
* @param grouping Whether parts should be exported as a group or individually in a .zip file
* @param scale Scale for measurements.
* @param units Name of base unit (meter, centimeter, millimeter, inch, foot, or yard)
* @param angleTolerance Angle tolerance (in radians). This specifies the limit on the sum of the angular deviations of a tessellation chord from the tangent vectors at two chord endpoints. The specified value must be less than PI/2. This parameter currently has a default value chosen based on the complexity of the parts being tessellated.
* @param chordTolerance Chord tolerance (in meters). This specifies the limit on the maximum deviation of a tessellation chord from the true surface/edge. This parameter currently has a default value chosen based on the size and complexity of the parts being tessellated.
* @param maxFacetWidth Max facet width. This specifies the limit on the size of any side of a tessellation facet.
* @param minFacetWidth Max facet width. This specifies the limit on the size of any side of a tessellation facet.
* @param configuration Configuration string.
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
*/
public exportStl1 (did: string, wvm: string, wvmid: string, eid: string, partIds?: string, mode?: string, grouping?: boolean, scale?: number, units?: string, angleTolerance?: number, chordTolerance?: number, maxFacetWidth?: number, minFacetWidth?: number, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/stl'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling exportStl1.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling exportStl1.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling exportStl1.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling exportStl1.');
}
if (partIds !== undefined) {
localVarQueryParameters['partIds'] = ObjectSerializer.serialize(partIds, "string");
}
if (mode !== undefined) {
localVarQueryParameters['mode'] = ObjectSerializer.serialize(mode, "string");
}
if (grouping !== undefined) {
localVarQueryParameters['grouping'] = ObjectSerializer.serialize(grouping, "boolean");
}
if (scale !== undefined) {
localVarQueryParameters['scale'] = ObjectSerializer.serialize(scale, "number");
}
if (units !== undefined) {
localVarQueryParameters['units'] = ObjectSerializer.serialize(units, "string");
}
if (angleTolerance !== undefined) {
localVarQueryParameters['angleTolerance'] = ObjectSerializer.serialize(angleTolerance, "number");
}
if (chordTolerance !== undefined) {
localVarQueryParameters['chordTolerance'] = ObjectSerializer.serialize(chordTolerance, "number");
}
if (maxFacetWidth !== undefined) {
localVarQueryParameters['maxFacetWidth'] = ObjectSerializer.serialize(maxFacetWidth, "number");
}
if (minFacetWidth !== undefined) {
localVarQueryParameters['minFacetWidth'] = ObjectSerializer.serialize(minFacetWidth, "number");
}
if (configuration !== undefined) {
localVarQueryParameters['configuration'] = ObjectSerializer.serialize(configuration, "string");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Array of body information
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param configuration Configuration string.
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
*/
public getBodyDetails2 (did: string, wvm: string, wvmid: string, eid: string, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body: Array<BTExportModelBodiesResponse>; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/bodydetails'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling getBodyDetails2.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling getBodyDetails2.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling getBodyDetails2.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling getBodyDetails2.');
}
if (configuration !== undefined) {
localVarQueryParameters['configuration'] = ObjectSerializer.serialize(configuration, "string");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: Array<BTExportModelBodiesResponse>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<BTExportModelBodiesResponse>");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Mass properties of parts or a PartStudio.
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param includeHidden Whether or not to include bounding boxes for hidden parts.
* @param includeWireBodies Whether to include wire bodies in the bounding box.
* @param configuration Configuration string.
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
*/
public getBoundingBoxes2 (did: string, wvm: string, wvmid: string, eid: string, includeHidden?: boolean, includeWireBodies?: boolean, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body: BTBoundingBox; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/boundingboxes'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling getBoundingBoxes2.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling getBoundingBoxes2.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling getBoundingBoxes2.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling getBoundingBoxes2.');
}
if (includeHidden !== undefined) {
localVarQueryParameters['includeHidden'] = ObjectSerializer.serialize(includeHidden, "boolean");
}
if (includeWireBodies !== undefined) {
localVarQueryParameters['includeWireBodies'] = ObjectSerializer.serialize(includeWireBodies, "boolean");
}
if (configuration !== undefined) {
localVarQueryParameters['configuration'] = ObjectSerializer.serialize(configuration, "string");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: BTBoundingBox; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "BTBoundingBox");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Tesselated edges from a PartStudio.
* @param did
* @param wvm
* @param wvmid
* @param eid
* @param angleTolerance
* @param chordTolerance
* @param partId
* @param edgeId
* @param configuration
* @param linkDocumentId
*/
public getEdges2 (did: string, wvm: string, wvmid: string, eid: string, angleTolerance?: number, chordTolerance?: number, partId?: Array<string>, edgeId?: Array<string>, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body: BTExportTessellatedEdgesResponse; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/tessellatededges'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling getEdges2.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling getEdges2.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling getEdges2.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling getEdges2.');
}
if (angleTolerance !== undefined) {
localVarQueryParameters['angleTolerance'] = ObjectSerializer.serialize(angleTolerance, "number");
}
if (chordTolerance !== undefined) {
localVarQueryParameters['chordTolerance'] = ObjectSerializer.serialize(chordTolerance, "number");
}
if (partId !== undefined) {
localVarQueryParameters['partId'] = ObjectSerializer.serialize(partId, "Array<string>");
}
if (edgeId !== undefined) {
localVarQueryParameters['edgeId'] = ObjectSerializer.serialize(edgeId, "Array<string>");
}
if (configuration !== undefined) {
localVarQueryParameters['configuration'] = ObjectSerializer.serialize(configuration, "string");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: BTExportTessellatedEdgesResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "BTExportTessellatedEdgesResponse");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Tesselated faces of the parts in the Part Studio.
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param angleTolerance Angle tolerance (in radians). This specifies the limit on the sum of the angular deviations of a tessellation chord from the tangent vectors at two chord endpoints. The specified value must be less than PI/2. This parameter currently has a default value chosen based on the complexity of the parts being tessellated.
* @param chordTolerance Chord tolerance (in meters). This specifies the limit on the maximum deviation of a tessellation chord from the true surface/edge. This parameter currently has a default value chosen based on the size and complexity of the parts being tessellated.
* @param maxFacetWidth Max facet width. This specifies the limit on the size of any side of a tessellation facet.
* @param outputVertexNormals If true, output vertex normals corresponding to surface normals at facet vertex points.
* @param outputFacetNormals Output facet normals.
* @param outputTextureCoordinates Output texture coordinates.
* @param outputIndexTable Output index table.
* @param partId IDs of the parts to retrieve. Repeat query param to add more than one, i.e. partId=JHK&partId=JHD). May not be combined with other ID filters
* @param faceId IDs of the faces to tessellate (repeat query param to add more than one, i.e. faceId=JHK&faceId=JHD)
* @param outputErrorFaces Whether or not to output faces that cause an error
* @param configuration Configuration string.
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
*/
public getFaces2 (did: string, wvm: string, wvmid: string, eid: string, angleTolerance?: number, chordTolerance?: number, maxFacetWidth?: number, outputVertexNormals?: boolean, outputFacetNormals?: boolean, outputTextureCoordinates?: boolean, outputIndexTable?: boolean, partId?: Array<string>, faceId?: Array<string>, outputErrorFaces?: boolean, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body: BTExportTessellatedFacesResponse; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/tessellatedfaces'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling getFaces2.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling getFaces2.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling getFaces2.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling getFaces2.');
}
if (angleTolerance !== undefined) {
localVarQueryParameters['angleTolerance'] = ObjectSerializer.serialize(angleTolerance, "number");
}
if (chordTolerance !== undefined) {
localVarQueryParameters['chordTolerance'] = ObjectSerializer.serialize(chordTolerance, "number");
}
if (maxFacetWidth !== undefined) {
localVarQueryParameters['maxFacetWidth'] = ObjectSerializer.serialize(maxFacetWidth, "number");
}
if (outputVertexNormals !== undefined) {
localVarQueryParameters['outputVertexNormals'] = ObjectSerializer.serialize(outputVertexNormals, "boolean");
}
if (outputFacetNormals !== undefined) {
localVarQueryParameters['outputFacetNormals'] = ObjectSerializer.serialize(outputFacetNormals, "boolean");
}
if (outputTextureCoordinates !== undefined) {
localVarQueryParameters['outputTextureCoordinates'] = ObjectSerializer.serialize(outputTextureCoordinates, "boolean");
}
if (outputIndexTable !== undefined) {
localVarQueryParameters['outputIndexTable'] = ObjectSerializer.serialize(outputIndexTable, "boolean");
}
if (partId !== undefined) {
localVarQueryParameters['partId'] = ObjectSerializer.serialize(partId, "Array<string>");
}
if (faceId !== undefined) {
localVarQueryParameters['faceId'] = ObjectSerializer.serialize(faceId, "Array<string>");
}
if (outputErrorFaces !== undefined) {
localVarQueryParameters['outputErrorFaces'] = ObjectSerializer.serialize(outputErrorFaces, "boolean");
}
if (configuration !== undefined) {
localVarQueryParameters['configuration'] = ObjectSerializer.serialize(configuration, "string");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: BTExportTessellatedFacesResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "BTExportTessellatedFacesResponse");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Get Feature List
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param featureId ID of a feature; repeat query param to add more than one
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
* @param noSketchGeometry Whether or not to output simple sketch info without geometry
*/
public getFeatures (did: string, wvm: string, wvmid: string, eid: string, featureId?: Array<string>, linkDocumentId?: string, noSketchGeometry?: boolean) : Promise<{ response: http.ClientResponse; body: BTFeatureListResponse; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/features'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling getFeatures.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling getFeatures.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling getFeatures.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling getFeatures.');
}
if (featureId !== undefined) {
localVarQueryParameters['featureId'] = ObjectSerializer.serialize(featureId, "Array<string>");
}
if (linkDocumentId !== undefined) {
localVarQueryParameters['linkDocumentId'] = ObjectSerializer.serialize(linkDocumentId, "string");
}
if (noSketchGeometry !== undefined) {
localVarQueryParameters['noSketchGeometry'] = ObjectSerializer.serialize(noSketchGeometry, "boolean");
}
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.OAuth2.applyToRequest(localVarRequestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: BTFeatureListResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "BTFeatureListResponse");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
}
}
});
});
}
/**
*
* @summary Mass properties of parts or a PartStudio.
* @param did Document ID.
* @param wvm One of w or v or m corresponding to whether a workspace or version or microversion was entered.
* @param wvmid Workspace (w), Version (v) or Microversion (m) ID.
* @param eid Element ID.
* @param partId IDs of the parts to retrieve. Repeat query param to add more than one, i.e. partId=JHK&partId=JHD). May not be combined with other ID filters
* @param massAsGroup If true, specified parts will be evaluated as a single object instead of individually
* @param configuration Configuration string.
* @param linkDocumentId Id of document that links to the document being accessed. This may provide additional access rights to the document. Allowed only with version (v) path parameter.
*/
public getMassProperties (did: string, wvm: string, wvmid: string, eid: string, partId?: Array<string>, massAsGroup?: boolean, configuration?: string, linkDocumentId?: string) : Promise<{ response: http.ClientResponse; body: BTMassPropResponse; }> {
const localVarPath = this.basePath + '/api/partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/massproperties'
.replace('{' + 'did' + '}', encodeURIComponent(String(did)))
.replace('{' + 'wvm' + '}', encodeURIComponent(String(wvm)))
.replace('{' + 'wvmid' + '}', encodeURIComponent(String(wvmid)))
.replace('{' + 'eid' + '}', encodeURIComponent(String(eid)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
// verify required parameter 'did' is not null or undefined
if (did === null || did === undefined) {
throw new Error('Required parameter did was null or undefined when calling getMassProperties.');
}
// verify required parameter 'wvm' is not null or undefined
if (wvm === null || wvm === undefined) {
throw new Error('Required parameter wvm was null or undefined when calling getMassProperties.');
}
// verify required parameter 'wvmid' is not null or undefined
if (wvmid === null || wvmid === undefined) {
throw new Error('Required parameter wvmid was null or undefined when calling getMassProperties.');
}
// verify required parameter 'eid' is not null or undefined
if (eid === null || eid === undefined) {
throw new Error('Required parameter eid was null or undefined when calling getMassProperties.');
}
if (partId !== undefined) {
localVarQueryParameters['partId'] = ObjectSerializer.serialize(partId, "Array<string>");
}
if (massAsGroup !== undefined) {
localVarQueryParameters['massAsGroup'] = ObjectSerializer.serialize(massAsGroup, "boolean");
}
if (configuration !== undefined) {
loc