@@ -37,6 +37,9 @@ import { CropSampleRequest } from '../model/cropSampleRequest';
3737import { CropSampleResponse } from '../model/cropSampleResponse' ;
3838import { DataExplorerPredictionsResponse } from '../model/dataExplorerPredictionsResponse' ;
3939import { DataExplorerSettings } from '../model/dataExplorerSettings' ;
40+ import { DatasetStratificationOptions } from '../model/datasetStratificationOptions' ;
41+ import { DatasetStratificationPreviewResponse } from '../model/datasetStratificationPreviewResponse' ;
42+
4043import { EditSampleLabelRequest } from '../model/editSampleLabelRequest' ;
4144import { FindSegmentSampleRequest } from '../model/findSegmentSampleRequest' ;
4245import { FindSegmentSampleResponse } from '../model/findSegmentSampleResponse' ;
@@ -5684,6 +5687,96 @@ export class RawDataApi {
56845687 ) ;
56855688 }
56865689
5690+ /**
5691+ * Returns the results of a previously requested stratification preview job. This endpoint is used to retrieve the results after a stratification preview job has been started.
5692+ * @summary Get stratify preview results
5693+ * @param projectId Project ID
5694+ */
5695+ public async getStratifyPreviewResults ( projectId : number , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < DatasetStratificationPreviewResponse > {
5696+ const localVarPath = this . basePath + '/api/{projectId}/get-stratify-preview-results'
5697+ . replace ( '{' + 'projectId' + '}' , encodeURIComponent ( String ( projectId ) ) ) ;
5698+ let localVarQueryParameters : Record < string , string > = { } ;
5699+ let localVarHeaderParams : Record < string , string > = {
5700+ 'User-Agent' : 'edgeimpulse-api nodejs' ,
5701+ 'Content-Type' : 'application/json' ,
5702+ ...this . defaultHeaders ,
5703+ } ;
5704+ const produces = [ 'application/json' ] ;
5705+ // give precedence to 'application/json'
5706+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
5707+ localVarHeaderParams . Accept = 'application/json' ;
5708+ } else {
5709+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
5710+ }
5711+ let localVarFormParams : Record < string , string > | FormData | UndiciFormData | undefined ;
5712+
5713+ // verify required parameter 'projectId' is not null or undefined
5714+
5715+
5716+ if ( projectId === null || projectId === undefined ) {
5717+ throw new Error ( 'Required parameter projectId was null or undefined when calling getStratifyPreviewResults.' ) ;
5718+ }
5719+
5720+ localVarHeaderParams = {
5721+ ...localVarHeaderParams ,
5722+ ...options . headers ,
5723+ ...this . opts . extraHeaders ,
5724+ } ;
5725+
5726+ const queryString = Object . entries ( localVarQueryParameters )
5727+ . filter ( ( [ , value ] ) => value !== undefined )
5728+ . map ( ( [ key , value ] ) => `${ key } =${ encodeURIComponent ( String ( value ) ) } ` )
5729+ . join ( '&' ) ;
5730+
5731+ let localVarUrl = localVarPath + ( queryString ? `?${ queryString } ` : '' ) ;
5732+ let localVarRequestOptions : RequestOptionsType = {
5733+ method : 'GET' ,
5734+ headers : { ...localVarHeaderParams } ,
5735+ } ;
5736+
5737+
5738+ let requestOptions = localVarRequestOptions ;
5739+ let url = localVarUrl ;
5740+ const auth_ApiKeyAuthentication = await this . authentications . ApiKeyAuthentication . applyToRequest ( requestOptions , url ) ;
5741+ requestOptions = auth_ApiKeyAuthentication . requestOptions ;
5742+ url = auth_ApiKeyAuthentication . url ;
5743+
5744+ const auth_JWTAuthentication = await this . authentications . JWTAuthentication . applyToRequest ( requestOptions , url ) ;
5745+ requestOptions = auth_JWTAuthentication . requestOptions ;
5746+ url = auth_JWTAuthentication . url ;
5747+
5748+ const auth_JWTHttpHeaderAuthentication = await this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( requestOptions , url ) ;
5749+ requestOptions = auth_JWTHttpHeaderAuthentication . requestOptions ;
5750+ url = auth_JWTHttpHeaderAuthentication . url ;
5751+
5752+ const auth_OAuth2 = await this . authentications . OAuth2 . applyToRequest ( requestOptions , url ) ;
5753+ requestOptions = auth_OAuth2 . requestOptions ;
5754+ url = auth_OAuth2 . url ;
5755+
5756+ const authDefault = await this . authentications . default . applyToRequest ( requestOptions , url ) ;
5757+ requestOptions = authDefault . requestOptions ;
5758+ url = authDefault . url ;
5759+
5760+ if ( localVarFormParams ) {
5761+ delete requestOptions . headers [ 'Content-Type' ] ;
5762+ if ( localVarFormParams instanceof FormData ) {
5763+ // FormData: fetch will handle Content-Type automatically.
5764+ requestOptions . body = localVarFormParams ;
5765+ }
5766+ else if ( Object . keys ( localVarFormParams ) . length > 0 ) {
5767+ // URL-encoded form
5768+ requestOptions . body = new URLSearchParams ( localVarFormParams as Record < string , string > ) . toString ( ) ;
5769+ requestOptions . headers [ 'Content-Type' ] = 'application/x-www-form-urlencoded' ;
5770+ }
5771+ }
5772+
5773+ const response = await fetch ( url , requestOptions ) ;
5774+ return this . handleResponse (
5775+ response ,
5776+ 'DatasetStratificationPreviewResponse'
5777+ ) ;
5778+ }
5779+
56875780 /**
56885781 * Get the original, uncropped, downsampled data.
56895782 * @summary Get the original downsampled data
@@ -7963,6 +8056,206 @@ export class RawDataApi {
79638056 ) ;
79648057 }
79658058
8059+ /**
8060+ * Performs a deterministic, in-place stratified split of the project\'s dataset into \"training\" and \"testing\" sets, based on the chosen stratification options. Stratification can use the label, one or more metadata keys, or both as a composite group. This is a deterministic process based on the hash of the name of the data. Returns immediately on small datasets, or starts a job on larger datasets. For example: { \"stratifyByLabel\": true, \"metadataKeys\": [\"site\", \"scanner\"], \"excludeDisabledSamples\": false, \"splitRatio\": 0.8 } With these options, samples are grouped by the combination of label, site, and scanner. Within each group, 80% are set to \"training\" and the rest to \"testing\".
8061+ * @summary Stratify dataset
8062+ * @param projectId Project ID
8063+ * @param datasetStratificationOptions
8064+ */
8065+ public async stratifyDataset ( projectId : number , datasetStratificationOptions : DatasetStratificationOptions , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < GenericApiResponse | StartJobResponse > {
8066+ const localVarPath = this . basePath + '/api/{projectId}/stratify'
8067+ . replace ( '{' + 'projectId' + '}' , encodeURIComponent ( String ( projectId ) ) ) ;
8068+ let localVarQueryParameters : Record < string , string > = { } ;
8069+ let localVarHeaderParams : Record < string , string > = {
8070+ 'User-Agent' : 'edgeimpulse-api nodejs' ,
8071+ 'Content-Type' : 'application/json' ,
8072+ ...this . defaultHeaders ,
8073+ } ;
8074+ const produces = [ 'application/json' ] ;
8075+ // give precedence to 'application/json'
8076+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
8077+ localVarHeaderParams . Accept = 'application/json' ;
8078+ } else {
8079+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
8080+ }
8081+ let localVarFormParams : Record < string , string > | FormData | UndiciFormData | undefined ;
8082+
8083+ // verify required parameter 'projectId' is not null or undefined
8084+
8085+
8086+ if ( projectId === null || projectId === undefined ) {
8087+ throw new Error ( 'Required parameter projectId was null or undefined when calling stratifyDataset.' ) ;
8088+ }
8089+
8090+ // verify required parameter 'datasetStratificationOptions' is not null or undefined
8091+
8092+
8093+ if ( datasetStratificationOptions === null || datasetStratificationOptions === undefined ) {
8094+ throw new Error ( 'Required parameter datasetStratificationOptions was null or undefined when calling stratifyDataset.' ) ;
8095+ }
8096+
8097+ localVarHeaderParams = {
8098+ ...localVarHeaderParams ,
8099+ ...options . headers ,
8100+ ...this . opts . extraHeaders ,
8101+ } ;
8102+
8103+ const queryString = Object . entries ( localVarQueryParameters )
8104+ . filter ( ( [ , value ] ) => value !== undefined )
8105+ . map ( ( [ key , value ] ) => `${ key } =${ encodeURIComponent ( String ( value ) ) } ` )
8106+ . join ( '&' ) ;
8107+
8108+ let localVarUrl = localVarPath + ( queryString ? `?${ queryString } ` : '' ) ;
8109+ let localVarRequestOptions : RequestOptionsType = {
8110+ method : 'POST' ,
8111+ headers : { ...localVarHeaderParams } ,
8112+ } ;
8113+
8114+ localVarRequestOptions . body = JSON . stringify ( ObjectSerializer . serialize ( datasetStratificationOptions , "DatasetStratificationOptions" ) ) ;
8115+
8116+
8117+ let requestOptions = localVarRequestOptions ;
8118+ let url = localVarUrl ;
8119+ const auth_ApiKeyAuthentication = await this . authentications . ApiKeyAuthentication . applyToRequest ( requestOptions , url ) ;
8120+ requestOptions = auth_ApiKeyAuthentication . requestOptions ;
8121+ url = auth_ApiKeyAuthentication . url ;
8122+
8123+ const auth_JWTAuthentication = await this . authentications . JWTAuthentication . applyToRequest ( requestOptions , url ) ;
8124+ requestOptions = auth_JWTAuthentication . requestOptions ;
8125+ url = auth_JWTAuthentication . url ;
8126+
8127+ const auth_JWTHttpHeaderAuthentication = await this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( requestOptions , url ) ;
8128+ requestOptions = auth_JWTHttpHeaderAuthentication . requestOptions ;
8129+ url = auth_JWTHttpHeaderAuthentication . url ;
8130+
8131+ const auth_OAuth2 = await this . authentications . OAuth2 . applyToRequest ( requestOptions , url ) ;
8132+ requestOptions = auth_OAuth2 . requestOptions ;
8133+ url = auth_OAuth2 . url ;
8134+
8135+ const authDefault = await this . authentications . default . applyToRequest ( requestOptions , url ) ;
8136+ requestOptions = authDefault . requestOptions ;
8137+ url = authDefault . url ;
8138+
8139+ if ( localVarFormParams ) {
8140+ delete requestOptions . headers [ 'Content-Type' ] ;
8141+ if ( localVarFormParams instanceof FormData ) {
8142+ // FormData: fetch will handle Content-Type automatically.
8143+ requestOptions . body = localVarFormParams ;
8144+ }
8145+ else if ( Object . keys ( localVarFormParams ) . length > 0 ) {
8146+ // URL-encoded form
8147+ requestOptions . body = new URLSearchParams ( localVarFormParams as Record < string , string > ) . toString ( ) ;
8148+ requestOptions . headers [ 'Content-Type' ] = 'application/x-www-form-urlencoded' ;
8149+ }
8150+ }
8151+
8152+ const response = await fetch ( url , requestOptions ) ;
8153+ return this . handleResponse (
8154+ response ,
8155+ 'GenericApiResponse | StartJobResponse'
8156+ ) ;
8157+ }
8158+
8159+ /**
8160+ * Returns a preview of how the project\'s dataset would be balanced if the current stratification options were applied. For each group (composite of label and/or metadata keys), shows the number and percentage of samples that would be assigned to each split (\"training\"/\"testing\"). This does not update the dataset, only provides a summary. Returns immediately on small datasets, or starts a job on larger datasets.
8161+ * @summary Stratify dataset preview
8162+ * @param projectId Project ID
8163+ * @param datasetStratificationOptions
8164+ */
8165+ public async stratifyDatasetPreview ( projectId : number , datasetStratificationOptions : DatasetStratificationOptions , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < DatasetStratificationPreviewResponse | StartJobResponse > {
8166+ const localVarPath = this . basePath + '/api/{projectId}/stratify-preview'
8167+ . replace ( '{' + 'projectId' + '}' , encodeURIComponent ( String ( projectId ) ) ) ;
8168+ let localVarQueryParameters : Record < string , string > = { } ;
8169+ let localVarHeaderParams : Record < string , string > = {
8170+ 'User-Agent' : 'edgeimpulse-api nodejs' ,
8171+ 'Content-Type' : 'application/json' ,
8172+ ...this . defaultHeaders ,
8173+ } ;
8174+ const produces = [ 'application/json' ] ;
8175+ // give precedence to 'application/json'
8176+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
8177+ localVarHeaderParams . Accept = 'application/json' ;
8178+ } else {
8179+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
8180+ }
8181+ let localVarFormParams : Record < string , string > | FormData | UndiciFormData | undefined ;
8182+
8183+ // verify required parameter 'projectId' is not null or undefined
8184+
8185+
8186+ if ( projectId === null || projectId === undefined ) {
8187+ throw new Error ( 'Required parameter projectId was null or undefined when calling stratifyDatasetPreview.' ) ;
8188+ }
8189+
8190+ // verify required parameter 'datasetStratificationOptions' is not null or undefined
8191+
8192+
8193+ if ( datasetStratificationOptions === null || datasetStratificationOptions === undefined ) {
8194+ throw new Error ( 'Required parameter datasetStratificationOptions was null or undefined when calling stratifyDatasetPreview.' ) ;
8195+ }
8196+
8197+ localVarHeaderParams = {
8198+ ...localVarHeaderParams ,
8199+ ...options . headers ,
8200+ ...this . opts . extraHeaders ,
8201+ } ;
8202+
8203+ const queryString = Object . entries ( localVarQueryParameters )
8204+ . filter ( ( [ , value ] ) => value !== undefined )
8205+ . map ( ( [ key , value ] ) => `${ key } =${ encodeURIComponent ( String ( value ) ) } ` )
8206+ . join ( '&' ) ;
8207+
8208+ let localVarUrl = localVarPath + ( queryString ? `?${ queryString } ` : '' ) ;
8209+ let localVarRequestOptions : RequestOptionsType = {
8210+ method : 'POST' ,
8211+ headers : { ...localVarHeaderParams } ,
8212+ } ;
8213+
8214+ localVarRequestOptions . body = JSON . stringify ( ObjectSerializer . serialize ( datasetStratificationOptions , "DatasetStratificationOptions" ) ) ;
8215+
8216+
8217+ let requestOptions = localVarRequestOptions ;
8218+ let url = localVarUrl ;
8219+ const auth_ApiKeyAuthentication = await this . authentications . ApiKeyAuthentication . applyToRequest ( requestOptions , url ) ;
8220+ requestOptions = auth_ApiKeyAuthentication . requestOptions ;
8221+ url = auth_ApiKeyAuthentication . url ;
8222+
8223+ const auth_JWTAuthentication = await this . authentications . JWTAuthentication . applyToRequest ( requestOptions , url ) ;
8224+ requestOptions = auth_JWTAuthentication . requestOptions ;
8225+ url = auth_JWTAuthentication . url ;
8226+
8227+ const auth_JWTHttpHeaderAuthentication = await this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( requestOptions , url ) ;
8228+ requestOptions = auth_JWTHttpHeaderAuthentication . requestOptions ;
8229+ url = auth_JWTHttpHeaderAuthentication . url ;
8230+
8231+ const auth_OAuth2 = await this . authentications . OAuth2 . applyToRequest ( requestOptions , url ) ;
8232+ requestOptions = auth_OAuth2 . requestOptions ;
8233+ url = auth_OAuth2 . url ;
8234+
8235+ const authDefault = await this . authentications . default . applyToRequest ( requestOptions , url ) ;
8236+ requestOptions = authDefault . requestOptions ;
8237+ url = authDefault . url ;
8238+
8239+ if ( localVarFormParams ) {
8240+ delete requestOptions . headers [ 'Content-Type' ] ;
8241+ if ( localVarFormParams instanceof FormData ) {
8242+ // FormData: fetch will handle Content-Type automatically.
8243+ requestOptions . body = localVarFormParams ;
8244+ }
8245+ else if ( Object . keys ( localVarFormParams ) . length > 0 ) {
8246+ // URL-encoded form
8247+ requestOptions . body = new URLSearchParams ( localVarFormParams as Record < string , string > ) . toString ( ) ;
8248+ requestOptions . headers [ 'Content-Type' ] = 'application/x-www-form-urlencoded' ;
8249+ }
8250+ }
8251+
8252+ const response = await fetch ( url , requestOptions ) ;
8253+ return this . handleResponse (
8254+ response ,
8255+ 'DatasetStratificationPreviewResponse | StartJobResponse'
8256+ ) ;
8257+ }
8258+
79668259 /**
79678260 * Track objects between two samples. Source sample should have bounding boxes set.
79688261 * @summary Track objects
0 commit comments