geobox 2.2.6__tar.gz → 2.4.0__tar.gz

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 (110) hide show
  1. {geobox-2.2.6 → geobox-2.4.0}/PKG-INFO +2 -2
  2. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/api.py +265 -6
  3. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/apikey.py +0 -26
  4. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/attachment.py +5 -31
  5. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/basemap.py +2 -30
  6. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/dashboard.py +0 -26
  7. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/feature.py +172 -17
  8. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/field.py +0 -27
  9. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/file.py +0 -26
  10. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/layout.py +0 -26
  11. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/log.py +0 -27
  12. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/map.py +0 -26
  13. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/model3d.py +0 -26
  14. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/mosaic.py +0 -26
  15. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/plan.py +0 -26
  16. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/query.py +0 -26
  17. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/raster.py +0 -26
  18. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/scene.py +1 -26
  19. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/settings.py +0 -28
  20. geobox-2.4.0/geobox/aio/table.py +1733 -0
  21. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/task.py +0 -27
  22. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/tile3d.py +0 -26
  23. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/tileset.py +1 -26
  24. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/usage.py +0 -32
  25. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/user.py +0 -59
  26. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/vector_tool.py +49 -0
  27. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/vectorlayer.py +8 -34
  28. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/version.py +1 -25
  29. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/view.py +5 -35
  30. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/workflow.py +0 -26
  31. {geobox-2.2.6 → geobox-2.4.0}/geobox/api.py +265 -5
  32. {geobox-2.2.6 → geobox-2.4.0}/geobox/apikey.py +0 -26
  33. {geobox-2.2.6 → geobox-2.4.0}/geobox/attachment.py +0 -26
  34. {geobox-2.2.6 → geobox-2.4.0}/geobox/basemap.py +0 -28
  35. {geobox-2.2.6 → geobox-2.4.0}/geobox/dashboard.py +0 -26
  36. {geobox-2.2.6 → geobox-2.4.0}/geobox/enums.py +15 -1
  37. {geobox-2.2.6 → geobox-2.4.0}/geobox/feature.py +170 -15
  38. {geobox-2.2.6 → geobox-2.4.0}/geobox/field.py +20 -37
  39. {geobox-2.2.6 → geobox-2.4.0}/geobox/file.py +0 -26
  40. {geobox-2.2.6 → geobox-2.4.0}/geobox/layout.py +0 -26
  41. {geobox-2.2.6 → geobox-2.4.0}/geobox/log.py +0 -26
  42. {geobox-2.2.6 → geobox-2.4.0}/geobox/map.py +0 -26
  43. {geobox-2.2.6 → geobox-2.4.0}/geobox/model3d.py +0 -26
  44. {geobox-2.2.6 → geobox-2.4.0}/geobox/mosaic.py +0 -26
  45. {geobox-2.2.6 → geobox-2.4.0}/geobox/plan.py +1 -26
  46. {geobox-2.2.6 → geobox-2.4.0}/geobox/query.py +1 -26
  47. {geobox-2.2.6 → geobox-2.4.0}/geobox/raster.py +1 -31
  48. {geobox-2.2.6 → geobox-2.4.0}/geobox/scene.py +1 -27
  49. {geobox-2.2.6 → geobox-2.4.0}/geobox/settings.py +1 -29
  50. geobox-2.4.0/geobox/table.py +1719 -0
  51. {geobox-2.2.6 → geobox-2.4.0}/geobox/task.py +2 -29
  52. {geobox-2.2.6 → geobox-2.4.0}/geobox/tile3d.py +0 -26
  53. {geobox-2.2.6 → geobox-2.4.0}/geobox/tileset.py +1 -26
  54. {geobox-2.2.6 → geobox-2.4.0}/geobox/usage.py +2 -33
  55. {geobox-2.2.6 → geobox-2.4.0}/geobox/user.py +1 -59
  56. {geobox-2.2.6 → geobox-2.4.0}/geobox/vector_tool.py +49 -0
  57. {geobox-2.2.6 → geobox-2.4.0}/geobox/vectorlayer.py +9 -36
  58. {geobox-2.2.6 → geobox-2.4.0}/geobox/version.py +1 -26
  59. {geobox-2.2.6 → geobox-2.4.0}/geobox/view.py +4 -34
  60. {geobox-2.2.6 → geobox-2.4.0}/geobox/workflow.py +1 -26
  61. {geobox-2.2.6 → geobox-2.4.0}/geobox.egg-info/PKG-INFO +2 -2
  62. {geobox-2.2.6 → geobox-2.4.0}/geobox.egg-info/SOURCES.txt +3 -0
  63. {geobox-2.2.6 → geobox-2.4.0}/pyproject.toml +2 -2
  64. {geobox-2.2.6 → geobox-2.4.0}/tests/test_api.py +142 -3
  65. {geobox-2.2.6 → geobox-2.4.0}/tests/test_apikey.py +1 -6
  66. {geobox-2.2.6 → geobox-2.4.0}/tests/test_attachment.py +0 -6
  67. {geobox-2.2.6 → geobox-2.4.0}/tests/test_basemap.py +0 -6
  68. {geobox-2.2.6 → geobox-2.4.0}/tests/test_dashboard.py +0 -6
  69. {geobox-2.2.6 → geobox-2.4.0}/tests/test_feature.py +251 -4
  70. {geobox-2.2.6 → geobox-2.4.0}/tests/test_field.py +1 -11
  71. {geobox-2.2.6 → geobox-2.4.0}/tests/test_file.py +1 -6
  72. {geobox-2.2.6 → geobox-2.4.0}/tests/test_layout.py +0 -6
  73. {geobox-2.2.6 → geobox-2.4.0}/tests/test_log.py +0 -6
  74. {geobox-2.2.6 → geobox-2.4.0}/tests/test_map.py +0 -6
  75. {geobox-2.2.6 → geobox-2.4.0}/tests/test_model3d.py +0 -6
  76. {geobox-2.2.6 → geobox-2.4.0}/tests/test_mosaic.py +0 -6
  77. {geobox-2.2.6 → geobox-2.4.0}/tests/test_plan.py +1 -6
  78. {geobox-2.2.6 → geobox-2.4.0}/tests/test_query.py +0 -6
  79. {geobox-2.2.6 → geobox-2.4.0}/tests/test_raster.py +0 -6
  80. {geobox-2.2.6 → geobox-2.4.0}/tests/test_scene.py +0 -6
  81. {geobox-2.2.6 → geobox-2.4.0}/tests/test_settings.py +0 -6
  82. geobox-2.4.0/tests/test_table.py +936 -0
  83. {geobox-2.2.6 → geobox-2.4.0}/tests/test_task.py +0 -6
  84. {geobox-2.2.6 → geobox-2.4.0}/tests/test_tile3d.py +0 -6
  85. {geobox-2.2.6 → geobox-2.4.0}/tests/test_tileset.py +0 -6
  86. {geobox-2.2.6 → geobox-2.4.0}/tests/test_usage.py +0 -7
  87. {geobox-2.2.6 → geobox-2.4.0}/tests/test_user.py +0 -14
  88. {geobox-2.2.6 → geobox-2.4.0}/tests/test_vector_tool.py +21 -0
  89. {geobox-2.2.6 → geobox-2.4.0}/tests/test_vectorlayer.py +4 -11
  90. {geobox-2.2.6 → geobox-2.4.0}/tests/test_version.py +0 -6
  91. {geobox-2.2.6 → geobox-2.4.0}/tests/test_view.py +2 -14
  92. {geobox-2.2.6 → geobox-2.4.0}/tests/test_workflow.py +0 -6
  93. {geobox-2.2.6 → geobox-2.4.0}/LICENSE +0 -0
  94. {geobox-2.2.6 → geobox-2.4.0}/README.md +0 -0
  95. {geobox-2.2.6 → geobox-2.4.0}/geobox/__init__.py +0 -0
  96. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/__init__.py +0 -0
  97. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/base.py +0 -0
  98. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/raster_analysis.py +0 -0
  99. {geobox-2.2.6 → geobox-2.4.0}/geobox/aio/route.py +0 -0
  100. {geobox-2.2.6 → geobox-2.4.0}/geobox/base.py +0 -0
  101. {geobox-2.2.6 → geobox-2.4.0}/geobox/exception.py +0 -0
  102. {geobox-2.2.6 → geobox-2.4.0}/geobox/raster_analysis.py +0 -0
  103. {geobox-2.2.6 → geobox-2.4.0}/geobox/route.py +0 -0
  104. {geobox-2.2.6 → geobox-2.4.0}/geobox/utils.py +0 -0
  105. {geobox-2.2.6 → geobox-2.4.0}/geobox.egg-info/dependency_links.txt +0 -0
  106. {geobox-2.2.6 → geobox-2.4.0}/geobox.egg-info/requires.txt +0 -0
  107. {geobox-2.2.6 → geobox-2.4.0}/geobox.egg-info/top_level.txt +0 -0
  108. {geobox-2.2.6 → geobox-2.4.0}/setup.cfg +0 -0
  109. {geobox-2.2.6 → geobox-2.4.0}/tests/test_raster_analysis.py +0 -0
  110. {geobox-2.2.6 → geobox-2.4.0}/tests/test_route.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.6
