@mapcreator/api 2.6.2 → 2.7.0

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.
@@ -20,7 +20,7 @@ function easyAuth() {
20
20
 
21
21
  console.log('You can play around with the api in here, the library is bound to window.mapcreator. Authentication ');
22
22
  console.log('can easily be done by running the command easyAuth(). See the docs for more information here: ');
23
- console.log('https://docs.mapcreator.io/wrapper/manual/example/examples.authentication.html');
23
+ console.log('https://docs.mapcreator.io/wrapper/manual/examples.authentication.html');
24
24
  console.log('Example: easyAuth().then(api => window.api = api);');
25
25
  console.log('window.mapcreator =', window.mapcreator);
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcreator/api",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "Mapcreator JavaScript API",
5
5
  "main": "dist/bundle.js",
6
6
  "repository": "https://gitlab.com/mapcreator/api-wrapper.git",
package/src/Mapcreator.js CHANGED
@@ -83,6 +83,7 @@ import ValidationError from './errors/ValidationError';
83
83
  import ApiError from './errors/ApiError';
84
84
  import { wrapKyPrefixUrl } from './utils/requests';
85
85
  import EventEmitter from 'events';
86
+ import LayerGroup from './resources/LayerGroup';
86
87
 
87
88
  /**
88
89
  * Base API class
@@ -535,6 +536,15 @@ export default class Mapcreator extends mix(EventEmitter, Injectable) {
535
536
  return this.static(Layer);
536
537
  }
537
538
 
539
+ /**
540
+ * Layer group accessor
541
+ * @see {@link LayerGroup}
542
+ * @returns {ResourceProxy} - A proxy for accessing the resource
543
+ */
544
+ get layerGroups () {
545
+ return this.static(LayerGroup);
546
+ }
547
+
538
548
  /**
539
549
  * Mapstyle accessor
540
550
  * @see {@link Mapstyle}
@@ -0,0 +1,57 @@
1
+ /*
2
+ * BSD 3-Clause License
3
+ *
4
+ * Copyright (c) 2020, Mapcreator
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ *
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ * list of conditions and the following disclaimer.
12
+ *
13
+ * Redistributions in binary form must reproduce the above copyright notice,
14
+ * this list of conditions and the following disclaimer in the documentation
15
+ * and/or other materials provided with the distribution.
16
+ *
17
+ * Neither the name of the copyright holder nor the names of its
18
+ * contributors may be used to endorse or promote products derived from
19
+ * this software without specific prior written permission.
20
+ *
21
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ import OwnableResource from '../traits/OwnableResource';
34
+ import { mix } from '../utils/reflection';
35
+ import Layer from './Layer';
36
+ import CrudSetBase from './base/CrudSetBase';
37
+ import { OwnedResourceProxy } from '../proxy';
38
+
39
+ /**
40
+ * Layer
41
+ * @extends CrudBase
42
+ * @mixes OwnableResource
43
+ * @mixes HandlesImages
44
+ */
45
+ export default class LayerGroup extends mix(CrudSetBase, OwnableResource) {
46
+ static get resourceName () {
47
+ return 'layer-groups';
48
+ }
49
+
50
+ get items () {
51
+ return new OwnedResourceProxy(this.api, this, this._Child);
52
+ }
53
+
54
+ get _Child () {
55
+ return Layer;
56
+ }
57
+ }
@@ -48,6 +48,7 @@ import Tag from './Tag';
48
48
  import User from './User';
49
49
  import { makeCancelable } from '../utils/helpers';
50
50
  import { encodeQueryString } from '../utils/requests';
51
+ import LayerGroup from './LayerGroup';
51
52
 
52
53
 
53
54
  export default class Organisation extends CrudBase {
@@ -120,6 +121,14 @@ export default class Organisation extends CrudBase {
120
121
  return new OwnedResourceProxy(this.api, this, Layer);
121
122
  }
122
123
 
124
+ /**
125
+ * Get a proxy for layer groups linked to the organisation
126
+ * @returns {OwnedResourceProxy} - A proxy for accessing the resource
127
+ */
128
+ get layerGroups () {
129
+ return new OwnedResourceProxy(this.api, this, LayerGroup);
130
+ }
131
+
123
132
  /**
124
133
  * Get a proxy for jobs linked to the organisation, also known as company maps
125
134
  * @returns {SimpleResourceProxy} - A proxy for accessing the resource