Initialize ItemProperties from dict
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 1.2k
- Avg merge
- 2h 40m
- Merged PRs (30d)
- 2
Description
**Is your feature request related to a problem? Please describe.**
With the old deprecated contentmanager add function, it was possible to create a new PortalItem from a dict.
With the latest versions of ArcGIS API for Python we need to do this using a Folder and a ItemProperties object
In this case I cannot use my dict and I need to initialize the ItemProperties object.
There is no option to convert my dict to ItemProperties object and a dict unpack doesn't work
```python
item = {
"title":"Topo_RD",
"type":"Vector Tile Service",
"typeKeywords":["Data","Service","Vector Tile Service"],
"tags":["topo","rd","vector","tag"],
"url":"https://tiles.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Topo_RD/VectorTileServer"
}
item_props = ItemProperties(item)
TypeError: ItemProperties.__init__() missing 1 required positional argument: 'item_type'
item_props = ItemProperties(**item)
TypeError: ItemProperties.__init__() got an unexpected keyword argument 'type'
```
**Describe the solution you'd like**
A ItemProperties.from_dict static function would be lovely
```python
itemprops = ItemProperties.from_dict(item_dict)
```
**Describe alternatives you've considered**
Right now I just do a folder.add(item_dict) but this isn't officially supported according to the docs and for instance the tags are not set in a proper way
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
Assessment
This issue has not been assessed yet.