@dronedeploy/rocos-js-sdk 3.0.1-alpha.36 → 3.0.1-alpha.37
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/constants/api.d.ts +14 -14
- package/cjs/constants/api.js +15 -15
- package/cjs/services/MapService.d.ts +7 -5
- package/cjs/services/MapService.js +26 -18
- package/cjs/services/TargetService.js +5 -5
- package/esm/constants/api.d.ts +14 -14
- package/esm/constants/api.js +14 -14
- package/esm/services/MapService.d.ts +7 -5
- package/esm/services/MapService.js +27 -19
- package/esm/services/TargetService.js +6 -6
- package/package.json +1 -1
package/cjs/constants/api.d.ts
CHANGED
@@ -121,16 +121,20 @@ export declare const API_DD_INTEGRATION_PLAN_BY_ID_URL = "https://{url}/projects
|
|
121
121
|
export declare const API_DD_INTEGRATION_OVERLAYS_URL = "https://{url}/projects/{projectId}/dd/overlays";
|
122
122
|
export declare const API_DD_INTEGRATION_ISSUES_URL = "https://{url}/projects/{projectId}/dd/issues";
|
123
123
|
export declare const API_DD_INTEGRATION_LOCATIONS_URL = "https://{url}/projects/{projectId}/dd/locations";
|
124
|
-
export declare const
|
125
|
-
export declare const
|
126
|
-
export declare const
|
127
|
-
export declare const
|
128
|
-
export declare const
|
129
|
-
export declare const
|
130
|
-
export declare const
|
131
|
-
export declare const
|
132
|
-
export declare const
|
133
|
-
export declare const
|
124
|
+
export declare const API_GRAPHS_MAPS_URL = "https://{url}/graphs/projects/{projectId}/maps";
|
125
|
+
export declare const API_GRAPHS_MAPS_DEPLOYED_URL = "https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}";
|
126
|
+
export declare const API_GRAPHS_MAPS_MERGE_URL = "https://{url}/graphs/projects/{projectId}/maps/merge";
|
127
|
+
export declare const API_GRAPHS_MAP_ID_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}";
|
128
|
+
export declare const API_GRAPHS_MAPS_COPY_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy";
|
129
|
+
export declare const API_GRAPHS_MAPS_DEPLOY_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy";
|
130
|
+
export declare const API_GRAPHS_MAPS_GEOJSON_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson";
|
131
|
+
export declare const API_GRAPHS_PANORAMA_OBSERVATIONS_URL = "https://{url}/graphs/projects/{projectId}/panoramas/{panoramaId}/observations";
|
132
|
+
export declare const API_GRAPHS_OBSERVATIONS_URL = "https://{url}/graphs/projects/{projectId}/observations";
|
133
|
+
export declare const API_GRAPHS_OBSERVATION_KEYS_URL = "https://{url}/graphs/projects/{projectId}/observations/keys";
|
134
|
+
export declare const API_GRAPHS_TARGET_UPLOAD_URL = "https://{url}/graphs/projects/{projectId}/targets/upload";
|
135
|
+
export declare const API_GRAPHS_TARGETS_URL = "https://{url}/graphs/projects/{projectId}/targets";
|
136
|
+
export declare const API_GRAPHS_ASSETS_UPLOAD_URL = "https://{url}/graphs/projects/{projectId}/assets/upload";
|
137
|
+
export declare const API_GRAPHS_ASSETS_URL = "https://{url}/graphs/projects/{projectId}/assets";
|
134
138
|
export declare const API_PROJECT_WORKFLOW_URL = "https://{url}/projects/{projectId}/automate/flows";
|
135
139
|
export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}";
|
136
140
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
@@ -138,7 +142,3 @@ export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects
|
|
138
142
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
139
143
|
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
140
144
|
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";
|
142
|
-
export declare const API_TARGETS_URL = "https://{url}/projects/{projectId}/targets";
|
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";
|
package/cjs/constants/api.js
CHANGED
@@ -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.
|
5
|
+
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_GRAPHS_ASSETS_URL = exports.API_GRAPHS_ASSETS_UPLOAD_URL = exports.API_GRAPHS_TARGETS_URL = exports.API_GRAPHS_TARGET_UPLOAD_URL = exports.API_GRAPHS_OBSERVATION_KEYS_URL = exports.API_GRAPHS_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = exports.API_GRAPHS_MAPS_GEOJSON_URL = exports.API_GRAPHS_MAPS_DEPLOY_URL = exports.API_GRAPHS_MAPS_COPY_URL = exports.API_GRAPHS_MAP_ID_URL = exports.API_GRAPHS_MAPS_MERGE_URL = exports.API_GRAPHS_MAPS_DEPLOYED_URL = exports.API_GRAPHS_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';
|
@@ -126,16 +126,20 @@ exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = 'https://{url}/projects/{projectId}/
|
|
126
126
|
exports.API_DD_INTEGRATION_OVERLAYS_URL = 'https://{url}/projects/{projectId}/dd/overlays';
|
127
127
|
exports.API_DD_INTEGRATION_ISSUES_URL = 'https://{url}/projects/{projectId}/dd/issues';
|
128
128
|
exports.API_DD_INTEGRATION_LOCATIONS_URL = 'https://{url}/projects/{projectId}/dd/locations';
|
129
|
-
exports.
|
130
|
-
exports.
|
131
|
-
exports.
|
132
|
-
exports.
|
133
|
-
exports.
|
134
|
-
exports.
|
135
|
-
exports.
|
136
|
-
exports.
|
137
|
-
exports.
|
138
|
-
exports.
|
129
|
+
exports.API_GRAPHS_MAPS_URL = 'https://{url}/graphs/projects/{projectId}/maps';
|
130
|
+
exports.API_GRAPHS_MAPS_DEPLOYED_URL = 'https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}';
|
131
|
+
exports.API_GRAPHS_MAPS_MERGE_URL = 'https://{url}/graphs/projects/{projectId}/maps/merge';
|
132
|
+
exports.API_GRAPHS_MAP_ID_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}';
|
133
|
+
exports.API_GRAPHS_MAPS_COPY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy';
|
134
|
+
exports.API_GRAPHS_MAPS_DEPLOY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy';
|
135
|
+
exports.API_GRAPHS_MAPS_GEOJSON_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson';
|
136
|
+
exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = 'https://{url}/graphs/projects/{projectId}/panoramas/{panoramaId}/observations';
|
137
|
+
exports.API_GRAPHS_OBSERVATIONS_URL = 'https://{url}/graphs/projects/{projectId}/observations';
|
138
|
+
exports.API_GRAPHS_OBSERVATION_KEYS_URL = 'https://{url}/graphs/projects/{projectId}/observations/keys';
|
139
|
+
exports.API_GRAPHS_TARGET_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/targets/upload';
|
140
|
+
exports.API_GRAPHS_TARGETS_URL = 'https://{url}/graphs/projects/{projectId}/targets';
|
141
|
+
exports.API_GRAPHS_ASSETS_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/assets/upload';
|
142
|
+
exports.API_GRAPHS_ASSETS_URL = 'https://{url}/graphs/projects/{projectId}/assets';
|
139
143
|
exports.API_PROJECT_WORKFLOW_URL = 'https://{url}/projects/{projectId}/automate/flows';
|
140
144
|
exports.API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}';
|
141
145
|
exports.API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
@@ -143,7 +147,3 @@ exports.API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projectId}/
|
|
143
147
|
exports.API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
144
148
|
exports.API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
145
149
|
exports.API_DEVICE_CREDENTIALS_AUTH_URL = 'https://{url}/device-credentials/auth';
|
146
|
-
exports.API_TARGET_UPLOAD_URL = 'https://{url}/projects/{projectId}/targets/upload';
|
147
|
-
exports.API_TARGETS_URL = 'https://{url}/projects/{projectId}/targets';
|
148
|
-
exports.API_ASSETS_UPLOAD_URL = 'https://{url}/projects/{projectId}/assets/upload';
|
149
|
-
exports.API_ASSETS_URL = 'https://{url}/projects/{projectId}/assets';
|
@@ -1,10 +1,12 @@
|
|
1
|
+
import { Asset, IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
|
1
2
|
import { CreateObservation, Observation } from '../models/maps/Panorama';
|
2
|
-
import { IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
/**
|
5
5
|
* Maps service for managing robot maps in the cloud and on robots
|
6
6
|
*/
|
7
7
|
export declare class MapService extends BaseServiceAbstract implements IBaseService {
|
8
|
+
getObservations: (projectId: string, key?: string, frameID?: string) => Promise<Asset[]>;
|
9
|
+
getObservationsKeys: (projectId: string) => Promise<string[]>;
|
8
10
|
constructor(config: IRocosSDKConfig);
|
9
11
|
getStatus(): boolean;
|
10
12
|
protected getError(e: Error): RocosError;
|
@@ -131,12 +133,12 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
|
|
131
133
|
* @param frameID (optional) Transforms on a seed frame
|
132
134
|
* @returns A list of observations
|
133
135
|
*/
|
134
|
-
|
136
|
+
getAssets(projectId: string, key?: string, frameID?: string): Promise<Asset[]>;
|
135
137
|
/**
|
136
|
-
* Lists available keys for all
|
138
|
+
* Lists available keys for all assets in a project.
|
137
139
|
*
|
138
140
|
* @param projectId The ID of the project the observations belongs to.
|
139
|
-
* @returns A list of
|
141
|
+
* @returns A list of assets
|
140
142
|
*/
|
141
|
-
|
143
|
+
getAssetsKeys(projectId: string): Promise<string[]>;
|
142
144
|
}
|
@@ -12,6 +12,14 @@ const formatServiceUrl_1 = require("../helpers/formatServiceUrl");
|
|
12
12
|
class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
13
13
|
constructor(config) {
|
14
14
|
super(config);
|
15
|
+
/*
|
16
|
+
* @deprecated use getAssets instead
|
17
|
+
*/
|
18
|
+
this.getObservations = this.getAssets;
|
19
|
+
/*
|
20
|
+
* @deprecated use getAssetKeys instead
|
21
|
+
*/
|
22
|
+
this.getObservationsKeys = this.getAssetsKeys;
|
15
23
|
this.logger = RocosLogger_1.RocosLogger.getInstance(`MapService(${this.config.url})`);
|
16
24
|
}
|
17
25
|
getStatus() {
|
@@ -21,7 +29,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
21
29
|
return new models_1.RocosError(e, models_1.errorCodes.MAPS_SERVICE_ERROR);
|
22
30
|
}
|
23
31
|
async list(projectId, callsign) {
|
24
|
-
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
32
|
+
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_URL, {
|
25
33
|
url: this.config.url,
|
26
34
|
projectId,
|
27
35
|
}, this.config.insecure), 'Failed to get maps.', callsign ? { callsign } : undefined);
|
@@ -34,7 +42,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
34
42
|
*/
|
35
43
|
async listDeployedMaps(projectId, callsign) {
|
36
44
|
const safeCallsign = encodeURIComponent(callsign);
|
37
|
-
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
45
|
+
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_DEPLOYED_URL, {
|
38
46
|
url: this.config.url,
|
39
47
|
projectId,
|
40
48
|
callsign: safeCallsign,
|
@@ -58,7 +66,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
58
66
|
description: options.description,
|
59
67
|
callsign: options.callsign,
|
60
68
|
};
|
61
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
69
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_MERGE_URL, {
|
62
70
|
url: this.config.url,
|
63
71
|
projectId,
|
64
72
|
}, this.config.insecure), payload, 'Failed to merge maps.');
|
@@ -69,7 +77,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
69
77
|
* @param mapId Map ID
|
70
78
|
*/
|
71
79
|
async get(projectId, mapId) {
|
72
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
80
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAP_ID_URL, {
|
73
81
|
url: this.config.url,
|
74
82
|
projectId,
|
75
83
|
mapId,
|
@@ -82,7 +90,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
82
90
|
* @param options New metadata
|
83
91
|
*/
|
84
92
|
async update(projectId, mapId, options) {
|
85
|
-
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
93
|
+
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAP_ID_URL, {
|
86
94
|
url: this.config.url,
|
87
95
|
projectId,
|
88
96
|
mapId,
|
@@ -97,14 +105,14 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
97
105
|
* @param hash Map hash
|
98
106
|
*/
|
99
107
|
async sendToCloud(projectId, mapId, callsign, hash) {
|
100
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
108
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAP_ID_URL, {
|
101
109
|
url: this.config.url,
|
102
110
|
projectId,
|
103
111
|
mapId,
|
104
112
|
}, this.config.insecure), { callsign, hash }, 'Failed to start map upload.');
|
105
113
|
}
|
106
114
|
async delete(projectId, mapId, callsign, hash) {
|
107
|
-
return this.callDelete((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
115
|
+
return this.callDelete((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAP_ID_URL, {
|
108
116
|
url: this.config.url,
|
109
117
|
projectId,
|
110
118
|
mapId,
|
@@ -118,7 +126,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
118
126
|
* @param options Options to create the new map
|
119
127
|
*/
|
120
128
|
async copy(projectId, mapId, options) {
|
121
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
129
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_COPY_URL, {
|
122
130
|
url: this.config.url,
|
123
131
|
projectId,
|
124
132
|
mapId,
|
@@ -131,7 +139,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
131
139
|
* @param callsign Robot callsign
|
132
140
|
*/
|
133
141
|
async deploy(projectId, mapId, callsign) {
|
134
|
-
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
142
|
+
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_DEPLOY_URL, {
|
135
143
|
url: this.config.url,
|
136
144
|
projectId,
|
137
145
|
mapId,
|
@@ -149,7 +157,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
149
157
|
projectId,
|
150
158
|
mapId,
|
151
159
|
};
|
152
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
160
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_GEOJSON_URL, params, this.config.insecure), 'Failed to get map GeoJSON.', frameId ? { frameID: frameId } : undefined);
|
153
161
|
}
|
154
162
|
/**
|
155
163
|
* Returns a Promise that resolves to an array of Observation objects for the given panorama ID.
|
@@ -159,7 +167,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
159
167
|
* @returns A Promise that resolves to an array of Observation objects.
|
160
168
|
*/
|
161
169
|
listObservations(projectId, panoramaId) {
|
162
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
170
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_PANORAMA_OBSERVATIONS_URL, { url: this.config.url, projectId, panoramaId }, this.config.insecure), 'Failed to list observations.');
|
163
171
|
}
|
164
172
|
/**
|
165
173
|
* Creates new observations on a panorama.
|
@@ -170,7 +178,7 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
170
178
|
* @returns A Promise that resolves when the observations have been created.
|
171
179
|
*/
|
172
180
|
createObservations(projectId, panoramaId, observations) {
|
173
|
-
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
181
|
+
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_PANORAMA_OBSERVATIONS_URL, { url: this.config.url, projectId, panoramaId }, this.config.insecure), observations, 'Failed to update observations.');
|
174
182
|
}
|
175
183
|
/**
|
176
184
|
* Gets observations for a project.
|
@@ -180,17 +188,17 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
180
188
|
* @param frameID (optional) Transforms on a seed frame
|
181
189
|
* @returns A list of observations
|
182
190
|
*/
|
183
|
-
|
184
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
191
|
+
getAssets(projectId, key = '', frameID = '') {
|
192
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_OBSERVATIONS_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get assets.', { key, frameID });
|
185
193
|
}
|
186
194
|
/**
|
187
|
-
* Lists available keys for all
|
195
|
+
* Lists available keys for all assets in a project.
|
188
196
|
*
|
189
197
|
* @param projectId The ID of the project the observations belongs to.
|
190
|
-
* @returns A list of
|
198
|
+
* @returns A list of assets
|
191
199
|
*/
|
192
|
-
|
193
|
-
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
200
|
+
getAssetsKeys(projectId) {
|
201
|
+
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_OBSERVATION_KEYS_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get asset keys.');
|
194
202
|
}
|
195
203
|
}
|
196
204
|
exports.MapService = MapService;
|
@@ -22,33 +22,33 @@ class TargetService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
22
22
|
return new models_1.RocosError(e, models_1.errorCodes.TARGET_SERVICE_ERROR);
|
23
23
|
}
|
24
24
|
async createTargets(projectId, targets) {
|
25
|
-
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
25
|
+
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_TARGET_UPLOAD_URL, {
|
26
26
|
url: this.config.url,
|
27
27
|
projectId,
|
28
28
|
}, this.config.insecure), targets, `Failed to upload targets for ${projectId}`);
|
29
29
|
}
|
30
30
|
async listTargets(projectId, frameID = 'seed') {
|
31
|
-
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
31
|
+
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_TARGETS_URL, {
|
32
32
|
url: this.config.url,
|
33
33
|
projectId,
|
34
34
|
}, this.config.insecure), 'Failed to list targets', { frameID });
|
35
35
|
return resp;
|
36
36
|
}
|
37
37
|
async createAssets(projectId, assets) {
|
38
|
-
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
38
|
+
return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_ASSETS_UPLOAD_URL, {
|
39
39
|
url: this.config.url,
|
40
40
|
projectId,
|
41
41
|
}, this.config.insecure), assets, `Failed to upload assets for ${projectId}`);
|
42
42
|
}
|
43
43
|
async listAssets(projectId, frameID = 'seed') {
|
44
|
-
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
44
|
+
const resp = await this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_ASSETS_URL, {
|
45
45
|
url: this.config.url,
|
46
46
|
projectId,
|
47
47
|
}, this.config.insecure), 'Failed to list assets', { frameID });
|
48
48
|
return resp;
|
49
49
|
}
|
50
50
|
async addMedia(projectId, targetId, media) {
|
51
|
-
await this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.
|
51
|
+
await this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_TARGETS_URL, {
|
52
52
|
url: this.config.url,
|
53
53
|
projectId,
|
54
54
|
targetId,
|
package/esm/constants/api.d.ts
CHANGED
@@ -121,16 +121,20 @@ export declare const API_DD_INTEGRATION_PLAN_BY_ID_URL = "https://{url}/projects
|
|
121
121
|
export declare const API_DD_INTEGRATION_OVERLAYS_URL = "https://{url}/projects/{projectId}/dd/overlays";
|
122
122
|
export declare const API_DD_INTEGRATION_ISSUES_URL = "https://{url}/projects/{projectId}/dd/issues";
|
123
123
|
export declare const API_DD_INTEGRATION_LOCATIONS_URL = "https://{url}/projects/{projectId}/dd/locations";
|
124
|
-
export declare const
|
125
|
-
export declare const
|
126
|
-
export declare const
|
127
|
-
export declare const
|
128
|
-
export declare const
|
129
|
-
export declare const
|
130
|
-
export declare const
|
131
|
-
export declare const
|
132
|
-
export declare const
|
133
|
-
export declare const
|
124
|
+
export declare const API_GRAPHS_MAPS_URL = "https://{url}/graphs/projects/{projectId}/maps";
|
125
|
+
export declare const API_GRAPHS_MAPS_DEPLOYED_URL = "https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}";
|
126
|
+
export declare const API_GRAPHS_MAPS_MERGE_URL = "https://{url}/graphs/projects/{projectId}/maps/merge";
|
127
|
+
export declare const API_GRAPHS_MAP_ID_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}";
|
128
|
+
export declare const API_GRAPHS_MAPS_COPY_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy";
|
129
|
+
export declare const API_GRAPHS_MAPS_DEPLOY_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy";
|
130
|
+
export declare const API_GRAPHS_MAPS_GEOJSON_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson";
|
131
|
+
export declare const API_GRAPHS_PANORAMA_OBSERVATIONS_URL = "https://{url}/graphs/projects/{projectId}/panoramas/{panoramaId}/observations";
|
132
|
+
export declare const API_GRAPHS_OBSERVATIONS_URL = "https://{url}/graphs/projects/{projectId}/observations";
|
133
|
+
export declare const API_GRAPHS_OBSERVATION_KEYS_URL = "https://{url}/graphs/projects/{projectId}/observations/keys";
|
134
|
+
export declare const API_GRAPHS_TARGET_UPLOAD_URL = "https://{url}/graphs/projects/{projectId}/targets/upload";
|
135
|
+
export declare const API_GRAPHS_TARGETS_URL = "https://{url}/graphs/projects/{projectId}/targets";
|
136
|
+
export declare const API_GRAPHS_ASSETS_UPLOAD_URL = "https://{url}/graphs/projects/{projectId}/assets/upload";
|
137
|
+
export declare const API_GRAPHS_ASSETS_URL = "https://{url}/graphs/projects/{projectId}/assets";
|
134
138
|
export declare const API_PROJECT_WORKFLOW_URL = "https://{url}/projects/{projectId}/automate/flows";
|
135
139
|
export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}";
|
136
140
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
@@ -138,7 +142,3 @@ export declare const API_PROJECT_DEPLOYED_WORKFLOW_URL = "https://{url}/projects
|
|
138
142
|
export declare const API_LINKED_PROJECT_URL = "https://{url}/linked-projects/{linkedProjectId}";
|
139
143
|
export declare const API_DEVICE_CREDENTIALS_URL = "https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials";
|
140
144
|
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";
|
142
|
-
export declare const API_TARGETS_URL = "https://{url}/projects/{projectId}/targets";
|
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";
|
package/esm/constants/api.js
CHANGED
@@ -121,16 +121,20 @@ export const API_DD_INTEGRATION_PLAN_BY_ID_URL = 'https://{url}/projects/{projec
|
|
121
121
|
export const API_DD_INTEGRATION_OVERLAYS_URL = 'https://{url}/projects/{projectId}/dd/overlays';
|
122
122
|
export const API_DD_INTEGRATION_ISSUES_URL = 'https://{url}/projects/{projectId}/dd/issues';
|
123
123
|
export const API_DD_INTEGRATION_LOCATIONS_URL = 'https://{url}/projects/{projectId}/dd/locations';
|
124
|
-
export const
|
125
|
-
export const
|
126
|
-
export const
|
127
|
-
export const
|
128
|
-
export const
|
129
|
-
export const
|
130
|
-
export const
|
131
|
-
export const
|
132
|
-
export const
|
133
|
-
export const
|
124
|
+
export const API_GRAPHS_MAPS_URL = 'https://{url}/graphs/projects/{projectId}/maps';
|
125
|
+
export const API_GRAPHS_MAPS_DEPLOYED_URL = 'https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}';
|
126
|
+
export const API_GRAPHS_MAPS_MERGE_URL = 'https://{url}/graphs/projects/{projectId}/maps/merge';
|
127
|
+
export const API_GRAPHS_MAP_ID_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}';
|
128
|
+
export const API_GRAPHS_MAPS_COPY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy';
|
129
|
+
export const API_GRAPHS_MAPS_DEPLOY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy';
|
130
|
+
export const API_GRAPHS_MAPS_GEOJSON_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson';
|
131
|
+
export const API_GRAPHS_PANORAMA_OBSERVATIONS_URL = 'https://{url}/graphs/projects/{projectId}/panoramas/{panoramaId}/observations';
|
132
|
+
export const API_GRAPHS_OBSERVATIONS_URL = 'https://{url}/graphs/projects/{projectId}/observations';
|
133
|
+
export const API_GRAPHS_OBSERVATION_KEYS_URL = 'https://{url}/graphs/projects/{projectId}/observations/keys';
|
134
|
+
export const API_GRAPHS_TARGET_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/targets/upload';
|
135
|
+
export const API_GRAPHS_TARGETS_URL = 'https://{url}/graphs/projects/{projectId}/targets';
|
136
|
+
export const API_GRAPHS_ASSETS_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/assets/upload';
|
137
|
+
export const API_GRAPHS_ASSETS_URL = 'https://{url}/graphs/projects/{projectId}/assets';
|
134
138
|
export const API_PROJECT_WORKFLOW_URL = 'https://{url}/projects/{projectId}/automate/flows';
|
135
139
|
export const API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}';
|
136
140
|
export const API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
@@ -138,7 +142,3 @@ export const API_PROJECT_DEPLOYED_WORKFLOW_URL = 'https://{url}/projects/{projec
|
|
138
142
|
export const API_LINKED_PROJECT_URL = 'https://{url}/linked-projects/{linkedProjectId}';
|
139
143
|
export const API_DEVICE_CREDENTIALS_URL = 'https://{url}/projects/{projectId}/callsigns/{callsign}/device-credentials';
|
140
144
|
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';
|
142
|
-
export const API_TARGETS_URL = 'https://{url}/projects/{projectId}/targets';
|
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,10 +1,12 @@
|
|
1
|
+
import { Asset, IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
|
1
2
|
import { CreateObservation, Observation } from '../models/maps/Panorama';
|
2
|
-
import { IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
/**
|
5
5
|
* Maps service for managing robot maps in the cloud and on robots
|
6
6
|
*/
|
7
7
|
export declare class MapService extends BaseServiceAbstract implements IBaseService {
|
8
|
+
getObservations: (projectId: string, key?: string, frameID?: string) => Promise<Asset[]>;
|
9
|
+
getObservationsKeys: (projectId: string) => Promise<string[]>;
|
8
10
|
constructor(config: IRocosSDKConfig);
|
9
11
|
getStatus(): boolean;
|
10
12
|
protected getError(e: Error): RocosError;
|
@@ -131,12 +133,12 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
|
|
131
133
|
* @param frameID (optional) Transforms on a seed frame
|
132
134
|
* @returns A list of observations
|
133
135
|
*/
|
134
|
-
|
136
|
+
getAssets(projectId: string, key?: string, frameID?: string): Promise<Asset[]>;
|
135
137
|
/**
|
136
|
-
* Lists available keys for all
|
138
|
+
* Lists available keys for all assets in a project.
|
137
139
|
*
|
138
140
|
* @param projectId The ID of the project the observations belongs to.
|
139
|
-
* @returns A list of
|
141
|
+
* @returns A list of assets
|
140
142
|
*/
|
141
|
-
|
143
|
+
getAssetsKeys(projectId: string): Promise<string[]>;
|
142
144
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { API_GRAPHS_MAPS_COPY_URL, API_GRAPHS_MAPS_DEPLOYED_URL, API_GRAPHS_MAPS_DEPLOY_URL, API_GRAPHS_MAPS_GEOJSON_URL, API_GRAPHS_MAPS_MERGE_URL, API_GRAPHS_MAPS_URL, API_GRAPHS_MAP_ID_URL, API_GRAPHS_OBSERVATIONS_URL, API_GRAPHS_OBSERVATION_KEYS_URL, API_GRAPHS_PANORAMA_OBSERVATIONS_URL, } from '../constants/api';
|
2
2
|
import { RocosError, errorCodes } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
import { RocosLogger } from '../logger/RocosLogger';
|
@@ -9,6 +9,14 @@ import { formatServiceUrl } from '../helpers/formatServiceUrl';
|
|
9
9
|
export class MapService extends BaseServiceAbstract {
|
10
10
|
constructor(config) {
|
11
11
|
super(config);
|
12
|
+
/*
|
13
|
+
* @deprecated use getAssets instead
|
14
|
+
*/
|
15
|
+
this.getObservations = this.getAssets;
|
16
|
+
/*
|
17
|
+
* @deprecated use getAssetKeys instead
|
18
|
+
*/
|
19
|
+
this.getObservationsKeys = this.getAssetsKeys;
|
12
20
|
this.logger = RocosLogger.getInstance(`MapService(${this.config.url})`);
|
13
21
|
}
|
14
22
|
getStatus() {
|
@@ -18,7 +26,7 @@ export class MapService extends BaseServiceAbstract {
|
|
18
26
|
return new RocosError(e, errorCodes.MAPS_SERVICE_ERROR);
|
19
27
|
}
|
20
28
|
async list(projectId, callsign) {
|
21
|
-
const resp = await this.callGet(formatServiceUrl(
|
29
|
+
const resp = await this.callGet(formatServiceUrl(API_GRAPHS_MAPS_URL, {
|
22
30
|
url: this.config.url,
|
23
31
|
projectId,
|
24
32
|
}, this.config.insecure), 'Failed to get maps.', callsign ? { callsign } : undefined);
|
@@ -31,7 +39,7 @@ export class MapService extends BaseServiceAbstract {
|
|
31
39
|
*/
|
32
40
|
async listDeployedMaps(projectId, callsign) {
|
33
41
|
const safeCallsign = encodeURIComponent(callsign);
|
34
|
-
const resp = await this.callGet(formatServiceUrl(
|
42
|
+
const resp = await this.callGet(formatServiceUrl(API_GRAPHS_MAPS_DEPLOYED_URL, {
|
35
43
|
url: this.config.url,
|
36
44
|
projectId,
|
37
45
|
callsign: safeCallsign,
|
@@ -55,7 +63,7 @@ export class MapService extends BaseServiceAbstract {
|
|
55
63
|
description: options.description,
|
56
64
|
callsign: options.callsign,
|
57
65
|
};
|
58
|
-
return this.callPost(formatServiceUrl(
|
66
|
+
return this.callPost(formatServiceUrl(API_GRAPHS_MAPS_MERGE_URL, {
|
59
67
|
url: this.config.url,
|
60
68
|
projectId,
|
61
69
|
}, this.config.insecure), payload, 'Failed to merge maps.');
|
@@ -66,7 +74,7 @@ export class MapService extends BaseServiceAbstract {
|
|
66
74
|
* @param mapId Map ID
|
67
75
|
*/
|
68
76
|
async get(projectId, mapId) {
|
69
|
-
return this.callGet(formatServiceUrl(
|
77
|
+
return this.callGet(formatServiceUrl(API_GRAPHS_MAP_ID_URL, {
|
70
78
|
url: this.config.url,
|
71
79
|
projectId,
|
72
80
|
mapId,
|
@@ -79,7 +87,7 @@ export class MapService extends BaseServiceAbstract {
|
|
79
87
|
* @param options New metadata
|
80
88
|
*/
|
81
89
|
async update(projectId, mapId, options) {
|
82
|
-
return this.callPut(formatServiceUrl(
|
90
|
+
return this.callPut(formatServiceUrl(API_GRAPHS_MAP_ID_URL, {
|
83
91
|
url: this.config.url,
|
84
92
|
projectId,
|
85
93
|
mapId,
|
@@ -94,14 +102,14 @@ export class MapService extends BaseServiceAbstract {
|
|
94
102
|
* @param hash Map hash
|
95
103
|
*/
|
96
104
|
async sendToCloud(projectId, mapId, callsign, hash) {
|
97
|
-
return this.callPost(formatServiceUrl(
|
105
|
+
return this.callPost(formatServiceUrl(API_GRAPHS_MAP_ID_URL, {
|
98
106
|
url: this.config.url,
|
99
107
|
projectId,
|
100
108
|
mapId,
|
101
109
|
}, this.config.insecure), { callsign, hash }, 'Failed to start map upload.');
|
102
110
|
}
|
103
111
|
async delete(projectId, mapId, callsign, hash) {
|
104
|
-
return this.callDelete(formatServiceUrl(
|
112
|
+
return this.callDelete(formatServiceUrl(API_GRAPHS_MAP_ID_URL, {
|
105
113
|
url: this.config.url,
|
106
114
|
projectId,
|
107
115
|
mapId,
|
@@ -115,7 +123,7 @@ export class MapService extends BaseServiceAbstract {
|
|
115
123
|
* @param options Options to create the new map
|
116
124
|
*/
|
117
125
|
async copy(projectId, mapId, options) {
|
118
|
-
return this.callPost(formatServiceUrl(
|
126
|
+
return this.callPost(formatServiceUrl(API_GRAPHS_MAPS_COPY_URL, {
|
119
127
|
url: this.config.url,
|
120
128
|
projectId,
|
121
129
|
mapId,
|
@@ -128,7 +136,7 @@ export class MapService extends BaseServiceAbstract {
|
|
128
136
|
* @param callsign Robot callsign
|
129
137
|
*/
|
130
138
|
async deploy(projectId, mapId, callsign) {
|
131
|
-
return this.callPost(formatServiceUrl(
|
139
|
+
return this.callPost(formatServiceUrl(API_GRAPHS_MAPS_DEPLOY_URL, {
|
132
140
|
url: this.config.url,
|
133
141
|
projectId,
|
134
142
|
mapId,
|
@@ -146,7 +154,7 @@ export class MapService extends BaseServiceAbstract {
|
|
146
154
|
projectId,
|
147
155
|
mapId,
|
148
156
|
};
|
149
|
-
return this.callGet(formatServiceUrl(
|
157
|
+
return this.callGet(formatServiceUrl(API_GRAPHS_MAPS_GEOJSON_URL, params, this.config.insecure), 'Failed to get map GeoJSON.', frameId ? { frameID: frameId } : undefined);
|
150
158
|
}
|
151
159
|
/**
|
152
160
|
* Returns a Promise that resolves to an array of Observation objects for the given panorama ID.
|
@@ -156,7 +164,7 @@ export class MapService extends BaseServiceAbstract {
|
|
156
164
|
* @returns A Promise that resolves to an array of Observation objects.
|
157
165
|
*/
|
158
166
|
listObservations(projectId, panoramaId) {
|
159
|
-
return this.callGet(formatServiceUrl(
|
167
|
+
return this.callGet(formatServiceUrl(API_GRAPHS_PANORAMA_OBSERVATIONS_URL, { url: this.config.url, projectId, panoramaId }, this.config.insecure), 'Failed to list observations.');
|
160
168
|
}
|
161
169
|
/**
|
162
170
|
* Creates new observations on a panorama.
|
@@ -167,7 +175,7 @@ export class MapService extends BaseServiceAbstract {
|
|
167
175
|
* @returns A Promise that resolves when the observations have been created.
|
168
176
|
*/
|
169
177
|
createObservations(projectId, panoramaId, observations) {
|
170
|
-
return this.callPut(formatServiceUrl(
|
178
|
+
return this.callPut(formatServiceUrl(API_GRAPHS_PANORAMA_OBSERVATIONS_URL, { url: this.config.url, projectId, panoramaId }, this.config.insecure), observations, 'Failed to update observations.');
|
171
179
|
}
|
172
180
|
/**
|
173
181
|
* Gets observations for a project.
|
@@ -177,16 +185,16 @@ export class MapService extends BaseServiceAbstract {
|
|
177
185
|
* @param frameID (optional) Transforms on a seed frame
|
178
186
|
* @returns A list of observations
|
179
187
|
*/
|
180
|
-
|
181
|
-
return this.callGet(formatServiceUrl(
|
188
|
+
getAssets(projectId, key = '', frameID = '') {
|
189
|
+
return this.callGet(formatServiceUrl(API_GRAPHS_OBSERVATIONS_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get assets.', { key, frameID });
|
182
190
|
}
|
183
191
|
/**
|
184
|
-
* Lists available keys for all
|
192
|
+
* Lists available keys for all assets in a project.
|
185
193
|
*
|
186
194
|
* @param projectId The ID of the project the observations belongs to.
|
187
|
-
* @returns A list of
|
195
|
+
* @returns A list of assets
|
188
196
|
*/
|
189
|
-
|
190
|
-
return this.callGet(formatServiceUrl(
|
197
|
+
getAssetsKeys(projectId) {
|
198
|
+
return this.callGet(formatServiceUrl(API_GRAPHS_OBSERVATION_KEYS_URL, { url: this.config.url, projectId }, this.config.insecure), 'Failed to get asset keys.');
|
191
199
|
}
|
192
200
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { API_GRAPHS_ASSETS_UPLOAD_URL, API_GRAPHS_ASSETS_URL, API_GRAPHS_TARGETS_URL, API_GRAPHS_TARGET_UPLOAD_URL, } from '../constants/api';
|
2
2
|
import { RocosError, errorCodes } from '../models';
|
3
3
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
4
4
|
import { RocosLogger } from '../logger/RocosLogger';
|
@@ -19,33 +19,33 @@ export class TargetService extends BaseServiceAbstract {
|
|
19
19
|
return new RocosError(e, errorCodes.TARGET_SERVICE_ERROR);
|
20
20
|
}
|
21
21
|
async createTargets(projectId, targets) {
|
22
|
-
return this.callPut(formatServiceUrl(
|
22
|
+
return this.callPut(formatServiceUrl(API_GRAPHS_TARGET_UPLOAD_URL, {
|
23
23
|
url: this.config.url,
|
24
24
|
projectId,
|
25
25
|
}, this.config.insecure), targets, `Failed to upload targets for ${projectId}`);
|
26
26
|
}
|
27
27
|
async listTargets(projectId, frameID = 'seed') {
|
28
|
-
const resp = await this.callGet(formatServiceUrl(
|
28
|
+
const resp = await this.callGet(formatServiceUrl(API_GRAPHS_TARGETS_URL, {
|
29
29
|
url: this.config.url,
|
30
30
|
projectId,
|
31
31
|
}, this.config.insecure), 'Failed to list targets', { frameID });
|
32
32
|
return resp;
|
33
33
|
}
|
34
34
|
async createAssets(projectId, assets) {
|
35
|
-
return this.callPut(formatServiceUrl(
|
35
|
+
return this.callPut(formatServiceUrl(API_GRAPHS_ASSETS_UPLOAD_URL, {
|
36
36
|
url: this.config.url,
|
37
37
|
projectId,
|
38
38
|
}, this.config.insecure), assets, `Failed to upload assets for ${projectId}`);
|
39
39
|
}
|
40
40
|
async listAssets(projectId, frameID = 'seed') {
|
41
|
-
const resp = await this.callGet(formatServiceUrl(
|
41
|
+
const resp = await this.callGet(formatServiceUrl(API_GRAPHS_ASSETS_URL, {
|
42
42
|
url: this.config.url,
|
43
43
|
projectId,
|
44
44
|
}, this.config.insecure), 'Failed to list assets', { frameID });
|
45
45
|
return resp;
|
46
46
|
}
|
47
47
|
async addMedia(projectId, targetId, media) {
|
48
|
-
await this.callPost(formatServiceUrl(
|
48
|
+
await this.callPost(formatServiceUrl(API_GRAPHS_TARGETS_URL, {
|
49
49
|
url: this.config.url,
|
50
50
|
projectId,
|
51
51
|
targetId,
|