API Endpoints Wrapper Functions¶
cancel_transfer(client, job_id)
¶
Cancel a transfer job with a job_id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
EOSCClient
|
The API client. |
required |
job_id
|
str
|
Transfer job ID. |
required |
Returns:
Name | Type | Description |
---|---|---|
TransferStatus |
TransferStatus
|
The canceled transfer with its current status (canceled or any other final status). |
Source code in eosc_data_transfer_client/endpoints.py
105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
create_transfer(client, transfer)
¶
Initiate a new data transfer.
This function sends a POST
request to the EOSC Data Transfer API to create a new transfer job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
EOSCClient
|
An instance of |
required |
transfer
|
TransferRequest
|
A |
required |
Returns:
Name | Type | Description |
---|---|---|
TransferResponse |
TransferResponse
|
An object containing details about the submitted transfer, including job ID and status. |
Raises:
Type | Description |
---|---|
EOSCClientError
|
If the API returns a 4xx error (e.g., invalid input). |
EOSCServerError
|
If the API returns a 5xx error (e.g., internal server error). |
Source code in eosc_data_transfer_client/endpoints.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
get_transfer_field(client, job_id, field_name)
¶
Retrieve a specific field from a transfer job, using TransferStatus model for type resolution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
EOSCClient
|
The API client. |
required |
job_id
|
str
|
Transfer job ID. |
required |
field_name
|
str
|
Field to retrieve. |
required |
Returns:
Type | Description |
---|---|
Union[str, int, bool, dict, datetime]
|
The value of the requested field, properly typed. |
Raises:
Type | Description |
---|---|
ValueError
|
If the field name is invalid or type conversion fails. |
Source code in eosc_data_transfer_client/endpoints.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
get_transfer_status(client, transfer_id)
¶
Retrieve the status of a transfer job.
This function sends a GET
request to the API to fetch full details about a specific transfer job
using its job ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
EOSCClient
|
An instance of |
required |
transfer_id
|
str
|
The ID of the transfer job to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
TransferStatus |
TransferStatus
|
An object with detailed information about the job, including state, timestamps, and metadata. |
Raises:
Type | Description |
---|---|
EOSCClientError
|
If the job ID is invalid or not found. |
EOSCServerError
|
If the API encounters an internal issue. |
Source code in eosc_data_transfer_client/endpoints.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
get_user_info(client)
¶
Retrieve user information from the EOSC Data Transfer service.
Returns:
Name | Type | Description |
---|---|---|
UserInfo |
UserInfo
|
Metadata about the current user, including identity, VO membership, and permissions. |
Source code in eosc_data_transfer_client/endpoints.py
153 154 155 156 157 158 159 160 161 |
|
list_transfers(client, **filters)
¶
Find transfers matching search criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
EOSCClient
|
The API client. |
required |
**filters
|
Optional[Any]
|
Optional query parameters to filter the search. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
TransferStatusList |
TransferStatusList
|
A list of transfers matching the criteria. |
Source code in eosc_data_transfer_client/endpoints.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
parse_doi(client, doi)
¶
Parse a PID (e.g., DOI) and retrieve associated file metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid
|
str
|
The persistent identifier to parse. |
required |
Returns:
Name | Type | Description |
---|---|---|
StorageContent |
StorageContent
|
Parsed metadata including a list of files |
Raises:
Type | Description |
---|---|
EOSCClientError
|
For 4xx errors. |
EOSCServerError
|
For 5xx errors. |
EOSCRequestError
|
For network issues. |
Source code in eosc_data_transfer_client/endpoints.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|