strongdoc.api package¶
account module¶
-
class
strongdoc.api.account.
Payment
(proto_payment)[source]¶ Bases:
object
-
billed_at
¶
-
period_start
¶
-
period_end
¶
-
-
strongdoc.api.account.
add_sharable_org
(token, orgid)[source]¶ Adds another org as a sharable org. This requires an administrator privilege.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the addition was a success.
Return type:
-
strongdoc.api.account.
change_user_password
(token, old_password, new_password)[source]¶ Change user password.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the change was a success.
Return type:
-
strongdoc.api.account.
demote_user
(token, userid)[source]¶ Removes admin privileges from a user. This requires an administrator privilege. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the demotion was a success.
Return type:
-
strongdoc.api.account.
get_account_info
(token)[source]¶ Gets account information such as subscription details, payments, sharable orgs, etc. This requires an administrator privilege.
Parameters: token (str) – The user JWT token. Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination. Returns: The account information Return type: AccountInfo
-
strongdoc.api.account.
get_user_info
(token)[source]¶ Gets information about the active user.
Parameters: token (str) – The user JWT token. Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination. Returns: The user information Return type: UserInfo
-
strongdoc.api.account.
list_users
(token)[source]¶ Lists the users of the active organization.
Parameters: token (str) – The user JWT token. Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination. Returns: A list of all the users in the organization. Return type: list(UserInfo)
-
strongdoc.api.account.
promote_user
(token, userid)[source]¶ Promotes a user to admin status. This requires an administrator privilege. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the promotion was a success.
Return type:
-
strongdoc.api.account.
register_user
(token, name, password, email, make_admin)[source]¶ Registers a user for the active organization. This requires an administrator privilege. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The userID of the new user.
Return type:
-
strongdoc.api.account.
remove_organization
(token, force)[source]¶ Removes an organization, deleting all data stored with the organization. This requires an administrator privilege. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the removal was a success.
Return type:
-
strongdoc.api.account.
remove_sharable_org
(token, orgid)[source]¶ Removes a sharable org. This requires an administrator privilege.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the removal was a success.
Return type:
-
strongdoc.api.account.
remove_user
(token, userid)[source]¶ Removes a user from the active organization. Deletes the user if this is the user’s only organization. This requires an administrator privilege. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The number of users removed.
Return type:
-
strongdoc.api.account.
set_account_info
(token, org_email, org_address)[source]¶ Set organization account info. This requires an administrator privilege.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the change was a success.
Return type:
-
strongdoc.api.account.
set_multilevel_sharing
(token, enable)[source]¶ Enables or disables multi-level sharing. This requires an administrator privilege.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the change was a success.
Return type:
document module¶
-
strongdoc.api.document.
decrypt_document
(token, docid, ciphertext)[source]¶ Decrypt a document using the service. The user must provide the ciphertext returned during the encryptDocument API call.
Parameters: - token (str) – The user JWT token.
- docid (str) – The ID of the document.
- ciphertext (bytes or io.BufferedIOBase (must be readable)) – The document ciphertext to be decrypted.
Returns: The decrypted plaintext content of the document.
Return type: Raises: - TypeError – If ciphertext is not of type
bytes
or typeio.BufferedIOBase
and readable. - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
-
strongdoc.api.document.
decrypt_document_stream
(token, docid, ciphertext, output_stream)[source]¶ Decrypt a document using the service. The user must provide the ciphertext returned during the encryptDocument API call.
Parameters: - token (str) – The user JWT token.
- docid (str) – The ID of the document.
- ciphertext (bytes or io.BufferedIOBase (must be readable)) – The document ciphertext to be decrypted.
- output_stream (io.BufferedIOBase (must be writable)) – The output stream the plaintext will be written to.
Return type: Raises: - TypeError – If ciphertext is not of type
bytes
or typeio.BufferedIOBase
and readable, or output_stream is not typeio.BufferedIOBase
and writable. - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
-
strongdoc.api.document.
download_document
(token, docid)[source]¶ Download a document from the service.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The downloaded document.
Return type:
-
strongdoc.api.document.
download_document_stream
(token, docid, output_stream)[source]¶ Download a document from the service.
Parameters: - token (str) – The user JWT token.
- docid (str) – The ID of the document.
- output_stream (io.BufferedIOBase (must be writable)) – The output stream the document will be written to.
Return type: Raises: - TypeError – If output_stream is not type
io.BufferedIOBase
and writable. - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
-
strongdoc.api.document.
encrypt_document
(token, doc_name, plaintext)[source]¶ Encrypts a document using the service, but do not store it. Instead return the encrypted ciphertext.
Parameters: - token (str) – The user JWT token.
- doc_name (str) – The name of the document.
- plaintext (bytes or io.BufferedIOBase (must be readable)) – The text of the document.
Raises: - TypeError – If plaintext is not of type
bytes
or typeio.BufferedIOBase
and readable. - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns:
-
strongdoc.api.document.
encrypt_document_stream
(token, doc_name, plaintext, output_stream)[source]¶ Encrypts a document using the service, but do not store it. Instead return the encrypted ciphertext.
Parameters: - token (str) – The user JWT token.
- doc_name (str) – The name of the document.
- plaintext (bytes or io.BufferedIOBase (must be readable)) – The text of the document.
- output_stream (io.BufferedIOBase (must be writable)) – The output stream the ciphertext will be written to.
Raises: - TypeError – If plaintext is not of type
bytes
or typeio.BufferedIOBase
and readable, or output_stream is not typeio.BufferedIOBase
and writable. - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The document ID for the uploaded document. This ID is needed to decrypt the document.
Return type:
-
strongdoc.api.document.
list_documents
(token)[source]¶ Lists the documents that are accessible to the active user.
Parameters: token (str) – The user JWT token. Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination. Returns: A list of documents Return type: list(DocumentMetadata)
-
strongdoc.api.document.
remove_document
(token, docid)[source]¶ Remove a document from the service.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the removal was a success.
Return type:
Shares a document with another user.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: Whether the share was a success.
Return type:
Unshares a document from another user.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The number of users unshared with.
Return type:
-
strongdoc.api.document.
upload_document
(token, doc_name, plaintext)[source]¶ Uploads a document to the service for storage.
Parameters: - token (str) – The user JWT token.
- doc_name (str) – The name of the document.
- plaintext (bytes or io.BufferedIOBase (must be readable)) – The text of the document.
Returns: The uploaded document ID.
Return type: Raises: - TypeError – If plaintext is not of type
bytes
or typeio.BufferedIOBase
and readable. - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
login module¶
-
strongdoc.api.login.
login
(userid, password, orgid)[source]¶ Verify the user and organization identity, and returns a JWT token for future API use. There must be a one second difference between logout and login. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The JWT token used to authenticate user/org when using StrongDoc APIs.
Return type:
search module¶
-
class
strongdoc.api.search.
DocumentResult
(docid, score)[source]¶ Bases:
object
A class that will hold a single document that matches the search result from the Search query.
-
strongdoc.api.search.
search
(token, query)[source]¶ Search for document that contains a specific word. A gRPC connection timeout will be implemented.
Parameters: Raises: grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
Returns: The hit list of the search.
Return type:
billing module¶
-
strongdoc.api.billing.
FREQ_MONTHLY
= 'MONTHLY'¶
-
strongdoc.api.billing.
FREQ_YEARLY
= 'YEARLY'¶
-
class
strongdoc.api.billing.
BillingFrequency
(_freq)[source]¶ Bases:
object
-
frequency
¶ str
(such asFREQ_MONTHLY
orFREQ_YEARLY
)
-
valid_from
¶
-
valid_to
¶
-
-
class
strongdoc.api.billing.
BillingDetails
(_details)[source]¶ Bases:
object
-
period_start
¶
-
period_end
¶
-
documents
¶
-
search
¶
-
traffic
¶
-
billing_frequency
¶
-
-
class
strongdoc.api.billing.
LargeTrafficDetails
(proto_large_traffic)[source]¶ Bases:
object
-
large_traffic_list
¶ list(
TrafficDetails
)
-
period_start
¶ datetime.datetime
- Start of the billing period
-
period_end
¶ datetime.datetime
- End of the billing period
-
-
strongdoc.api.billing.
get_billing_details
(token, at_time=None)[source]¶ Gets the billing details at a specified time, or the current time if no time is specified. This requires an administrator privilege.
Parameters: - token (str) – The user JWT token.
- at_time (datetime.datetime) – Optional UTC timestamp to check for billing details at. Defaults to current time.
Raises: - grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.
- ValueError – If at_time is not a valid datetime.
Returns: The requested billing details, or None if none are found for the specified time.
Return type:
-
strongdoc.api.billing.
get_large_traffic
(token, at_time=None)[source]¶ Gets a list of large traffic events (at least 512 MB in one direction) within a specified billing period. This requires an administrator privilege.
Parameters: - token (str) – The user JWT token.
- at_time (datetime.datetime) – Optional UTC timestamp which falls within the desired billing period. Defaults to current time.
Returns: The requested large traffic details, or None if none are found for the specified time.
Return type: Raises: - ValueError – If at_time is not a valid datetime.
- grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.