@dronedeploy/rocos-js-sdk 3.0.1-alpha.32 → 3.0.1-alpha.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -138,6 +138,7 @@ export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects
138
138
  export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
139
139
  export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
140
140
  export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
141
+ export declare const API_TARGET_UPLOAD_URL = "https://{url}/projects/{projectId}/targets/upload";
141
142
  export declare const API_TARGETS_URL = "https://{url}/projects/{projectId}/targets";
142
- export declare const API_TARGETs_MEDIA_URL = "https://{url}/projects/{projectId}/targets/{targetId}/media";
143
+ export declare const API_ASSETS_UPLOAD_URL = "https://{url}/projects/{projectId}/assets/upload";
143
144
  export declare const API_ASSETS_URL = "https://{url}/projects/{projectId}/assets";
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = exports.API_PROJECT_ROBOT_ID_URL = exports.API_PROJECT_ROBOT_URL = exports.API_PROJECT_MAPPED_ASSET_PATH_URL = exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = exports.API_PROJECT_MISSION_ASSET_PATH_URL = exports.API_PROJECT_MISSION_ASSETS_PATH_URL = exports.API_PROJECT_FLOW_ASSET_PATH_URL = exports.API_PROJECT_ROBOT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATIONS_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL = exports.API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_URL = exports.API_PROJECT_USERS_URL = exports.API_PROJECT_ID_URL = exports.API_PROJECT_URL = exports.API_ACCOUNT_EXTERNAL_PROJECTS_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_ID_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_URL = exports.API_ACCOUNT_PROJECT_USER_ID_URL = exports.API_ACCOUNT_PROJECT_USER_URL = exports.API_ACCOUNT_PROJECT_ID_URL = exports.API_ACCOUNT_PROJECT_URL = exports.API_SERVER_TIME_URL = exports.API_ACCOUNT_INTEGRATION_TYPE_URL = exports.API_ACCOUNT_INTEGRATION_URL = exports.API_ACCOUNT_SETTINGS_URL = exports.API_AUTH_USER_ACCOUNT_USER_ID_URL = exports.API_AUTH_USER_ACCOUNT_USER_URL = exports.API_ACCOUNT_ACTIVATE_URL = exports.API_ACCOUNT_ID_URL = exports.API_ACCOUNT_URL = exports.API_USER_PAT_TOKEN_URL = exports.API_USER_PAT_URL = exports.API_USER_VERIFY_EMAIL_URL = exports.API_USER_INVITATION_CHECK_URL = exports.API_USER_INVITATION_ACCEPT_URL = exports.API_USER_INVITATION_URL = exports.API_USER_PASSWORD_FORGOT_URL = exports.API_USER_PASSWORD_RESET_URL = exports.API_OTP_AUTH_URL = exports.API_OTP_URL = exports.API_USER_TOKEN_URL = exports.API_USER_AUTH_URL = exports.API_USER_URL = exports.API_ADMIN_USER_INVITATION_URL = exports.API_APPLICATION_AUTH_URL = void 0;
4
4
  exports.API_PROJECT_STREAM_ID_URL = exports.API_PROJECT_STREAM_URL = exports.API_PROJECT_EXPORT_URL = exports.API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = exports.API_PROJECT_GROUP_TYPE_OWNER_ID_URL = exports.API_PROJECT_GROUP_TYPE_VERSION_URL = exports.API_PROJECT_GROUP_TYPE_CONFIG_URL = exports.API_PROJECT_GROUP_TYPE_PUBLISH_URL = exports.API_PROJECT_GROUP_TYPE_ID_URL = exports.API_PROJECT_GROUP_TYPE_URL = exports.API_PROJECT_DEFINITION_IMPORT = exports.API_PROJECT_DEFINITION_EXPORT = exports.API_PROJECT_DEFINITION_GAMEPAD_URL = exports.API_PROJECT_DEFINITION_TRIGGER_URL = exports.API_PROJECT_DEFINITION_BUTTON_URL = exports.API_PROJECT_DEFINITION_ACTION_URL = exports.API_PROJECT_DEFINITION_EVENT_URL = exports.API_PROJECT_DEFINITION_COMMAND2_URL = exports.API_PROJECT_DEFINITION_COMMAND_URL = exports.API_PROJECT_DEFINITION_AGENT_URL = exports.API_PROJECT_DEFINITION_SETTING_URL = exports.API_PROJECT_DEFINITION_BLOB_URL = exports.API_PROJECT_DEFINITION_DASHBOARD_URL = exports.API_PROJECT_DEFINITION_COPY_URL = exports.API_PROJECT_DEFINITION_STREAM_URL = exports.API_PROJECT_DEFINITION_ID_URL = exports.API_PROJECT_DEFINITION_URL = exports.API_PROJECT_VROBOT_DEPLOY_URL = exports.API_PROJECT_VROBOT_DETAILS_URL = exports.API_PROJECT_COLLECTION_DOCS_URL = exports.API_PROJECT_COLLECTION_ID_URL = exports.API_PROJECT_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_DASHBOARD_WIDGET_URL = exports.API_PROJECT_DASHBOARD_ID_URL = exports.API_PROJECT_DASHBOARD_URL = exports.API_PROJECT_OPERATION_ID_URL = exports.API_PROJECT_OPERATION_URL = exports.API_PROJECT_ROBOT_CONFIGS_CONNECTION_URL = exports.API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_URL = exports.API_PROJECT_ROBOT_GAMEPAD_URL = exports.API_PROJECT_ROBOT_TRIGGER_URL = exports.API_PROJECT_ROBOT_BUTTON_URL = exports.API_PROJECT_ROBOT_COMMAND2_URL = exports.API_PROJECT_ROBOT_COMMAND_URL = exports.API_PROJECT_ROBOT_AGENT_URL = exports.API_PROJECT_ROBOT_SETTING_URL = exports.API_PROJECT_ROBOT_EVENT_HISTORY_URL = exports.API_PROJECT_ROBOT_EVENT_URL = exports.API_PROJECT_ROBOT_REGISTER_URL = exports.API_PROJECT_ROBOT_DEFINITION_URL = void 0;
