Module pyinventory.api.file
Functions
def add_file(client: SymphonyClient, local_file_path: str, entity_type: str, entity_id: str, category: Union[str, NoneType] = None) -> NoneType
-
This function adds file to an entity of a given type.
Args
local_file_path
:str
- local system path to the file
entity_type
:str
- one of existing options ["LOCATION", "WORK_ORDER", "SITE_SURVEY", "EQUIPMENT"]
entity_id
:string
- valid entity ID
category
:Optional[string]
- file category name
Raises
FailedOperationException
- on operation failure
Example
location = client.get_location({("Country", "LS_IND_Prod_Copy")}) client.add_file( local_file_path="./document.pdf", entity_type="LOCATION", entity_id=location.id, category="category_name", )
def add_files(client: SymphonyClient, local_directory_path: str, entity_type: str, entity_id: str, category: Union[str, NoneType] = None) -> NoneType
-
This function adds all files located in folder to an entity of a given type.
Args
local_directory_path
:str
- local system path to the directory
entity_type
:str
- one of existing options ["LOCATION", "WORK_ORDER", "SITE_SURVEY", "EQUIPMENT"]
entity_id
:string
- valid entity ID
category
:Optional[string]
- file category name
Example
location = client.get_location({("Country", "LS_IND_Prod_Copy")}) client.add_files( local_directory_path="./documents_folder/", entity_type="LOCATION", entity_id=location.id, category="category_name", )
def add_location_image(client: SymphonyClient, local_file_path: str, location: Location) -> NoneType
-
This function adds image to existing location.
Args
local_file_path
:str
- local system path to the file
location (
Location
): existing location objectRaises
FailedOperationException
- on operation failure
Example
location = client.get_location({("Country", "LS_IND_Prod_Copy")}) client.add_location_image( local_file_path="./document.pdf", location=location, )
def add_site_survey_image(client: SymphonyClient, local_file_path: str, id: str) -> NoneType
-
This function adds image to existing site survey.
Args
local_file_path
:str
- local system path to the file
id
:str
- site survey ID
Raises
FailedOperationException
- on operation failure
Example
client.add_site_survey_image( local_file_path="./document.pdf", id="123456" )
def delete_document(client: SymphonyClient, document: Document) -> NoneType
-
This function deletes existing document.
Args
document (
Document
): document objectRaises
FailedOperationException
- on operation failure
Example
client.delete_document(document=document)
def delete_site_survey_image(client: SymphonyClient, survey: SiteSurvey) -> NoneType
-
This function deletes image from existing site survey.
Args
survey (
SiteSurvey
): site survey objectRaises
FailedOperationException
- on operation failure
Example
client.delete_site_survey_image(survey=survey)
def list_dir(directory_path: str) -> Generator[str, NoneType, NoneType]