4
- Summary: SDK for Geobox's APIs
3
+ Version: 2.4.0
4
+ Summary: Python SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://geobox.ir
@@ -3,7 +3,7 @@ import asyncio
3
3
  import logging
4
4
  import os
5
5
  from urllib.parse import urljoin
6
- from typing import Dict, List, Union, Any
6
+ from typing import Dict, List, Union, Any, Optional
7
7
  from datetime import datetime
8
8
 
9
9
  from .vectorlayer import AsyncVectorLayer, LayerType
@@ -32,6 +32,7 @@ from .attachment import AsyncAttachment
32
32
  from .apikey import AsyncApiKey
33
33
  from .log import AsyncLog
34
34
  from .usage import AsyncUsage, UsageScale, UsageParam
35
+ from .table import AsyncTable, AsyncRelationship, RelationshipCardinality, RelationshipEndpoint
35
36
  from ..exception import AuthenticationError, ApiRequestError, NotFoundError, ValidationError, ServerError, AuthorizationError
36
37
  from ..utils import join_url_params
37
38
 
@@ -129,11 +130,10 @@ class AsyncGeoboxClient:
129
130
  """
130
131
  Constructs all the necessary attributes for the Api object.
131
132
  """
132
- self.username = os.getenv('GEOBOX_USERNAME') if os.getenv('GEOBOX_USERNAME') else username
133
- self.password = os.getenv('GEOBOX_PASSWORD') if os.getenv('GEOBOX_PASSWORD') else password
134
- self.access_token = os.getenv('GEOBOX_ACCESS_TOKEN') if os.getenv('GEOBOX_ACCESS_TOKEN') else access_token
135
- self.apikey = os.getenv('GEOBOX_APIKEY') if os.getenv('GEOBOX_APIKEY') else apikey
136
-
133
+ self.username = username if username else os.getenv('GEOBOX_USERNAME')
134
+ self.password = password if password else os.getenv('GEOBOX_PASSWORD')
135
+ self.access_token = access_token if access_token else os.getenv('GEOBOX_ACCESS_TOKEN')
136
+ self.apikey = apikey if apikey else os.getenv('GEOBOX_APIKEY')
137
137
  self.session = AsyncRequestSession(access_token=self.access_token)