5
- exports.API_ASSETS_URL = exports.API_TARGETs_MEDIA_URL = exports.API_TARGETS_URL = exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_OBSERVATION_KEYS_URL = exports.API_OBSERVATIONS_URL = exports.API_MAPS_PANORAMA_OBSERVATIONS_URL = exports.API_MAPS_GEOJSON_URL = exports.API_MAPS_DEPLOY_URL = exports.API_MAPS_COPY_URL = exports.API_MAP_ID_URL = exports.API_MAPS_MERGE_URL = exports.API_MAPS_DEPLOYED_URL = exports.API_MAPS_URL = exports.API_DD_INTEGRATION_LOCATIONS_URL = exports.API_DD_INTEGRATION_ISSUES_URL = exports.API_DD_INTEGRATION_OVERLAYS_URL = exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = exports.API_DD_INTEGRATION_PLANS_URL = exports.API_SPOTTY_URL = exports.API_PROJECT_SCHEDULES_URL = exports.API_SOURCE_ID_URL = exports.API_SOURCE_URL = exports.API_SOURCE_SCHEMA_URL = exports.API_TEMPLATE_EXPORTER_URL = exports.API_TEMPLATE_PROVISION_ID_URL = exports.API_TEMPLATE_PROVISION_URL = exports.API_TEMPLATE_DEPLOY_URL = exports.API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_PROFILE_DASHBOARD_ID_URL = exports.API_PROJECT_PROFILE_DASHBOARD_URL = exports.API_PROJECT_CALLSIGN_STREAM_URL = exports.API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_URL = exports.API_PROJECT_STREAM_CALLSIGN_URL = exports.API_PROJECT_STREAM_DATA_URL = void 0;
5
+ exports.API_ASSETS_URL = exports.API_ASSETS_UPLOAD_URL = exports.API_TARGETS_URL = exports.API_TARGET_UPLOAD_URL = exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_OBSERVATION_KEYS_URL = exports.API_OBSERVATIONS_URL = exports.API_MAPS_PANORAMA_OBSERVATIONS_URL = exports.API_MAPS_GEOJSON_URL = exports.API_MAPS_DEPLOY_URL = exports.API_MAPS_COPY_URL = exports.API_MAP_ID_URL = exports.API_MAPS_MERGE_URL = exports.API_MAPS_DEPLOYED_URL = exports.API_MAPS_URL = exports.API_DD_INTEGRATION_LOCATIONS_URL = exports.API_DD_INTEGRATION_ISSUES_URL = exports.API_DD_INTEGRATION_OVERLAYS_URL = exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = exports.API_DD_INTEGRATION_PLANS_URL = exports.API_SPOTTY_URL = exports.API_PROJECT_SCHEDULES_URL = exports.API_SOURCE_ID_URL = exports.API_SOURCE_URL = exports.API_SOURCE_SCHEMA_URL = exports.API_TEMPLATE_EXPORTER_URL = exports.API_TEMPLATE_PROVISION_ID_URL = exports.API_TEMPLATE_PROVISION_URL = exports.API_TEMPLATE_DEPLOY_URL = exports.API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_PROFILE_DASHBOARD_ID_URL = exports.API_PROJECT_PROFILE_DASHBOARD_URL = exports.API_PROJECT_CALLSIGN_STREAM_URL = exports.API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_URL = exports.API_PROJECT_STREAM_CALLSIGN_URL = exports.API_PROJECT_STREAM_DATA_URL = void 0;
6
6
  exports.API_APPLICATION_AUTH_URL = 'https://{url}/applications/auth';
