@dronedeploy/rocos-js-sdk 3.0.1-alpha.31 → 3.0.1-alpha.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -138,5 +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";
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_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,5 +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';
149
+ exports.API_ASSETS_URL = 'https://{url}/projects/{projectId}/assets';
@@ -1,12 +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
- name?: string;
5
+ assetID?: string;
6
+ type?: 'asset' | 'target';
6
7
  data?: Record<string, string>;
7
8
  geometry?: Position[];
8
9
  center?: Position;
9
10
  }
11
+ export interface Observation extends ObservationBase {
12
+ id: string;
13
+ }
14
+ export interface CreateObservation extends ObservationBase {
15
+ }
10
16
  export interface Panorama {
11
17
  transform: {
12
18
  parent: string;
@@ -18,3 +24,4 @@ export interface Panorama {
18
24
  path: string;
19
25
  };
20
26
  }
27
+ export {};
@@ -1,43 +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
  }
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
+ }
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,13 +1,16 @@
1
- import { 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
5
5
  */
6
6
  export declare class TargetService extends BaseServiceAbstract implements IBaseService {
7
+ list: (projectId: string, frameID?: string) => Promise<Target[]>;
7
8
  constructor(config: IRocosSDKConfig);
8
9
  getStatus(): boolean;
9
10
  protected getError(e: Error): RocosError;
10
- list(projectId: string, frameID?: string): Promise<Target[]>;
11
- getMedia(projectId: string, targetId: string): Promise<Target>;
11
+ createTargets(projectId: string, targets: CreateTarget[]): Promise<void>;
12
+ listTargets(projectId: string, frameID?: string): Promise<Target[]>;
13
+ createAssets(projectId: string, assets: CreateAsset[]): Promise<void>;
14
+ listAssets(projectId: string, frameID?: string): Promise<Asset[]>;
12
15
  addMedia(projectId: string, targetId: string, media: TargetMedia): Promise<void>;
13
16
  }
@@ -13,6 +13,7 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
13
13
  constructor(config) {
14
14
  super(config);
15
15
  this.logger = RocosLogger_1.RocosLogger.getInstance(`TargetService(${this.config.url})`);
16
+ this.list = this.listTargets;
16
17
  }
17
18
  getStatus() {
18
19
  return true;
@@ -20,19 +21,30 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
20
21
  getError(e) {
21
22
  return new models_1.RocosError(e, models_1.errorCodes.TARGET_SERVICE_ERROR);
22
23
  }
23
- async list(projectId, frameID = 'seed') {
24
+ async createTargets(projectId, targets) {
25
+ await 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 assets');
29
+ }
30
+ async listTargets(projectId, frameID = 'seed') {
24
31
  const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGETS_URL, {
25
32
  url: this.config.url,
26
33
  projectId,
27
34
  }, this.config.insecure), 'Failed to list targets', { frameID });
28
35
  return resp;
29
36
  }
30
- async getMedia(projectId, targetId) {
31
- const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_TARGETs_MEDIA_URL, {
37
+ async createAssets(projectId, assets) {
38
+ await this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_UPLOAD_URL, {
32
39
  url: this.config.url,
33
40
  projectId,
34
- targetId,
35
- }, this.config.insecure), 'Failed to get target media');
41
+ }, this.config.insecure), assets, 'Failed to upload assets');
42
+ }
43
+ async listAssets(projectId, frameID = 'seed') {
44
+ const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_ASSETS_URL, {
45
+ url: this.config.url,
46
+ projectId,
47
+ }, this.config.insecure), 'Failed to list assets', { frameID });
36
48
  return resp;
37
49
  }
38
50
  async addMedia(projectId, targetId, media) {
@@ -138,5 +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";
144
+ export declare const API_ASSETS_URL = "https://{url}/projects/{projectId}/assets";
@@ -138,5 +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';
144
+ export const API_ASSETS_URL = 'https://{url}/projects/{projectId}/assets';
@@ -1,12 +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
- name?: string;
5
+ assetID?: string;
6
+ type?: 'asset' | 'target';
6
7
  data?: Record<string, string>;
7
8
  geometry?: Position[];
8
9
  center?: Position;
9
10
  }
