Files
FileService
Service which can be used to communicate with File type in UGC API.
To use this service, you need to instantiate it with a valid Move UGC client.
from move_ugc import MoveUgc
ugc = MoveUgc(api_key="my-api-key")
# Call file service methods directly
ugc.files.retrieve(id="file-<guid>")
# Or use the file service as a mixin
file_service = ugc.files
file_service.retrieve(id="file-<guid>")
create
create(file_type: str, name: Optional[str] = '', metadata: Optional[Dict[str, Any]] = None, expand: Optional[List[ALLOWED_EXPAND_ATTRS]] = None) -> FileType
Create a file with given file type in MoveUGC.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_type |
str
|
type of file to be created. Example: |
required |
name |
Optional[str]
|
name of the file. |
''
|
expand |
Optional[List[ALLOWED_EXPAND_ATTRS]]
|
list of fields to be expanded. Currently only |
None
|
metadata |
Optional[Dict[str, Any]]
|
metadata to be associated with the file. |
None
|
Returns:
Type | Description |
---|---|
FileType
|
File instance of Pydantic model type. |
retrieve
retrieve(id: str, expand: Optional[List[ALLOWED_EXPAND_ATTRS]] = None) -> FileType
Retrieve a file with given file_id from MoveUGC.
The unique id for file will usually be in the format: file-{uuid}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
unique identifier for the file. This should typically be something like |
required |
expand |
Optional[List[ALLOWED_EXPAND_ATTRS]]
|
list of fields to be expanded. Currently only |
None
|
Returns:
Type | Description |
---|---|
FileType
|
File instance of Pydantic model type. |
update
update(id: str, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, expand: Optional[List[ALLOWED_EXPAND_ATTRS]] = None) -> FileType
Update a file with given id in MoveUGC.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
unique identifier for the file. This should typically be something like |
required |
expand |
Optional[List[ALLOWED_EXPAND_ATTRS]]
|
list of fields to be expanded. Currently only |
None
|
metadata |
Optional[Dict[str, Any]]
|
metadata to be associated with the file. |
None
|
name |
Optional[str]
|
name of the file. |
None
|
Returns:
Type | Description |
---|---|
FileType
|
File instance of Pydantic model type. |
generate_share_code
generate_share_code(file_id: str) -> ShareCode
Generate a share code with given file_id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_id |
str
|
unique identifier for the file. This should typically be like |
required |
Returns:
Type | Description |
---|---|
ShareCode
|
ShareCode instance of Pydantic model type. |