@placeos/ts-client 4.6.0 → 4.7.1

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.
Files changed (97) hide show
  1. package/dist/alerts/alert.d.ts +1 -0
  2. package/dist/alerts/functions.d.ts +7 -10
  3. package/dist/alerts/interfaces.d.ts +22 -0
  4. package/dist/api.d.ts +30 -19
  5. package/dist/applications/functions.d.ts +2 -5
  6. package/dist/applications/interfaces.d.ts +5 -11
  7. package/dist/assets/functions.d.ts +5 -5
  8. package/dist/assets/interfaces.d.ts +38 -0
  9. package/dist/clusters/functions.d.ts +16 -7
  10. package/dist/clusters/interfaces.d.ts +18 -3
  11. package/dist/domains/functions.d.ts +10 -6
  12. package/dist/drivers/functions.d.ts +3 -5
  13. package/dist/drivers/interfaces.d.ts +9 -7
  14. package/dist/edge/functions.d.ts +8 -7
  15. package/dist/index.cjs.js +2 -2
  16. package/dist/index.cjs.js.map +1 -1
  17. package/dist/index.es.js +2238 -1897
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/index.umd.js +3 -3
  20. package/dist/index.umd.js.map +1 -1
  21. package/dist/ldap-sources/functions.d.ts +2 -5
  22. package/dist/metadata/functions.d.ts +8 -9
  23. package/dist/metadata/interfaces.d.ts +18 -4
  24. package/dist/modules/functions.d.ts +10 -4
  25. package/dist/modules/interfaces.d.ts +14 -12
  26. package/dist/oauth-sources/functions.d.ts +2 -5
  27. package/dist/repositories/functions.d.ts +17 -29
  28. package/dist/repositories/interfaces.d.ts +31 -3
  29. package/dist/resources/interface.d.ts +9 -4
  30. package/dist/saml-sources/functions.d.ts +4 -7
  31. package/dist/settings/functions.d.ts +6 -8
  32. package/dist/settings/interfaces.d.ts +7 -0
  33. package/dist/short-url/functions.d.ts +60 -0
  34. package/dist/short-url/interfaces.d.ts +22 -0
  35. package/dist/short-url/short-url.class.d.ts +17 -0
  36. package/dist/signage/interfaces.d.ts +9 -1
  37. package/dist/storages/functions.d.ts +31 -0
  38. package/dist/storages/interfaces.d.ts +6 -0
  39. package/dist/storages/storage.class.d.ts +18 -0
  40. package/dist/systems/functions.d.ts +38 -10
  41. package/dist/systems/interfaces.d.ts +58 -5
  42. package/dist/triggers/functions.d.ts +5 -7
  43. package/dist/triggers/interfaces.d.ts +9 -0
  44. package/dist/triggers/trigger.d.ts +1 -0
  45. package/dist/users/functions.d.ts +50 -10
  46. package/dist/users/interfaces.d.ts +35 -2
  47. package/dist/webrtc/functions.d.ts +52 -0
  48. package/dist/webrtc/interfaces.d.ts +73 -0
  49. package/dist/zones/functions.d.ts +12 -6
  50. package/dist/zones/interfaces.d.ts +9 -4
  51. package/package.json +1 -1
  52. package/src/alerts/alert.ts +3 -0
  53. package/src/alerts/functions.ts +14 -22
  54. package/src/alerts/interfaces.ts +25 -0
  55. package/src/api.ts +116 -3
  56. package/src/applications/functions.ts +4 -7
  57. package/src/applications/interfaces.ts +6 -12
  58. package/src/assets/functions.ts +10 -5
  59. package/src/assets/interfaces.ts +41 -0
  60. package/src/clusters/functions.ts +39 -8
  61. package/src/clusters/interfaces.ts +21 -3
  62. package/src/domains/functions.ts +17 -6
  63. package/src/drivers/functions.ts +4 -6
  64. package/src/drivers/interfaces.ts +11 -7
  65. package/src/edge/functions.ts +18 -10
  66. package/src/ldap-sources/functions.ts +4 -7
  67. package/src/metadata/functions.ts +16 -10
  68. package/src/metadata/interfaces.ts +20 -4
  69. package/src/modules/functions.ts +29 -7
  70. package/src/modules/interfaces.ts +15 -12
  71. package/src/oauth-sources/functions.ts +4 -7
  72. package/src/repositories/functions.ts +35 -35
  73. package/src/repositories/interfaces.ts +35 -3
  74. package/src/resources/interface.ts +9 -4
  75. package/src/saml-sources/functions.ts +6 -9
  76. package/src/settings/functions.ts +14 -10
  77. package/src/settings/interfaces.ts +8 -0
  78. package/src/short-url/functions.ts +155 -0
  79. package/src/short-url/interfaces.ts +25 -0
  80. package/src/short-url/short-url.class.ts +33 -0
  81. package/src/signage/interfaces.ts +10 -1
  82. package/src/storages/functions.ts +88 -0
  83. package/src/storages/interfaces.ts +7 -0
  84. package/src/storages/storage.class.ts +34 -0
  85. package/src/systems/functions.ts +113 -13
  86. package/src/systems/interfaces.ts +65 -5
  87. package/src/triggers/functions.ts +9 -8
  88. package/src/triggers/interfaces.ts +10 -0
  89. package/src/triggers/trigger.ts +3 -0
  90. package/src/users/functions.ts +104 -9
  91. package/src/users/interfaces.ts +40 -2
  92. package/src/webrtc/functions.ts +120 -0
  93. package/src/webrtc/interfaces.ts +77 -0
  94. package/src/zones/functions.ts +28 -7
  95. package/src/zones/interfaces.ts +10 -4
  96. package/dist/assets/types.d.ts +0 -1
  97. package/src/assets/types.ts +0 -0