11
+ export interface Observation extends ObservationBase {
12
+ id: string;
13
+ }
14
+ export interface CreateObservation extends ObservationBase {
15
+ }
10
16
  export interface Panorama {
11
17
  transform: {
12
18
  parent: string;
@@ -18,3 +24,4 @@ export interface Panorama {
18
24
  path: string;
19
25
  };
20
26
  }
27
+ export {};
@@ -1,43 +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
  }
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
+ }
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,13 +1,16 @@
1
- import { 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
5
5
  */
6
6
  export declare class TargetService extends BaseServiceAbstract implements IBaseService {
7
+ list: (projectId: string, frameID?: string) => Promise<Target[]>;
7
8
  constructor(config: IRocosSDKConfig);
8
9
  getStatus(): boolean;
9
10
  protected getError(e: Error): RocosError;
10
- list(projectId: string, frameID?: string): Promise<Target[]>;
11
- getMedia(projectId: string, targetId: string): Promise<Target>;
11
+ createTargets(projectId: string, targets: CreateTarget[]): Promise<void>;
12
+ listTargets(projectId: string, frameID?: string): Promise<Target[]>;
13
+ createAssets(projectId: string, assets: CreateAsset[]): Promise<void>;
14
+ listAssets(projectId: string, frameID?: string): Promise<Asset[]>;
12
15
  addMedia(projectId: string, targetId: string, media: TargetMedia): Promise<void>;
13
16
  }
@@ -1,5 +1,5 @@
1
- import { 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';
@@ -10,6 +10,7 @@ export class TargetService extends BaseServiceAbstract {
10
10
  constructor(config) {
11
11
  super(config);
12
12
  this.logger = RocosLogger.getInstance(`TargetService(${this.config.url})`);
13
+ this.list = this.listTargets;
13
14
  }
14
15
  getStatus() {
15
16
  return true;
@@ -17,19 +18,30 @@ export class TargetService extends BaseServiceAbstract {
17
18
  getError(e) {
18
19
  return new RocosError(e, errorCodes.TARGET_SERVICE_ERROR);
19
20
  }
20
- async list(projectId, frameID = 'seed') {
21
+ async createTargets(projectId, targets) {
22
+ await this.callPut(formatServiceUrl(API_TARGET_UPLOAD_URL, {
23
+ url: this.config.url,
24
+ projectId,
25
+ }, this.config.insecure), targets, 'Failed to upload assets');
26
+ }
27
+ async listTargets(projectId, frameID = 'seed') {
21
28
  const resp = await this.callGet(formatServiceUrl(API_TARGETS_URL, {
22
29
  url: this.config.url,
23
30
  projectId,
24
31
  }, this.config.insecure), 'Failed to list targets', { frameID });
25
32
  return resp;
26
33
  }
27
- async getMedia(projectId, targetId) {
28
- const resp = await this.callGet(formatServiceUrl(API_TARGETs_MEDIA_URL, {
34
+ async createAssets(projectId, assets) {
35
+ await this.callPut(formatServiceUrl(API_ASSETS_UPLOAD_URL, {
29
36
  url: this.config.url,
30
37
  projectId,
31
- targetId,
32
- }, this.config.insecure), 'Failed to get target media');
38
+ }, this.config.insecure), assets, 'Failed to upload assets');
39
+ }
40
+ async listAssets(projectId, frameID = 'seed') {
41
+ const resp = await this.callGet(formatServiceUrl(API_ASSETS_URL, {
42
+ url: this.config.url,
43
+ projectId,
44
+ }, this.config.insecure), 'Failed to list assets', { frameID });
33
45
  return resp;
34
46
  }
35
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.31",
3
+ "version": "3.0.1-alpha.33",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",