Update documentation and add autodoc typehints

This commit is contained in:
2024-01-31 11:00:51 -05:00
parent 425f6479c4
commit e5840bdc02
3 changed files with 91 additions and 143 deletions
+2
View File
@@ -26,6 +26,8 @@ extensions = [
"sphinx.ext.autosectionlabel",
]
autodoc_typehints = "signature"
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
+23 -93
View File
@@ -19,14 +19,14 @@ With ``neon_client``, developers can:
- Enhance application security by managing API keys and permissions through code.
- Leverage the power of Neon's cloud database without the need for manual intervention or the Neon console.
This project simplifies the complexity of interacting with the Neon API, making it more accessible for developers to
build scalable, data-driven applications with ease. Pydantic dataclasses are used to represent the data structures returned
by the API, and the client provides a relatively transparent interface to the Neon API.
.. note::
This documentation is a work in progress. It is not yet complete.
This project simplifies the complexity of interacting with the Neon API, making it more accessible for developers to
build scalable, data-driven applications with ease. Pydantic dataclasses are used to represent the data structures returned
by the API, and the client provides a relatively transparent interface to the Neon API.
Installation
------------
@@ -90,105 +90,35 @@ Below is an example of how to use the package to interact with the Neon API:
revoked_key = neon.api_key_revoke(api_key_id="api_key_id_to_revoke")
print(revoked_key)
# Get a list of projects
projects = neon.projects()
print(projects)
# Get a specific project
project = neon.project(project_id="project_id_to_get")
print(project)
# Create a new project
new_project = neon.project_create(name="new_project")
print(new_project)
# Update a project
updated_project = neon.project_update(project_id="project_id_to_update", name="updated_name")
print(updated_project)
# Delete a project
deleted_project = neon.project_delete(project_id="project_id_to_delete")
print(deleted_project)
# Get a project permissions
permissions = neon.project_permissions(project_id="project_id_to_get_permissions")
print(permissions)
# Grant permissions to a project
granted_permissions = neon.project_permissions_grant(project_id="project_id_to_grant_permissions", user_id="user_id_to_grant", permissions=["read", "write"])
print(granted_permissions)
# Revoke permissions from a project
revoked_permissions = neon.project_permissions_revoke(project_id="project_id_to_revoke_permissions", user_id="user_id_to_revoke")
print(revoked_permissions)
# Get a list of branches for a given project
branches = neon.branches(project_id="project_id_to_get_branches")
print(branches)
# Get a specific branch
branch = neon.branch(project_id="project_id_to_get_branch", branch_id="branch_id_to_get")
print(branch)
# Create a new branch
new_branch = neon.branch_create(project_id="project_id_to_create_branch", name="new_branch")
print(new_branch)
# Update a branch
updated_branch = neon.branch_update(project_id="project_id_to_update_branch", branch_id="branch_id_to_update", name="updated_name")
print(updated_branch)
# Delete a branch
deleted_branch = neon.branch_delete(project_id="project_id_to_delete_branch", branch_id="branch_id_to_delete")
print(deleted_branch)
# Get a list of roles for a given branch
roles = neon.roles(project_id="project_id_to_get_roles", branch_id="branch_id_to_get_roles")
print(roles)
# Get a role for a given branch
role = neon.role(project_id="project_id_to_get_role", branch_id="branch_id_to_get_role", role_name="role_name_to_get")
print(role)
# Create a new role
new_role = neon.role_create(project_id="project_id_to_create_role", branch_id="branch_id_to_create_role", role_name="new_role")
print(new_role)
# Delete a role
deleted_role = neon.role_delete(project_id="project_id_to_delete_role", branch_id="branch_id_to_delete_role", role_name="role_name_to_delete")
print(deleted_role)
# Get a role password
password = neon.role_password_reveal(project_id="project_id_to_get_password", branch_id="branch_id_to_get_password", role_name="role_name_to_get_password")
print(password)
# Reset a role password
reset_password = neon.role_password_reset(project_id="project_id_to_reset_password", branch_id="branch_id_to_reset_password", role_name="role_name_to_reset_password")
print(reset_password)
# Get a list of operations
operations = neon.operations(project_id="project_id_to_get_operations")
print(operations)
# Get an operation
operation = neon.operation(project_id="project_id_to_get_operation", operation_id="operation_id_to_get")
print(operation)
# Get a list of consumption metrics for all projects
consumption = neon.consumption()
print(consumption)
Please reference the API Reference section for a comprehensive list of available methods and classes.
API Reference
-------------
The following sections provide detailed information about the classes and methods available in the ``neon_client`` package
Modulelevel functions
//////////////////////
.. automodule:: neon_client
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
Classes
///////
.. autoclass:: neon_client.NeonAPI
:members:
:undoc-members:
:show-inheritance:
--------------------
.. automodule:: neon_client.schema
:members:
:undoc-members:
:show-inheritance:
Indices and tables