@@ -6,9 +6,8 @@ import {
6
6
  task,
7
7
  update,
8
8
  } from '../resources/functions';
9
- import { HashMap } from '../utilities/types';
10
9
  import { PlaceDriver } from './driver';
11
- import { PlaceDriverQueryOptions } from './interfaces';
10
+ import { PlaceDriverQueryOptions, PlaceDriverShowOptions } from './interfaces';
12
11
 
13
12
  /**
14
13
  * @private
@@ -33,7 +32,7 @@ export function queryDrivers(query_params: PlaceDriverQueryOptions = {}) {
33
32
  * @param id ID of the driver to retrieve
34
33
  * @param query_params Query parameters to add the to request URL
35
34
  */
36
- export function showDriver(id: string, query_params: HashMap = {}) {
35
+ export function showDriver(id: string, query_params: PlaceDriverShowOptions = {}) {
37
36
  return show({ id, query_params, fn: process, path: PATH });
38
37
  }
39
38
 
@@ -71,10 +70,9 @@ export function addDriver(form_data: Partial<PlaceDriver>) {
71
70
  /**
72
71
  * Remove a driver from the database
73
72
  * @param id ID of the driver
74
- * @param query_params Query parameters to add the to request URL
75
73
  */
76
- export function removeDriver(id: string, query_params: HashMap = {}) {
77
- return remove({ id, query_params, path: PATH });
74
+ export function removeDriver(id: string) {
75
+ return remove({ id, query_params: {}, path: PATH });
78
76
  }
79
77
 
80
78
  /**
@@ -1,15 +1,19 @@
1
- /** Mapping of available query paramters for the dependencies index */
2
- export interface PlaceDriverQueryOptions {
3
- /** Set maximum number of results to return. Defaults to `20` */
4
- limit?: number;
5
- /** Set number of results to skip. Defaults to `0` */
6
- offset?: number;
7
- /** Filter result by type of driver. One of either `ssh`, `device`, `service` or `logic` */
1
+ import { PlaceResourceQueryOptions } from '../resources/interface';
2
+
3
+ /** Mapping of available query parameters for the drivers index endpoint */
4
+ export interface PlaceDriverQueryOptions extends PlaceResourceQueryOptions {
5
+ /** Filter result by type of driver */
8
6
  role?: 'ssh' | 'device' | 'service' | 'logic' | 'websocket';
9
7
  /** Only return drivers that have an update available */
10
8
  update_available?: boolean;
11
9
  }
12
10
 
11
+ /** Mapping of available query parameters for the drivers show endpoint */
12
+ export interface PlaceDriverShowOptions {
13
+ /** Check if the driver is compiled */
14
+ compilation_status?: boolean;
15
+ }
16
+
13
17
  /** List of details that can be assigned to a new Driver */
14
18
  export interface PlaceDriverDetails {
15
19
  /** Default name for the driver */
@@ -1,3 +1,4 @@
1
+ import { apiEndpoint } from '../auth/functions';
1
2
  import { PlaceAuthSourceQueryOptions } from '../auth-sources/interfaces';
2
3
  import {
3
4
  create,
@@ -7,7 +8,6 @@ import {
7
8
  task,
8
9
  update,
9
10
  } from '../resources/functions';
10
- import { HashMap } from '../utilities/types';
11
11
  import { PlaceEdge } from './edge';
12
12
 
13
13
  /**
@@ -31,10 +31,9 @@ export function queryEdges(query_params: PlaceAuthSourceQueryOptions = {}) {
31
31
  /**
32
32
  * Get the data for an Edge
33
33
  * @param id ID of the Edge to retrieve
34
- * @param query_params Query parameters to add the to request URL
35
34
  */
36
- export function showEdge(id: string, query_params: HashMap = {}) {
37
- return show({ id, query_params, fn: process, path: PATH });
35
+ export function showEdge(id: string) {
36
+ return show({ id, query_params: {}, fn: process, path: PATH });
38
37
  }
39
38
 
40
39
  /**
@@ -71,23 +70,32 @@ export function addEdge(form_data: Partial<PlaceEdge>) {
71
70
  /**
72
71
  * Remove an Edge node from the database
73
72
  * @param id ID of the Edge
74
- * @param query_params Query parameters to add the to request URL
75
73
  */
76
- export function removeEdge(id: string, query_params: HashMap = {}) {
77
- return remove({ id, query_params, path: PATH });
74
+ export function removeEdge(id: string) {
75
+ return remove({ id, query_params: {}, path: PATH });
78
76
  }
79
77
 
80
78
  /**
81
79
  * Generate token for Edge connection
82
80
  * @param id ID of the Edge
83
- * @param query_params Query parameters to add the to request URL
84
81
  */
85
- export function retrieveEdgeToken(id: string, query_params: HashMap = {}) {
82
+ export function retrieveEdgeToken(id: string) {
86
83
  return task<{ token: string }>({
87
84
  id,
88
85
  task_name: 'token',
89
- form_data: query_params,
86
+ form_data: {},
90
87
  method: 'get',
91
88
  path: PATH,
92
89
  });
93
90
  }
91
+
92
+ /**
93
+ * Get the edge control websocket URL.
94
+ * This is the endpoint that edge devices use to connect to the cluster.
95
+ */
96
+ export function edgeControlUrl(): string {
97
+ const endpoint = apiEndpoint();
98
+ const wsProtocol = endpoint.startsWith('https') ? 'wss:' : 'ws:';
99
+ const httpProtocol = endpoint.startsWith('https') ? 'https:' : 'http:';
100
+ return endpoint.replace(httpProtocol, wsProtocol) + `${PATH}/control`;
101
+ }
@@ -1,6 +1,5 @@
1
1
  import { PlaceAuthSourceQueryOptions } from '../auth-sources/interfaces';
2
2
  import { create, query, remove, show, update } from '../resources/functions';
3
- import { HashMap } from '../utilities/types';
4
3
  import { PlaceLDAPSource } from './ldap-source';
5
4
 
6
5
  /**
@@ -26,10 +25,9 @@ export function queryLDAPSources(
26
25
  /**
27
26
  * Get the data for an LDAP source
28
27
  * @param id ID of the LDAP source to retrieve
29
- * @param query_params Query parameters to add the to request URL
30
28
  */
31
- export function showLDAPSource(id: string, query_params: HashMap = {}) {
32
- return show({ id, query_params, fn: process, path: PATH });
29
+ export function showLDAPSource(id: string) {
30
+ return show({ id, query_params: {}, fn: process, path: PATH });
33
31
  }
34
32
 
35
33
  /**
@@ -66,8 +64,7 @@ export function addLDAPSource(form_data: Partial<PlaceLDAPSource>) {
66
64
  /**
67
65
  * Remove an LDAP source from the database
68
66
  * @param id ID of the LDAP source
69
- * @param query_params Query parameters to add the to request URL
70
67
  */
71
- export function removeLDAPSource(id: string, query_params: HashMap = {}) {
72
- return remove({ id, query_params, path: PATH });
68
+ export function removeLDAPSource(id: string) {
69
+ return remove({ id, query_params: {}, path: PATH });
73
70
  }
@@ -1,7 +1,12 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { create, remove, show, task, update } from '../resources/functions';
3
3
  import { HashMap } from '../utilities/types';
4
- import { PlaceZoneMetadataOptions } from './interfaces';
4
+ import {
5
+ PlaceMetadataDeleteOptions,
6
+ PlaceMetadataHistoryOptions,
7
+ PlaceMetadataOptions,
8
+ PlaceZoneMetadataOptions,
9
+ } from './interfaces';
5
10
  import { PlaceMetadata } from './metadata';
6
11
  import { PlaceZoneMetadata } from './zone-metadata';
7
12
 
@@ -22,7 +27,7 @@ function process(item: Partial<PlaceMetadata>) {
22
27
  */
23
28
  export function listMetadata(
24
29
  id: string,
25
- query_params: HashMap = {},
30
+ query_params: PlaceMetadataOptions = {},
26
31
  ): Observable<PlaceMetadata[]> {
27
32
  return show({
28
33
  id,
@@ -53,11 +58,11 @@ function flatten<T = any>(an_array: T[]): T {
53
58
  /**
54
59
  * List the metadata history for a database item
55
60
  * @param id ID of the item to retrieve metadata
56
- * @param form_data Data to pass to the request URL.
61
+ * @param query_params Query parameters to add to the request URL.
57
62
  */
58
63
  export function listMetadataHistory(
59
64
  id: string,
60
- query_params: HashMap = {},
65
+ query_params: PlaceMetadataHistoryOptions = {},
61
66
  ): Observable<PlaceMetadata[]> {
62
67
  return task({
63
68
  id,
@@ -78,16 +83,14 @@ export function listMetadataHistory(
78
83
  * Get a metadata field for a database item
79
84
  * @param id ID of the item to retrieve metadata
80
85
  * @param name Name of the metadata field to retrieve
81
- * @param query_params Query parameters to add the to request URL.
82
86
  */
83
87
  export function showMetadata(
84
88
  id: string,
85
89
  name: string,
86
- query_params: HashMap = {},
87
90
  ): Observable<PlaceMetadata> {
88
91
  return show({
89
92
  id,
90
- query_params: { ...query_params, name },
93
+ query_params: { name },
91
94
  fn: (data: HashMap) => process(data[name]),
92
95
  path: PATH,
93
96
  });
@@ -120,11 +123,14 @@ export function addMetadata(form_data: Partial<PlaceMetadata>) {
120
123
  }
121
124
 
122
125
  /**
123
- * Remove an metadata from the database
126
+ * Remove metadata from the database
124
127
  * @param id ID of the item associated with the metadata
125
- * @param query_params Query parameters to add the to request URL
128
+ * @param query_params Query parameters including the metadata key name (required)
126
129
  */
127
- export function removeMetadata(id: string, query_params: HashMap = {}) {
130
+ export function removeMetadata(
131
+ id: string,
132
+ query_params: PlaceMetadataDeleteOptions,
133
+ ) {
128
134
  return remove({ id, query_params, path: PATH });
129
135
  }
130
136
 
@@ -1,11 +1,27 @@
1
- /** Query param options for getting metadata */
1
+ /** Query param options for getting metadata */
2
2
  export interface PlaceMetadataOptions {
3
- /** Specify key to return, i.e. catering */
3
+ /** The name of the metadata key to return */
4
4
  name?: string;
5
5
  }
6
6
 
7
+ /** Query param options for deleting metadata */
8
+ export interface PlaceMetadataDeleteOptions {
9
+ /** The name of the metadata key to delete (required) */
10
+ name: string;
11
+ }
12
+
7
13
  /** Query param options for getting child metadata */
8
14
  export interface PlaceZoneMetadataOptions extends PlaceMetadataOptions {
9
- /** Only return metadata from s with tags. Comma seperated string */
10
- tags?: string;
15
+ /** Include parent metadata in the results (included by default) */
16
+ include_parent?: boolean;
17
+ }
18
+
19
+ /** Query param options for getting metadata history */
20
+ export interface PlaceMetadataHistoryOptions {
21
+ /** The name of the metadata key */
22
+ name?: string;
23
+ /** Maximum number of results to return */
24
+ limit?: number;
25
+ /** Starting offset of the result set for pagination */
26
+ offset?: number;
11
27
  }
@@ -9,7 +9,11 @@ import {
9
9
  } from '../resources/functions';
10
10
  import { PlaceSettings } from '../settings/settings';
11
11
  import { HashMap } from '../utilities/types';
12
- import { PlaceModulePingOptions, PlaceModuleQueryOptions } from './interfaces';
12
+ import {
13
+ PlaceModulePingOptions,
14
+ PlaceModuleQueryOptions,
15
+ PlaceModuleShowOptions,
16
+ } from './interfaces';
13
17
  import { PlaceModule } from './module';
14
18
 
15
19
  /**
@@ -35,7 +39,7 @@ export function queryModules(query_params: PlaceModuleQueryOptions = {}) {
35
39
  * @param id ID of the module to retrieve
36
40
  * @param query_params Query parameters to add the to request URL
37
41
  */
38
- export function showModule(id: string, query_params: HashMap = {}) {
42
+ export function showModule(id: string, query_params: PlaceModuleShowOptions = {}) {
39
43
  return show({ id, query_params, fn: process, path: PATH });
40
44
  }
41
45
 
@@ -73,10 +77,9 @@ export function addModule(form_data: Partial<PlaceModule>) {
73
77
  /**
74
78
  * Remove a module from the database
75
79
  * @param id ID of the module
76
- * @param query_params Query parameters to add the to request URL
77
80
  */
78
- export function removeModule(id: string, query_params: HashMap = {}) {
79
- return remove({ id, query_params, path: PATH });
81
+ export function removeModule(id: string) {
82
+ return remove({ id, query_params: {}, path: PATH });
80
83
  }
81
84
 
82
85
  /**
@@ -100,7 +103,7 @@ export function stopModule(id: string) {
100
103
  * @param id Module ID
101
104
  */
102
105
  export function pingModule(id: string): Observable<PlaceModulePingOptions> {
103
- return task({ id, task_name: 'stop', path: PATH });
106
+ return task({ id, task_name: 'ping', method: 'post', path: PATH });
104
107
  }
105
108
 
106
109
  /**
@@ -121,7 +124,7 @@ export function lookupModuleState(
121
124
  id: string,
122
125
  key: string,
123
126
  ): Observable<HashMap> {
124
- return task({ id, task_name: `state${key}`, method: 'get', path: PATH });
127
+ return task({ id, task_name: `state/${key}`, method: 'get', path: PATH });
125
128
  }
126
129
 
127
130
  /**
@@ -159,3 +162,22 @@ export function moduleRuntimeError(id: string) {
159
162
  path: PATH,
160
163
  });
161
164
  }
165
+
166
+ /**
167
+ * Execute a command on a module
168
+ * @param id Module ID
169
+ * @param method Name of the method to execute
170
+ * @param args Array of arguments to pass to the executed method
171
+ */
172
+ export function executeOnModule(
173
+ id: string,
174
+ method: string,
175
+ args: any[] = [],
176
+ ): Observable<HashMap> {
177
+ return task({
178
+ id,
179
+ task_name: `exec/${encodeURIComponent(method)}`,
180
+ form_data: args,
181
+ path: PATH,
182
+ });
183
+ }
@@ -1,22 +1,25 @@
1
1
  import { PlaceResourceQueryOptions } from '../resources/interface';
2
2
 
3
- /** Mapping of available query paramters for the modules index */
3
+ /** Mapping of available query parameters for the modules index endpoint */
4
4
  export interface PlaceModuleQueryOptions extends PlaceResourceQueryOptions {
5
- /** Returns modules that are in the given system */
5
+ /** Only return modules updated before this time (unix epoch) */
6
+ as_of?: number;
7
+ /** Only return modules running in this system (query params are ignored if this is provided) */
6
8
  control_system_id?: string;
7
- /** Returns modules with the given dependency */
8
- driver_id?: string;
9
9
  /** Return results that connected state matches this value */
10
10
  connected?: boolean;
11
- /** Return modules that are running or not stopped */
12
- running?: boolean;
13
- /** Returns modules that are not logic modules (i.e. they connect to a device or service) */
11
+ /** Only return instances of this driver */
12
+ driver_id?: string;
13
+ /** Do not return logic modules (return only modules that can exist in multiple systems) */
14
14
  no_logic?: boolean;
15
- /**
16
- * Returns modules that have not been updated since the
17
- * value defined as seconds since UTC epoch
18
- */
19
- as_of?: number;
15
+ /** Return only running modules */
16
+ running?: boolean;
17
+ }
18
+
19
+ /** Mapping of available query parameters for the modules show endpoint */
20
+ export interface PlaceModuleShowOptions {
21
+ /** Return the driver details along with the module */
22
+ complete?: boolean;
20
23
  }
21
24
 
22
25
  /** Place response from `ping` module task endpoint `/api/engine/v2/<mod_id>/ping` */
@@ -1,6 +1,5 @@
1
1
  import { PlaceAuthSourceQueryOptions } from '../auth-sources/interfaces';
2
2
  import { create, query, remove, show, update } from '../resources/functions';
3
- import { HashMap } from '../utilities/types';
4
3
  import { PlaceOAuthSource } from './oauth-source';
5
4
 
6
5
  /**
@@ -26,10 +25,9 @@ export function queryOAuthSources(
26
25
  /**
27
26
  * Get the data for an OAuth source
28
27
  * @param id ID of the OAuth source to retrieve
29
- * @param query_params Query parameters to add the to request URL
30
28
  */
31
- export function showOAuthSource(id: string, query_params: HashMap = {}) {
32
- return show({ id, query_params, fn: process, path: PATH });
29
+ export function showOAuthSource(id: string) {
30
+ return show({ id, query_params: {}, fn: process, path: PATH });
33
31
  }
34
32
 
35
33
  /**
@@ -66,8 +64,7 @@ export function addOAuthSource(form_data: Partial<PlaceOAuthSource>) {
66
64
  /**
67
65
  * Remove an OAuth source from the database
68
66
  * @param id ID of the OAuth source
69
- * @param query_params Query parameters to add the to request URL
70
67
  */
71
- export function removeOAuthSource(id: string, query_params: HashMap = {}) {
72
- return remove({ id, query_params, path: PATH });
68
+ export function removeOAuthSource(id: string) {
69
+ return remove({ id, query_params: {}, path: PATH });
73
70
  }
@@ -8,13 +8,16 @@ import {
8
8
  task,
9
9
  update,
10
10
  } from '../resources/functions';
11
- import { PlaceResourceQueryOptions } from '../resources/interface';
12
11
  import { HashMap } from '../utilities/types';
13
12
  import {
14
13
  GitCommitDetails,
14
+ PlaceRemoteRepositoryCommitsQuery,
15
+ PlaceRemoteRepositoryQuery,
15
16
  PlaceRepositoryCommitQuery,
16
17
  PlaceRepositoryDetailsQuery,
18
+ PlaceRepositoryFoldersQuery,
17
19
  PlaceRepositoryPullQuery,
20
+ PlaceRepositoryQueryOptions,
18
21
  } from './interfaces';
19
22
  import { PlaceRepository } from './repository';
20
23
 
@@ -33,7 +36,7 @@ function process(item: Partial<PlaceRepository>) {
33
36
  * @param query_params Query parameters to add the to request URL
34
37
  */
35
38
  export function queryRepositories(
36
- query_params: PlaceResourceQueryOptions = {},
39
+ query_params: PlaceRepositoryQueryOptions = {},
37
40
  ) {
38
41
  return query({ query_params, fn: process, path: PATH });
39
42
  }
@@ -41,10 +44,9 @@ export function queryRepositories(
41
44
  /**
42
45
  * Get the data for a repository
43
46
  * @param id ID of the repository to retrieve
44
- * @param query_params Query parameters to add the to request URL
45
47
  */
46
- export function showRepository(id: string, query_params: HashMap = {}) {
47
- return show({ id, query_params, fn: process, path: PATH });
48
+ export function showRepository(id: string) {
49
+ return show({ id, query_params: {}, fn: process, path: PATH });
48
50
  }
49
51
 
50
52
  /**
@@ -79,34 +81,30 @@ export function addRepository(form_data: Partial<PlaceRepository>) {
79
81
  }
80
82
 
81
83
  /**
82
- * Remove an repository from the database
84
+ * Remove a repository from the database
83
85
  * @param id ID of the repository
84
- * @param query_params Query parameters to add the to request URL
85
86
  */
86
- export function removeRepository(id: string, query_params: HashMap = {}) {
87
- return remove({ id, query_params, path: PATH });
87
+ export function removeRepository(id: string) {
88
+ return remove({ id, query_params: {}, path: PATH });
88
89
  }
89
90
 
90
91
  /**
91
92
  * Get a list of all the interfaces
92
- * @param query_params Addition query parameters to pass to the request
93
93
  */
94
- export function listInterfaceRepositories(
95
- query_params: HashMap = {},
96
- ): Observable<string[]> {
94
+ export function listInterfaceRepositories(): Observable<string[]> {
97
95
  return show({
98
96
  id: 'interfaces',
99
- query_params,
97
+ query_params: {},
100
98
  path: PATH,
101
99
  });
102
100
  }
103
101
 
104
102
  /**
105
- * Get name of the default branches for a new repository
103
+ * Get name of the default branch for a new repository
106
104
  * @param query_params Details about the repository
107
105
  */
108
106
  export function listRemoteRepositoryDefaultBranch(
109
- query_params: RepositoryDetails,
107
+ query_params: PlaceRemoteRepositoryQuery,
110
108
  ): Observable<string> {
111
109
  return show({
112
110
  id: 'remote_default_branch',
@@ -115,21 +113,12 @@ export function listRemoteRepositoryDefaultBranch(
115
113
  });
116
114
  }
117
115
 
118
- export interface RepositoryDetails {
119
- /** Git URL of the remote repository */
120
- repository_url: string;
121
- /** Username required to access the repository */
122
- username?: string;
123
- /** Password for the required user */
124
- password?: string;
125
- }
126
-
127
116
  /**
128
117
  * Get a list of branches for a new repository
129
118
  * @param query_params Details about the repository
130
119
  */
131
120
  export function listRemoteRepositoryBranches(
132
- query_params: RepositoryDetails,
121
+ query_params: PlaceRemoteRepositoryQuery,
133
122
  ): Observable<string[]> {
134
123
  return show({
135
124
  id: 'remote_branches',
@@ -138,19 +127,12 @@ export function listRemoteRepositoryBranches(
138
127
  });
139
128
  }
140
129
 
141
- export interface RepositoryBranchDetails extends RepositoryDetails {
142
- /** Branch to grab details for. Defaults to the default branch */
143
- branch?: string;
144
- /** Number of commits to retrieve from the remote. Defaults to `50` */
145
- depth?: number;
146
- }
147
-
148
130
  /**
149
131
  * Get a list of branch commits for a new repository
150
132
  * @param query_params Details about the repository
151
133
  */
152
134
  export function listRemoteRepositoryCommits(
153
- query_params: RepositoryBranchDetails,
135
+ query_params: PlaceRemoteRepositoryCommitsQuery,
154
136
  ): Observable<GitCommitDetails[]> {
155
137
  return show({
156
138
  id: 'remote_commits',
@@ -164,7 +146,7 @@ export function listRemoteRepositoryCommits(
164
146
  * @param query_params Details about the repository
165
147
  */
166
148
  export function listRemoteRepositoryTags(
167
- query_params: RepositoryDetails,
149
+ query_params: PlaceRemoteRepositoryQuery,
168
150
  ): Observable<string[]> {
169
151
  return show({
170
152
  id: 'remote_tags',
@@ -301,3 +283,21 @@ export function pullRepositoryChanges(
301
283
  path: PATH,
302
284
  });
303
285
  }
286
+
287
+ /**
288
+ * Get the folder tree structure of a repository
289
+ * @param id ID of the repository
290
+ * @param query_params Query parameters to add to the request
291
+ */
292
+ export function listRepositoryFolders(
293
+ id: string,
294
+ query_params?: PlaceRepositoryFoldersQuery,
295
+ ): Observable<string[]> {
296
+ return task({
297
+ id,
298
+ task_name: 'folders',
299
+ form_data: query_params,
300
+ method: 'get',
301
+ path: PATH,
302
+ });
303
+ }
@@ -1,3 +1,5 @@
1
+ import { PlaceResourceQueryOptions } from '../resources/interface';
2
+
1
3
  /** Type of repository */
2
4
  export enum PlaceRepositoryType {
3
5
  /** Repository is a collection of Driver logic */
@@ -6,6 +8,10 @@ export enum PlaceRepositoryType {
6
8
  Interface = 'interface',
7
9
  }
8
10
 
11
+ /** Mapping of available query parameters for the repositories index endpoint */
12
+ export interface PlaceRepositoryQueryOptions extends PlaceResourceQueryOptions {}
13
+
14
+ /** Query parameters for repository commit listing */
9
15
  export interface PlaceRepositoryCommitQuery {
10
16
  /** URL encoded name of the branch being requested */
11
17
  branch?: string;
@@ -20,24 +26,50 @@ export interface GitCommitDetails {
20
26
  author: string;
21
27
  /** Short hash of the commit */
22
28
  commit: string;
23
- /** ISO datetime string for commit */
29
+ /** ISO datetime string for commit */
24
30
  date: string;
25
31
  /** Commit summary */
26
32
  subject: string;
27
33
  }
28
34
 
35
+ /** Query parameters for repository driver details */
29
36
  export interface PlaceRepositoryDetailsQuery {
30
- /** URL encoded name of the driver being requested */
37
+ /** URL encoded name of the driver being requested (required) */
31
38
  driver: string;
32
- /** Hash of the commit being requested for the driver */
39
+ /** Hash of the commit being requested for the driver (required) */
33
40
  commit: string;
34
41
  }
35
42
 
43
+ /** Query parameters for repository pull */
36
44
  export interface PlaceRepositoryPullQuery {
37
45
  /** Hash of the commit being requested */
38
46
  commit: string;
39
47
  }
40
48
 
49
+ /** Query parameters for remote repository operations */
50
+ export interface PlaceRemoteRepositoryQuery {
51
+ /** The git URL that represents the repository (required) */
52
+ repository_url: string;
53
+ /** A username for access if required */
54
+ username?: string;
55
+ /** The password or access token as required */
56
+ password?: string;
57
+ }
58
+
59
+ /** Query parameters for remote repository commits */
60
+ export interface PlaceRemoteRepositoryCommitsQuery extends PlaceRemoteRepositoryQuery {
61
+ /** The branch to grab commits from */
62
+ branch?: string;
63
+ /** The number of commits to return */
64
+ depth?: number;
65
+ }
66
+
67
+ /** Query parameters for repository folders listing */
68
+ export interface PlaceRepositoryFoldersQuery {
69
+ /** Include dot files and folders */
70
+ include_dots?: boolean;
71
+ }
72
+
41
73
  /** Metadata for a repository commit */
42
74
  export interface PlaceRepositoryCommit {
43
75
  /** Hash associated with the commit */
@@ -7,15 +7,20 @@ import { HashMap } from '../utilities/types';
7
7
  export interface PlaceResourceQueryOptions {
8
8
  /**
9
9
  * Search filter supporting the following syntax
10
- * https://www.elastic.co/guide/en/elasticsearch/reference/5.5/query-dsl-simple-query-string-query.html
10
+ * https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html
11
11
  */
12
12
  q?: string;
13
- /** Comma seperated list of fields to apply the query to */
13
+ /**
14
+ * Comma separated list of fields to search.
15
+ * Accepts wildcard expressions and boost relevance scores using caret ^ operator.
16
+ */
14
17
  fields?: string;
15
18
  /** Number of results to return. Defaults to `20`. Max `500` */
16
19
  limit?: number;
17
- /** Offsets of the results to return. Max `10000` */
20
+ /** @deprecated Use `ref` for pagination. Offset of the results to return. Max `10000` */
18
21
  offset?: number;
22
+ /** Token for accessing the next page of results, provided in the `Link` header */
23
+ ref?: string;
19
24
  /** Number of milliseconds to cache the query response */
20
25
  cache?: number;
21
26
  /** Whether the request is a API poll request */
@@ -80,7 +85,7 @@ export interface TaskParameters<T> {
80
85
  id: string;
81
86
  task_name: string;
82
87
  form_data?: any;
83
- method?: 'post' | 'get' | 'del' | 'put';
88
+ method?: 'post' | 'get' | 'del' | 'put' | 'patch';
84
89
  callback?: (_: any) => T;
85
90
  path: string;
86
91
  }