7
7
  exports.API_ADMIN_USER_INVITATION_URL = 'https://{url}/admin/users/invitations';
8
8
  exports.API_USER_URL = 'https://{url}/users';
@@ -143,6 +143,7 @@ exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/
143
143
  exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
144
144
  exports.API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
145
145
  exports.API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
146
+ exports.API_TARGET_UPLOAD_URL = 'https://{url}/projects/{projectId}/targets/upload';
146
147
  exports.API_TARGETS_URL = 'https://{url}/projects/{projectId}/targets';
147
- exports.API_TARGETs_MEDIA_URL = 'https://{url}/projects/{projectId}/targets/{targetId}/media';
148
+ exports.API_ASSETS_UPLOAD_URL = 'https://{url}/projects/{projectId}/assets/upload';
148
149
  exports.API_ASSETS_URL = 'https://{url}/projects/{projectId}/assets';
@@ -1,13 +1,18 @@
1
1
  import { Position, Quaternion, Vector3 } from '../graph';
2
- export interface Observation {
2
+ interface ObservationBase {
3
+ name: string;
3
4
  panoramaID: string;
4
- id?: string;
5
+ assetID?: string;
5
6
  type?: 'asset' | 'target';
6
- name?: string;
7
7
  data?: Record<string, string>;
8
8
  geometry?: Position[];
9
9
  center?: Position;
10
10
  }
11
+ export interface Observation extends ObservationBase {
12
+ id: string;
13
+ }
14
+ export interface CreateObservation extends ObservationBase {
15
+ }
11
16
  export interface Panorama {
12
17
  transform: {
13
18
  parent: string;
@@ -19,3 +24,4 @@ export interface Panorama {
19
24
  path: string;
20
25
  };
21
26
  }
27
+ export {};
@@ -1,47 +1,32 @@
1
1
  import { Quaternion } from '../graph/Quaternion';
2
2
  import { Vector3 } from '../graph/Vector3';
3
- /**
4
- * Observation target model (such as an asset, a point of interest, a puddle, etc.)
5
- */
6
- export interface Target {
7
- /**
8
- * Unique identifier of the target
9
- */
3
+ export interface TargetBase {
10
4
  id: string;
11
- /**
12
- * Name of the target
13
- */
14
5
  name: string;
15
- /**
16
- * Metadata associated with the target (key-value pairs) such as name, type, asset-id, etc.
17
- */
18
- data: Record<string, string>;
19
- /**
20
- * Translation of the target in the 3D space
21
- */
22
- translation: Vector3;
23
- /**
24
- * Rotation of the target in the 3D space
25
- */
26
- rotation: Quaternion;
27
- /**
28
- * Position of the target in WGS84 coordinates
29
- */
30
- position: {
31
- lat: number;
32
- lon: number;
33
- alt: number;
34
- };
6
+ }
7
+ export interface Target extends TargetBase {
8
+ data?: Record<string, string>;
9
+ translation?: Vector3;
10
+ rotation?: Quaternion;
11
+ media?: TargetMedia[];
35
12
  /**
36
13
  * Media associated with the target (images)
37
14
  */
38
- media?: TargetMedia[];
15
+ frame?: string;
39
16
  }
40
17
  export interface TargetMedia {
41
18
  id: string;
42
19
  data: Record<string, string>;
43
20
  }
44
- /**
45
- * Observation asset model
46
- */
21
+ export interface CreateTargetPositionWgs84 {
22
+ lat: number;
23
+ lon: number;
24
+ alt?: number;
25
+ }
26
+ export interface CreateTarget extends TargetBase {
27
+ data?: Record<string, string>;
28
+ position?: CreateTargetPositionWgs84 | Vector3;
29
+ frame?: string;
30
+ }
47
31
  export type Asset = Target;
32
+ export type CreateAsset = CreateTarget;
@@ -1,6 +1,6 @@
1
+ import { CreateObservation, Observation } from '../models/maps/Panorama';
1
2
  import { IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
2
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
- import { Observation } from '../models/maps/Panorama';
4
4
  /**
5
5
  * Maps service for managing robot maps in the cloud and on robots
6
6
  */
@@ -122,7 +122,7 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
122
122
  * @param observations An array of Observation objects to create.
123
123
  * @returns A Promise that resolves when the observations have been created.
124
124
  */
125
- createObservations(projectId: string, panoramaId: string, observations: Observation[]): Promise<void>;
125
+ createObservations(projectId: string, panoramaId: string, observations: CreateObservation[]): Promise<void>;
126
126
  /**
127
127
  * Gets observations for a project.
128
128
  *
@@ -1,4 +1,4 @@
1
- import { Asset, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
1
+ import { Asset, CreateAsset, CreateTarget, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
2
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
3
  /**
4
4
  * Service for managing targets (such as assets, PoI's, or FLOCS) on DroneDeploy
@@ -8,8 +8,9 @@ export declare class TargetService extends BaseServiceAbstract implements IBaseS
8
8
  constructor(config: IRocosSDKConfig);
9
9
  getStatus(): boolean;
10
10
  protected getError(e: Error): RocosError;
11
+ createTargets(projectId: string, targets: CreateTarget[]): Promise<void>;
11
12
  listTargets(projectId: string, frameID?: string): Promise<Target[]>;
13
+ createAssets(projectId: string, assets: CreateAsset[]): Promise<void>;
12
14
  listAssets(projectId: string, frameID?: string): Promise<Asset[]>;
13
- getMedia(projectId: string, targetId: string): Promise<Target>;
14
15
  addMedia(projectId: string, targetId: string, media: TargetMedia): Promise<void>;
15
16
  }
@@ -21,6 +21,12 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
21
21
  getError(e) {
22
22
  return new models_1.RocosError(e, models_1.errorCodes.TARGET_SERVICE_ERROR);
23
23
  }
24
+ async createTargets(projectId, targets) {
25
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGET_UPLOAD_URL, {
26
+ url: this.config.url,
27
+ projectId,
28
+ }, this.config.insecure), targets, `Failed to upload targets for ${projectId}`);
29
+ }
24
30
  async listTargets(projectId, frameID = 'seed') {
25
31
  const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGETS_URL, {
26
32
  url: this.config.url,
@@ -28,19 +34,17 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
28
34
  }, this.config.insecure), 'Failed to list targets', { frameID });
29
35
  return resp;
30
36
  }
31
- async listAssets(projectId, frameID = 'seed') {
32
- const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_URL, {
37
+ async createAssets(projectId, assets) {
38
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_UPLOAD_URL, {
33
39
  url: this.config.url,
34
40
  projectId,
35
- }, this.config.insecure), 'Failed to list assets', { frameID });
36
- return resp;
41
+ }, this.config.insecure), assets, `Failed to upload assets for ${projectId}`);
37
42
  }
38
- async getMedia(projectId, targetId) {
39
- const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGETs_MEDIA_URL, {
43
+ async listAssets(projectId, frameID = 'seed') {
44
+ const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_URL, {
40
45
  url: this.config.url,
41
46
  projectId,
42
- targetId,
43
- }, this.config.insecure), 'Failed to get target media');
47
+ }, this.config.insecure), 'Failed to list assets', { frameID });
44
48
  return resp;
45
49
  }
46
50
  async addMedia(projectId, targetId, media) {
@@ -138,6 +138,7 @@ export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects
138
138
  export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
139
139
  export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
140
140
  export declare const API_DEVICE_CREDENTIALS_AUTH_URL = "https://{url}/device-credentials/auth";
141
+ export declare const API_TARGET_UPLOAD_URL = "https://{url}/projects/{projectId}/targets/upload";
141
142
  export declare const API_TARGETS_URL = "https://{url}/projects/{projectId}/targets";
142
- export declare const API_TARGETs_MEDIA_URL = "https://{url}/projects/{projectId}/targets/{targetId}/media";
143
+ export declare const API_ASSETS_UPLOAD_URL = "https://{url}/projects/{projectId}/assets/upload";
143
144
  export declare const API_ASSETS_URL = "https://{url}/projects/{projectId}/assets";
@@ -138,6 +138,7 @@ export const API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projec
138
138
  export const API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
139
139
  export const API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
140
140
  export const API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
141
+ export const API_TARGET_UPLOAD_URL = 'https://{url}/projects/{projectId}/targets/upload';
141
142
  export const API_TARGETS_URL = 'https://{url}/projects/{projectId}/targets';
142
- export const API_TARGETs_MEDIA_URL = 'https://{url}/projects/{projectId}/targets/{targetId}/media';
143
+ export const API_ASSETS_UPLOAD_URL = 'https://{url}/projects/{projectId}/assets/upload';
143
144
  export const API_ASSETS_URL = 'https://{url}/projects/{projectId}/assets';
@@ -1,13 +1,18 @@
1
1
  import { Position, Quaternion, Vector3 } from '../graph';
2
- export interface Observation {
2
+ interface ObservationBase {
3
+ name: string;
3
4
  panoramaID: string;
4
- id?: string;
5
+ assetID?: string;
5
6
  type?: 'asset' | 'target';
6
- name?: string;
7
7
  data?: Record<string, string>;
8
8
  geometry?: Position[];
9
9
  center?: Position;
10
10
  }
11
+ export interface Observation extends ObservationBase {
12
+ id: string;
13
+ }
14
+ export interface CreateObservation extends ObservationBase {
15
+ }
11
16
  export interface Panorama {
12
17
  transform: {
13
18
  parent: string;
@@ -19,3 +24,4 @@ export interface Panorama {
19
24
  path: string;
20
25
  };
21
26
  }
27
+ export {};
@@ -1,47 +1,32 @@
1
1
  import { Quaternion } from '../graph/Quaternion';
2
2
  import { Vector3 } from '../graph/Vector3';
3
- /**
4
- * Observation target model (such as an asset, a point of interest, a puddle, etc.)
5
- */
6
- export interface Target {
7
- /**
8
- * Unique identifier of the target
9
- */
3
+ export interface TargetBase {
10
4
  id: string;
11
- /**
12
- * Name of the target
13
- */
14
5
  name: string;
15
- /**
16
- * Metadata associated with the target (key-value pairs) such as name, type, asset-id, etc.
17
- */
18
- data: Record<string, string>;
19
- /**
20
- * Translation of the target in the 3D space
21
- */
22
- translation: Vector3;
23
- /**
24
- * Rotation of the target in the 3D space
25
- */
26
- rotation: Quaternion;
27
- /**
28
- * Position of the target in WGS84 coordinates
29
- */
30
- position: {
31
- lat: number;
32
- lon: number;
33
- alt: number;
34
- };
6
+ }
7
+ export interface Target extends TargetBase {
8
+ data?: Record<string, string>;
9
+ translation?: Vector3;
10
+ rotation?: Quaternion;
11
+ media?: TargetMedia[];
35
12
  /**
36
13
  * Media associated with the target (images)
37
14
  */
38
- media?: TargetMedia[];
15
+ frame?: string;
39
16
  }
40
17
  export interface TargetMedia {
41
18
  id: string;
42
19
  data: Record<string, string>;
43
20
  }
44
- /**
45
- * Observation asset model
46
- */
21
+ export interface CreateTargetPositionWgs84 {
22
+ lat: number;
23
+ lon: number;
24
+ alt?: number;
25
+ }
26
+ export interface CreateTarget extends TargetBase {
27
+ data?: Record<string, string>;
28
+ position?: CreateTargetPositionWgs84 | Vector3;
29
+ frame?: string;
30
+ }
47
31
  export type Asset = Target;
32
+ export type CreateAsset = CreateTarget;
@@ -1,6 +1,6 @@
1
+ import { CreateObservation, Observation } from '../models/maps/Panorama';
1
2
  import { IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
2
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
- import { Observation } from '../models/maps/Panorama';
4
4
  /**
5
5
  * Maps service for managing robot maps in the cloud and on robots
6
6
  */
@@ -122,7 +122,7 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
122
122
  * @param observations An array of Observation objects to create.
123
123
  * @returns A Promise that resolves when the observations have been created.
124
124
  */
125
- createObservations(projectId: string, panoramaId: string, observations: Observation[]): Promise<void>;
125
+ createObservations(projectId: string, panoramaId: string, observations: CreateObservation[]): Promise<void>;
126
126
  /**
127
127
  * Gets observations for a project.
128
128
  *
@@ -1,4 +1,4 @@
1
- import { Asset, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
1
+ import { Asset, CreateAsset, CreateTarget, IBaseService, IRocosSDKConfig, RocosError, Target, TargetMedia } from '../models';
2
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
3
3
  /**
4
4
  * Service for managing targets (such as assets, PoI's, or FLOCS) on DroneDeploy
@@ -8,8 +8,9 @@ export declare class TargetService extends BaseServiceAbstract implements IBaseS
8
8
  constructor(config: IRocosSDKConfig);
9
9
  getStatus(): boolean;
10
10
  protected getError(e: Error): RocosError;
11
+ createTargets(projectId: string, targets: CreateTarget[]): Promise<void>;
11
12
  listTargets(projectId: string, frameID?: string): Promise<Target[]>;
13
+ createAssets(projectId: string, assets: CreateAsset[]): Promise<void>;
12
14
  listAssets(projectId: string, frameID?: string): Promise<Asset[]>;
13
- getMedia(projectId: string, targetId: string): Promise<Target>;
14
15
  addMedia(projectId: string, targetId: string, media: TargetMedia): Promise<void>;
15
16
  }
@@ -1,5 +1,5 @@
1
- import { API_ASSETS_URL, API_TARGETS_URL, API_TARGETs_MEDIA_URL } from '../constants/api';
2
- import { RocosError, errorCodes } from '../models';
1
+ import { API_ASSETS_UPLOAD_URL, API_ASSETS_URL, API_TARGETS_URL, API_TARGET_UPLOAD_URL } from '../constants/api';
2
+ import { RocosError, errorCodes, } from '../models';
3
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
4
4
  import { RocosLogger } from '../logger/RocosLogger';
5
5
  import { formatServiceUrl } from '../helpers/formatServiceUrl';
@@ -18,6 +18,12 @@ export class TargetService extends BaseServiceAbstract {
18
18
  getError(e) {
19
19
  return new RocosError(e, errorCodes.TARGET_SERVICE_ERROR);
20
20
  }
21
+ async createTargets(projectId, targets) {
22
+ return this.callPut(formatServiceUrl(API_TARGET_UPLOAD_URL, {
23
+ url: this.config.url,
24
+ projectId,
25
+ }, this.config.insecure), targets, `Failed to upload targets for ${projectId}`);
26
+ }
21
27
  async listTargets(projectId, frameID = 'seed') {
22
28
  const resp = await this.callGet(formatServiceUrl(API_TARGETS_URL, {
23
29
  url: this.config.url,
@@ -25,19 +31,17 @@ export class TargetService extends BaseServiceAbstract {
25
31
  }, this.config.insecure), 'Failed to list targets', { frameID });
26
32
  return resp;
27
33
  }
28
- async listAssets(projectId, frameID = 'seed') {
29
- const resp = await this.callGet(formatServiceUrl(API_ASSETS_URL, {
34
+ async createAssets(projectId, assets) {
35
+ return this.callPut(formatServiceUrl(API_ASSETS_UPLOAD_URL, {
30
36
  url: this.config.url,
31
37
  projectId,
32
- }, this.config.insecure), 'Failed to list assets', { frameID });
33
- return resp;
38
+ }, this.config.insecure), assets, `Failed to upload assets for ${projectId}`);
34
39
  }
35
- async getMedia(projectId, targetId) {
36
- const resp = await this.callGet(formatServiceUrl(API_TARGETs_MEDIA_URL, {
40
+ async listAssets(projectId, frameID = 'seed') {
41
+ const resp = await this.callGet(formatServiceUrl(API_ASSETS_URL, {
37
42
  url: this.config.url,
38
43
  projectId,
39
- targetId,
40
- }, this.config.insecure), 'Failed to get target media');
44
+ }, this.config.insecure), 'Failed to list assets', { frameID });
41
45
  return resp;
42
46
  }
43
47
  async addMedia(projectId, targetId, media) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "3.0.1-alpha.32",
3
+ "version": "3.0.1-alpha.34",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",