138
138
 
139
139
  host = host.lower()
@@ -2654,3 +2654,262 @@ class AsyncGeoboxClient:
2654
2654
  >>> await client.update_usage()
2655
2655
  """
2656
2656
  return await AsyncUsage.update_usage(self, user_id=user_id)
2657
+
2658
+
2659
+ async def get_tables(self, **kwargs) -> Union[List['AsyncTable'], int]:
2660
+ """
2661
+ [async] Get list of tables with optional filtering and pagination.
2662
+
2663
+ Keyword Args:
2664
+ include_settings (bool): Whether to include table settings. default: False
2665
+ temporary (bool): Whether to return temporary tables. default: False
2666
+ q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
2667
+ search (str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored
2668
+ search_fields (str): comma separated list of fields for searching
2669
+ order_by (str): comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: "A" denotes ascending order and "D" denotes descending order.
2670
+ return_count (bool): Whether to return total count. default: False.
2671
+ skip (int): Number of items to skip. default: 0
2672
+ limit (int): Number of items to return. default: 10
2673
+ user_id (int): Specific user. privileges required
2674
+ shared (bool): Whether to return shared tables. default: False
2675
+
2676
+ Returns:
2677
+ List[AsyncTable] | int: A list of table instances or the total number of tables.
2678
+
2679
+ Example:
2680
+ >>> from geobox.aio import AsyncGeoboxClient
2681
+ >>> async with AsyncGeoboxClient() as client:
2682
+ >>> tables = await client.get_tables(q="name LIKE '%My table%'")
2683
+ """
2684
+ return await AsyncTable.get_tables(self, **kwargs)
2685
+
2686
+
2687
+ async def create_table(self,
2688
+ name: str,
2689
+ display_name: Optional[str] = None,
2690
+ description: Optional[str] = None,
2691
+ temporary: bool = False,
2692
+ fields: Optional[List[Dict]] = None,
2693
+ ) -> 'AsyncTable':
2694
+ """
2695
+ [async] Create a new table.
2696
+
2697
+ Args:
2698
+ name (str): The name of the Table.
2699
+ display_name (str, optional): The display name of the table.
2700
+ description (str, optional): The description of the table.
2701
+ temporary (bool, optional): Whether to create a temporary tables. default: False
2702
+ fields (List[Dict], optional): raw table fields. you can use add_field method for simpler and safer field addition. required dictionary keys: name, datatype
2703
+
2704
+ Returns:
2705
+ AsyncTable: The newly created table instance.
2706
+
2707
+ Raises:
2708
+ ValidationError: If the table data is invalid.
2709
+
2710
+ Example:
2711
+ >>> from geobox.aio import AsyncGeoboxClient
2712
+ >>> async with AsyncGeoboxClient() as client:
2713
+ >>> table = await client.create_table(name="my_table")
2714
+ """
2715
+ return await AsyncTable.create_table(self,
2716
+ name=name,
2717
+ display_name=display_name,
2718
+ description=description,
2719
+ temporary=temporary,
2720
+ fields=fields,
2721
+ )
2722
+
2723
+
2724
+ async def get_table(self,
2725
+ uuid: str,
2726
+ user_id: int = None,
2727
+ ) -> 'AsyncTable':
2728
+ """
2729
+ [async] Get a table by UUID.
2730
+
2731
+ Args:
2732
+ uuid (str): The UUID of the table to get.
2733
+ user_id (int): Specific user. privileges required.
2734
+
2735
+ Returns:
2736
+ AsyncTable: The Table object.
2737
+
2738
+ Raises:
2739
+ NotFoundError: If the table with the specified UUID is not found.
2740
+
2741
+ Example:
2742
+ >>> from geobox.aio import AsyncGeoboxClient
2743
+ >>> async with AsyncGeoboxClient() as client:
2744
+ >>> table = await client.get_table(uuid="12345678-1234-5678-1234-567812345678")
2745
+ """
2746
+ return await AsyncTable.get_table(self, uuid, user_id)
2747
+
2748
+
2749
+ async def get_table_by_name(self,
2750
+ name: str,
2751
+ user_id: int = None,
2752
+ ) -> Union['AsyncTable', None]:
2753
+ """
2754
+ [async] Get a table by name
2755
+
2756
+ Args:
2757
+ name (str): the name of the table to get
2758
+ user_id (int, optional): specific user. privileges required.
2759
+
2760
+ Returns:
2761
+ AsyncTable | None: returns the table if a table matches the given name, else None
2762
+
2763
+ Example:
2764
+ >>> from geobox.aio import AsybcGeoboxClient
2765
+ >>> async with AsyncGeoboxClient() as client:
2766
+ >>> table = await client.get_table_by_name(name='test')
2767
+ """
2768
+ return await AsyncTable.get_table_by_name(self, name, user_id)
2769
+
2770
+
2771
+ async def get_relationships(
2772
+ self,
2773
+ **kwargs,
2774
+ ) -> Union[List['AsyncRelationship'], int]:
2775
+ """
2776
+ [async] Get a list of relationships with optional filtering and pagination.
2777
+
2778
+ Keyword Args:
2779
+ q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
2780
+ search (str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored
2781
+ search_fields (str): comma separated list of fields for searching
2782
+ order_by (str): comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: "A" denotes ascending order and "D" denotes descending order.
2783
+ return_count (bool): Whether to return total count. default: False.
2784
+ skip (int): Number of items to skip. default: 0
2785
+ limit (int): Number of items to return. default: 10
2786
+ user_id (int): Specific user. privileges required
2787
+ shared (bool): Whether to return shared tables. default: False
2788
+
2789
+ Returns:
2790
+ List[AsyncRelationship] | int: A list of relationship instances or the total number of relationships.
2791
+
2792
+ Example:
2793
+ >>> from geobox.aio import AsyncGeoboxClient
2794
+ >>> async with AsyncGeoboxClient() as client:
2795
+ >>> relationships = await client.get_relationships(q="name LIKE '%My relationship%'")
2796
+ """
2797
+ return await AsyncRelationship.get_relationships(self, **kwargs)
2798
+
2799
+
2800
+ async def create_relationship(
2801
+ self,
2802
+ name: str,
2803
+ cardinality: 'RelationshipCardinality',
2804
+ *,
2805
+ source: 'RelationshipEndpoint',
2806
+ target: 'RelationshipEndpoint',
2807
+ relation_table: Optional['AsyncTable'] = None,
2808
+ display_name: Optional[str] = None,
2809
+ description: Optional[str] = None,
2810
+ user_id: Optional[int] = None,
2811
+ ) -> 'AsyncRelationship':
2812
+ """
2813
+ [async] Create a new AsyncRelationship
2814
+
2815
+ Args:
2816
+ name (str): name of the relationship
2817
+ cardinality (RelationshipCardinality): One to One, One to Many, or Many to Many
2818
+
2819
+ Keyword Args:
2820
+ source (RelationshipEndpoint): Definition of the source side of the relationship, including the table (or layer), field, and foreign-key field
2821
+ target (RelationshipEndpoint): Definition of the target side of the relationship, including the table (or layer), field, and foreign-key field
2822
+ relation_table (AsyncTable, optional): The table that stores the relationship metadata or join records. (Required for Many-to-Many relationships)
2823
+ display_name (str, optional): Human-readable name for the relationship
2824
+ description (str, optional): the description of the relationship
2825
+ user_id (int, optional): Specific user. privileges required.
2826
+
2827
+ Returns:
2828
+ AsyncRelationship: a relationship instance
2829
+
2830
+ Example:
2831
+ >>> from geobox.aio import AsyncGeoboxClient
2832
+ >>> from geobox.aio.table import RelationshipEndpoint, RelationshipCardinality
2833
+ >>> async with AsyncGeoboxClient() as client:
2834
+ >>> source = RelationshipEndpoint(
2835
+ ... table=client.get_table_by_name('owner'),
2836
+ ... field="name", # on source table
2837
+ ... fk_field="book_name", # on relation table
2838
+ ... )
2839
+ >>> target = RelationshipEndpoint(
2840
+ ... table=client.get_table_by_name('parcel'),
2841
+ ... field="name", # on target table
2842
+ ... fk_field="author_name", # on relation table
2843
+ ... )
2844
+ >>> relationship = await client.create_relationship(
2845
+ ... name="owner_parcel",
2846
+ ... cardinality=RelationshipCardinality.ManytoMany,
2847
+ ... source=source,
2848
+ ... target=target,
2849
+ ... relation_table=client.get_table_by_name('owner_parcel'),
2850
+ ... )
2851
+ """
2852
+ return await AsyncRelationship.create_relationship(
2853
+ self,
2854
+ name=name,
2855
+ cardinality=cardinality,
2856
+ source=source,
2857
+ target=target,
2858
+ relation_table=relation_table,
2859
+ display_name=display_name,
2860
+ description=description,
2861
+ user_id=user_id,
2862
+ )
2863
+
2864
+
2865
+ async def get_relationship(
2866
+ self,
2867
+ uuid: str,
2868
+ user_id: Optional[int] = None,
2869
+ ) -> 'AsyncRelationship':
2870
+ """
2871
+ [async] Get a relationship by UUID.
2872
+
2873
+ Args:
2874
+ uuid (str): The UUID of the relationship to get.
2875
+ user_id (int, optional): Specific user. privileges required.
2876
+
2877
+ Returns:
2878
+ AsyncRelationship: The AsyncRelationship object.
2879
+
2880
+ Raises:
2881
+ NotFoundError: If the AsyncRelationship with the specified UUID is not found.
2882
+
2883
+ Example:
2884
+ >>> from geobox.aio import AsyncGeoboxClient
2885
+ >>> async with AsyncGeoboxClient() as client:
2886
+ >>> relationship = await client.get_relationship(uuid="12345678-1234-5678-1234-567812345678")
2887
+ """
2888
+ return await AsyncRelationship.get_relationship(
2889
+ self,
2890
+ uuid=uuid,
2891
+ user_id=user_id,
2892
+ )
2893
+
2894
+
2895
+ async def get_relationship_by_name(
2896
+ self,
2897
+ name: str,
2898
+ user_id: Optional[int] = None,
2899
+ ) -> Union['AsyncRelationship', None]:
2900
+ """
2901
+ [async] Get a relationship by name
2902
+
2903
+ Args:
2904
+ name (str): the name of the relationship to get
2905
+ user_id (int, optional): specific user. privileges required.
2906
+
2907
+ Returns:
2908
+ AsyncRelationship | None: returns the relationship if a relationship matches the given name, else None
2909
+
2910
+ Example:
2911
+ >>> from geobox.aio import AsyncGeoboxClient
2912
+ >>> async with AsyncGeoboxClient() as client:
2913
+ >>> relationship = await client.get_relationship_by_name(name='test')
2914
+ """
2915
+ return await AsyncRelationship.get_relationship_by_name(self, name=name, user_id=user_id)
@@ -6,8 +6,6 @@ from ..utils import clean_data
6
6
 
7
7
  if TYPE_CHECKING:
8
8
  from . import AsyncGeoboxClient
9
- from ..api import GeoboxClient
10
- from ..apikey import ApiKey
11
9
 
12
10
 
13
11
  class AsyncApiKey(AsyncBase):
@@ -237,27 +235,3 @@ class AsyncApiKey(AsyncBase):
237
235
  endpoint = f"{self.endpoint}/grant"
238
236
  await self.api.post(endpoint)
239
237
  self.data['revoked'] = False
240
-
241
-
242
- def to_sync(self, sync_client: 'GeoboxClient') -> 'ApiKey':
243
- """
244
- Switch to sync version of the apikey instance to have access to the sync methods
245
-
246
- Args:
247
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
248
-
249
- Returns:
250
- ApiKey: the sync instance of the apikey.
251
-
252
- Example:
253
- >>> from geobox import Geoboxclient
254
- >>> from geobox.aio import AsyncGeoboxClient
255
- >>> from geobox.aio.apikey import AsyncApiKey
256
- >>> client = GeoboxClient()
257
- >>> async with AsyncGeoboxClient() as async_client:
258
- >>> apikey = await AsyncApiKey.get_apikey(async_client, key_id=1)
259
- >>> sync_apikey = apikey.to_sync(client)
260
- """
261
- from ..apikey import ApiKey
262
-
263
- return ApiKey(api=sync_client, key_id=self.key_id, data=self.data)
@@ -10,9 +10,7 @@ from ..utils import clean_data
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from . import AsyncGeoboxClient
13
- from .feature import Feature
14
- from ..api import GeoboxClient
15
- from ..attachment import Attachment
13
+ from .feature import AsyncFeature
16
14
 
17
15
 
18
16
  class AsyncAttachment(AsyncBase):
@@ -126,8 +124,8 @@ class AsyncAttachment(AsyncBase):
126
124
  loc_x: int,
127
125
  loc_y: int,
128
126
  resource: Union['AsyncMap', 'AsyncVectorLayer', 'AsyncVectorLayerView'],
129
- file: 'File',
130
- feature: 'Feature' = None,
127
+ file: 'AsyncFile',
128
+ feature: 'AsyncFeature' = None,
131
129
  display_name: str = None,
132
130
  description: str = None, ) -> 'AsyncAttachment':
133
131
  """
@@ -139,8 +137,8 @@ class AsyncAttachment(AsyncBase):
139
137
  loc_x (int): x parameter of the attachment location.
140
138
  loc_y (int): y parameter of the attachment location.
141
139
  resource (AsyncMap | AsyncVectorLayer | AsyncVectorLayerView): the resource object.
142
- file (File): the file object.
143
- feature (Feature, optional): the feature object.
140
+ file (AsyncFile): the file object.
141
+ feature (AsyncFeature, optional): the feature object.
144
142
  display_name (str, optional): The display name of the scene.
145
143
  description (str, optional): The description of the scene.
146
144
 
@@ -315,27 +313,3 @@ class AsyncAttachment(AsyncBase):
315
313
  >>> attachment.thumbnail
316
314
  """
317
315
  return super()._thumbnail(format='')
318
-
319
-
320
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Attachment':
321
- """
322
- Switch to sync version of the attachment instance to have access to the sync methods
323
-
324
- Args:
325
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
326
-
327
- Returns:
328
- Attachment: the sync instance of the attachment.
329
-
330
- Example:
331
- >>> from geobox import Geoboxclient
332
- >>> from geobox.aio import AsyncGeoboxClient
333
- >>> from geobox.aio.attachment import AsyncAttachment
334
- >>> client = GeoboxClient()
335
- >>> async with AsyncGeoboxClient() as async_client:
336
- >>> attachment = await AsyncAttachment.get_attachment(async_client, uuid="12345678-1234-5678-1234-567812345678")
337
- >>> sync_attachment = attachment.to_sync(client)
338
- """
339
- from ..attachment import Attachment
340
-
341
- return Attachment(api=sync_client, attachment_id=self.attachment_id, data=self.data)
@@ -7,8 +7,6 @@ from ..utils import clean_data
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from . import AsyncGeoboxClient
10
- from ..api import GeoboxClient
11
- from ..basemap import Basemap
12
10
 
13
11
 
14
12
  class AsyncBasemap(AsyncBase):
@@ -143,12 +141,12 @@ class AsyncBasemap(AsyncBase):
143
141
 
144
142
 
145
143
  @classmethod
146
- async def proxy_basemap(cls, api: 'response', url: str) -> None:
144
+ async def proxy_basemap(cls, api: 'AsyncGeoboxClient', url: str) -> None:
147
145
  """
148
146
  [async] Proxy the basemap
149
147
 
150
148
  Args:
151
- api (GeoboxClient): The GeoboxClient instance for making requests.
149
+ api (AsyncGeoboxClient): The GeoboxClient instance for making requests.
152
150
  url (str): the proxy server url.
153
151
 
154
152
  Returns:
@@ -168,29 +166,3 @@ class AsyncBasemap(AsyncBase):
168
166
  query_string = urlencode(param)
169
167
  endpoint = urljoin(cls.BASE_ENDPOINT, f"?{query_string}")
170
168
  await api.get(endpoint)
171
-
172
-
173
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Basemap':
174
- """
175
- Switch to sync version of the basemap instance to have access to the sync methods
176
-
177
- Args:
178
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
179
-
180
- Returns:
181
- Basemap: the sync instance of the basemap.
182
-
183
- Example:
184
- >>> from geobox import Geoboxclient
185
- >>> from geobox.aio import AsyncGeoboxClient
186
- >>> from geobox.aio.basemap import AsyncBasemap
187
- >>> client = GeoboxClient()
188
- >>> async with AsyncGeoboxClient() as async_client:
189
- >>> basemap = await AsyncBasemap.get_basemap(async_client, name='test')
190
- or
191
- >>> basemap = await async_client.get_basemap(name='test')
192
- >>> sync_basemap = basemap.to_sync(client)
193
- """
194
- from ..basemap import Basemap
195
-
196
- return Basemap(api=sync_client, data=self.data)
@@ -5,8 +5,6 @@ from .base import AsyncBase
5
5
  if TYPE_CHECKING:
6
6
  from . import AsyncGeoboxClient
7
7
  from .user import AsyncUser
8
- from ..api import GeoboxClient
9
- from ..dashboard import Dashboard
10
8
 
11
9
 
12
10
  class AsyncDashboard(AsyncBase):
@@ -314,27 +312,3 @@ class AsyncDashboard(AsyncBase):
314
312
  'limit': limit
315
313
  }
316
314
  return await super()._get_shared_users(self.endpoint, params)
317
-
318
-
319
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Dashboard':
320
- """
321
- Switch to sync version of the dashboard instance to have access to the sync methods
322
-
323
- Args:
324
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
325
-
326
- Returns:
327
- Dashboard: the sync instance of the dashboard.
328
-
329
- Example:
330
- >>> from geobox import Geoboxclient
331
- >>> from geobox.aio import AsyncGeoboxClient
332
- >>> from geobox.aio.dashboard import AsyncDashboard
333
- >>> client = GeoboxClient()
334
- >>> async with AsyncGeoboxClient() as async_client:
335
- >>> dashboard = await AsyncDashboard.get_dashboard(async_client, uuid="12345678-1234-5678-1234-567812345678")
336
- >>> sync_dashboard = dashboard.to_sync(client)
337
- """
338
- from ..dashboard import Dashboard
339
-
340
- return Dashboard(api=sync_client, uuid=self.uuid, data=self.data)