client
module client
client
Global Variables
DEFAULT_API_VERSION
GIZA_TOKEN_VARIABLE
MODEL_URL_HEADER
API_KEY_HEADER
class ApiClient
ApiClient
Implementation of the API client to interact with core-services
method __init__
__init__
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
class UsersClient
UsersClient
Client to interact with users
endpoint.
method __init__
__init__
method create
create
Call the API to create a new user
Args:
user
(users.UserCreate): information used to create a new user
Returns:
users.UserResponse
: the created user information
method create_api_key
create_api_key
Call the API to create a new API key
Returns:
users.UserResponse
: the created user information
method me
me
Retrieve information about the current user. Must have a valid token to perform the operation, enforced by @auth
Returns:
users.UserResponse
: User information from the server
method request_reset_password_token
request_reset_password_token
Sends a request to the server to generate a password reset token. The token is sent to the user's email.
Args:
email
(str): The email of the user who wants to reset their password.
Returns:
Msg
: A message indicating the success or failure of the request.
method resend_email
resend_email
Resend the verification email to the user.
Args:
email
(EmailStr): The email of the user who wants to resend the verification email.
Returns:
Msg
: A message indicating the success or failure of the request.
method reset_password
reset_password
Resets the user's password using the provided token and new password.
Args:
token
(str): The password reset token sent to the user's email.new_password
(str): The new password the user wants to set.
Returns:
Msg
: A message indicating the success or failure of the password reset.
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
class EndpointsClient
EndpointsClient
Client to interact with endpoints
endpoint.
method __init__
__init__
method create
create
Create a new deployment.
Args:
endpoint_create
: Endpoint information to create
Returns: The recently created deployment information
method delete
delete
Delete an endpoint.
Args:
endpoint_id
: Endpoint identifier
method download_proof
download_proof
Download a proof.
Args:
proof_id
: Proof identifier
Returns: The proof binary file
method get
get
Get a deployment.
Args:
endpoint_id
: Endpoint identifier
Returns: The deployment information
method get_proof
get_proof
Return information about a specific proof. proof_if
is the identifier of the proof that can be a integer or the request id.
Returns: A proof created by the user
method list
list
List endpoints.
Returns: A list of endpoints created by the user
method list_jobs
list_jobs
List proofs.
Returns: A list of proofs created by the user
method list_proofs
list_proofs
List proofs.
Returns: A list of proofs created by the user
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
method verify_proof
verify_proof
Verify a proof.
Args:
endpoint_id
: Endpoint identifierproof_id
: Proof identifier
Returns: The verification response
class EndpointsClient
EndpointsClient
Client to interact with endpoints
endpoint.
method __init__
__init__
method create
create
Create a new deployment.
Args:
endpoint_create
: Endpoint information to create
Returns: The recently created deployment information
method delete
delete
Delete an endpoint.
Args:
endpoint_id
: Endpoint identifier
method download_proof
download_proof
Download a proof.
Args:
proof_id
: Proof identifier
Returns: The proof binary file
method get
get
Get a deployment.
Args:
endpoint_id
: Endpoint identifier
Returns: The deployment information
method get_proof
get_proof
Return information about a specific proof. proof_if
is the identifier of the proof that can be a integer or the request id.
Returns: A proof created by the user
method list
list
List endpoints.
Returns: A list of endpoints created by the user
method list_jobs
list_jobs
List proofs.
Returns: A list of proofs created by the user
method list_proofs
list_proofs
List proofs.
Returns: A list of proofs created by the user
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
method verify_proof
verify_proof
Verify a proof.
Args:
endpoint_id
: Endpoint identifierproof_id
: Proof identifier
Returns: The verification response
class TranspileClient
TranspileClient
Client to interact with users
endpoint.
method __init__
__init__
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
method transpile
transpile
Make a call to the API transpile endpoint with the model as a file.
Args:
f
(BinaryIO): model to send for transpilation
Returns:
Response
: raw response from the server with the transpiled model as a zip
method update_transpilation
update_transpilation
Make a call to the API transpile endpoint with the model as a file.
Args:
f
(BinaryIO): model to send for transpilation
Returns:
Response
: raw response from the server with the transpiled model as a zip
class ModelsClient
ModelsClient
Client to interact with models
endpoint.
method __init__
__init__
method create
create
Create a new model.
Args:
model_create
: Model information to create
Raises:
Exception
: if there is no upload Url
Returns:
Tuple[Model, str]
: the recently created model and a url, used to upload the model.
method get
get
Make a call to the API to retrieve model information.
Args:
model_id
: Model identfier to retrieve information
Returns:
Model
: model entity with the retrieved information
method get_by_name
get_by_name
Make a call to the API to retrieve model information by its name.
Args:
model_name
: Model name to retrieve information
Returns:
Model
: model entity with the retrieved information
method list
list
List all the models related to the user.
Returns: A list of models created by the user
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
method update
update
Update a model.
Args:
model_id
: Model identfier to retrieve informationmodel_update
: body to partially update the model
Returns:
Model
: the updated model
class JobsClient
JobsClient
Client to interact with jobs
endpoint.
method __init__
__init__
method create
create
Create a new job.
Args:
job_create
: Job information to createf
: filed to upload, a CASM json
Raises:
Exception
: if there is no upload Url
Returns:
Tuple[Model, str]
: the recently created model and a url, used to upload the model.
method get
get
Make a call to the API to retrieve job information.
Args:
job_id
: Job identfier to retrieve information
Returns:
Job
: job entity with the retrieved information
method list
list
List jobs.
Returns: A list of jobs created by the user
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
class VersionJobsClient
VersionJobsClient
Client to interact with jobs
endpoint.
method __init__
__init__
method create
create
Create a new job.
Args:
job_create
: Job information to createf
: filed to upload, a CASM json
Raises:
Exception
: if there is no upload Url
Returns:
Tuple[Model, str]
: the recently created model and a url, used to upload the model.
method get
get
Make a call to the API to retrieve job information.
Args:
job_id
: Job identfier to retrieve information
Returns:
Job
: job entity with the retrieved information
method list
list
List jobs.
Returns: A list of jobs created by the user
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
class ProofsClient
ProofsClient
Client to interact with proofs
endpoint.
method __init__
__init__
method download
download
Download a proof.
Args:
proof_id
: Proof identifier
Returns: The proof binary file
method get
get
Make a call to the API to retrieve proof information.
Args:
proof_id
: Proof identfier to retrieve information
Returns:
Proof
: proof entity with the desired information
method get_by_job_id
get_by_job_id
Make a call to the API to retrieve proof information based on the job id.
Args:
job_id
: Job identifier to query by.
Returns:
Proof
: proof entity with the desired information
method list
list
List all the proofs related to the user.
Returns: A list of proofs created by the user
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
method verify_proof
verify_proof
Verify a proof.
Args:
proof_id
: Proof identifier
Returns: The verification response
class VersionsClient
VersionsClient
Client to interact with versions
endpoint.
method __init__
__init__
method create
create
Create a new version.
Args:
model_id
: Model identifierversion_create
: Version information to create
Returns: The recently created version information
method download
download
Download a version.
Args:
model_id
: Model identifierversion_id
: Version identifierparams
: Additional parameters to pass to the request
Returns: The version binary file
method download_original
download_original
Download the original version.
Args:
model_id
: Model identifierversion_id
: Version identifier
Returns: The version binary file
method get
get
Get a version.
Args:
model_id
: Model identifierversion_id
: Version identifier
Returns: The version information
method list
list
List all the versions related to a model.
Args:
model_id
: Model identifier
Returns: A list of versions related to the model
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
method update
update
Update a specific version.
Args:
model_id
: Model identifierversion_id
: Version identifierversion_update
: Version information to update
Returns: The updated version information
method upload_cairo
upload_cairo
Get the Cairo model URL.
Args:
model_id
: Model identifierversion_id
: Version identifier
Returns: The Cairo model URL
class WorkspaceClient
WorkspaceClient
Client to interact with workspaces
endpoint.
method __init__
__init__
method create
create
Call the API to create a new workspace. If the workspace already exists it will return a 400.
Returns:
Workspace
: the created workspace information
method delete
delete
Call the API to delete the workspace. If the workspace does not exist it will return a 404.
Returns: None
method get
get
Make a call to the API to retrieve workspace information. Only one should exist.
Returns:
Workspace
: workspace information
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
class AgentsClient
AgentsClient
Client to interact with agents
endpoint.
method __init__
__init__
method create
create
Create a new agent.
Args:
agent_create
: Agent information to create
Returns: The recently created agent
method delete
delete
Delete an agent.
Args:
agent_id
: Agent identifier
method get
get
Get an agent.
Args:
agent_id
: Agent identifier
Returns: The agent information
method list
list
List endpoints.
Returns: A list of endpoints created by the user
method patch
patch
Update an agent.
Args:
agent_id
: Agent identifieragent_update
: Agent information to update
Returns: The updated agent information
method retrieve_api_key
retrieve_api_key
Retrieve the API key from the ~/.giza/.api_key.json
file.
Raises:
Exception
: if the file does not exist
Returns:
str
: the API key
method retrieve_token
retrieve_token
Get the JWT token.
First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
Args:
user
: if provided it will be used to check against current credentials and if provided withpassword
used to retrieve a new token.password
: if provided withuser
it will be used to retrieve a new token.renew
: for renewal of the JWT token by user login.
Raises:
Exception
: if token could not be retrieved in any way
Last updated