Skip to content

Commit

Permalink
Update documentation and add autodoc typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethreitz committed Jan 31, 2024
1 parent 425f647 commit e5840bd
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 142 deletions.
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"sphinx.ext.autosectionlabel",
]

autodoc_typehints = "signature"

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

Expand Down
114 changes: 22 additions & 92 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------

Expand Down Expand Up @@ -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)
Please reference the API Reference section for a comprehensive list of available methods and classes.

# 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)
API Reference
-------------

# Get a list of operations
operations = neon.operations(project_id="project_id_to_get_operations")
print(operations)
The following sections provide detailed information about the classes and methods available in the ``neon_client`` package

# Get an operation
operation = neon.operation(project_id="project_id_to_get_operation", operation_id="operation_id_to_get")
print(operation)
Module–level functions
//////////////////////

# Get a list of consumption metrics for all projects
consumption = neon.consumption()
print(consumption)
.. automodule:: neon_client
:members:
:undoc-members:
:show-inheritance:

Classes
///////

API Reference
-------------
.. autoclass:: neon_client.NeonAPI
:members:
:undoc-members:
:show-inheritance:

The following sections provide detailed information about the classes and methods available in the ``neon_client`` package
--------------------

.. automodule:: neon_client
.. automodule:: neon_client.schema
:members:
:undoc-members:
:show-inheritance:
:inherited-members:


Indices and tables
Expand Down
Loading

0 comments on commit e5840bd

Please sign in to comment.