API¶
-
class
aiosnow.models.attachment.model.AttachmentModel(*args, **kwargs)[source]¶ Attachment API Model
-
delete(selection: Union[aiosnow.query.condition.Condition, str]) → aiosnow.request.response.Response¶ Delete matching record
Parameters: selection – Condition or ID Returns: Response
-
download(selection: Union[aiosnow.query.selector.Selector, aiosnow.query.condition.Condition, str], dst_dir: str = '.') → aiosnow.models.attachment.file.FileHandler[source]¶ Download file
Parameters: - selection – Attachment selection
- dst_dir – Destination directory
Returns: FileWriter
-
get(selection: Union[aiosnow.query.selector.Selector, aiosnow.query.condition.Condition, str] = None, **kwargs) → aiosnow.request.response.Response¶ Buffered many
Fetch and store the entire result in memory.
Note: It’s recommended to use the stream method when dealing with a large number of records.
Keyword Arguments: - selection – Aiosnow-compatible query
- limit (int) – Maximum number of records to return
- offset (int) – Starting record index
Returns: Response
-
get_object_id(value: Union[aiosnow.query.selector.Selector, aiosnow.query.condition.Condition, str]) → str¶ Get object id by str or Condition
Immediately return if value is of str type.
Parameters: value – Condition or str Returns: Object id
-
get_one(selection: Union[aiosnow.query.selector.Selector, aiosnow.query.condition.Condition, str] = None, **kwargs) → aiosnow.request.response.Response¶ Get one record
Parameters: selection – aiosnow-compatible query Returns: Response
-
stream(selection: Union[aiosnow.query.selector.Selector, aiosnow.query.condition.Condition, str] = None, **kwargs) → AsyncGenerator[T_co, T_contra]¶ Stream-like async generator
Chunk size determines the number of records to fetch in one go. Setting a lower chunk size decreases memory usage, but increases the number of requests sent to the server.
Keyword Arguments: - selection – aiosnow-compatible query
- limit (int) – Maximum number of records to return
- offset (int) – Starting record index
- page_size (int) – Number of records to fetch in one go
Yields: Chunk of records
-
upload(table_name: str, record_sys_id: str, file_name: str, dir_name: str) → aiosnow.request.response.Response[source]¶ Upload file
Parameters: - table_name – Table name, e.g. incident
- record_sys_id – Sys id of the record to attach to
- file_name – Source file name
- dir_name – Source directory name
Returns: ClientResponse
-