diff --git a/docs/reference/onepassword/client.md b/docs/reference/onepassword/client.md new file mode 100644 index 00000000..e71eaf30 --- /dev/null +++ b/docs/reference/onepassword/client.md @@ -0,0 +1,35 @@ +--- +sidebar_label: client +title: onepassword.client +--- + +#### SDK\_VERSION + +v0.1.0 + +## Client Objects + +```python +class Client() +``` + +A client + +#### authenticate + +```python +@classmethod +async def authenticate(cls, auth, integration_name, integration_version) +``` + +authenticate returns an authenticated client or errors if any provided information, including the SA token, is incorrect +`integration_name` represents the name of your application and `integration_version` represents the version of your application. + +#### new\_default\_config + +```python +def new_default_config(auth, integration_name, integration_version) +``` + +Generates a configuration dictionary with the user's parameters + diff --git a/docs/reference/onepassword/secrets_api.md b/docs/reference/onepassword/secrets_api.md new file mode 100644 index 00000000..4e753651 --- /dev/null +++ b/docs/reference/onepassword/secrets_api.md @@ -0,0 +1,21 @@ +--- +sidebar_label: secrets_api +title: onepassword.secrets_api +--- + +## Secrets Objects + +```python +class Secrets() +``` + +Secrets represents all operations the SDK client can perform on 1Password secrets. + +#### resolve + +```python +async def resolve(reference) +``` + +resolve returns the secret the provided reference points to. + diff --git a/docs/reference/sidebar.json b/docs/reference/sidebar.json new file mode 100644 index 00000000..d94a5978 --- /dev/null +++ b/docs/reference/sidebar.json @@ -0,0 +1,34 @@ +{ + "items": [ + { + "items": [ + { + "items": [ + { + "items": [ + "reference/onepassword/lib/aarch64/op_uniffi_core" + ], + "label": "onepassword.lib.aarch64", + "type": "category" + }, + { + "items": [ + "reference/onepassword/lib/x86_64/op_uniffi_core" + ], + "label": "onepassword.lib.x86_64", + "type": "category" + } + ], + "label": "onepassword.lib", + "type": "category" + }, + "reference/onepassword/client", + "reference/onepassword/secrets_api" + ], + "label": "onepassword", + "type": "category" + } + ], + "label": "Reference", + "type": "category" +} \ No newline at end of file diff --git a/pydoc-markdown.yml b/pydoc-markdown.yml new file mode 100644 index 00000000..ceeeaa03 --- /dev/null +++ b/pydoc-markdown.yml @@ -0,0 +1,9 @@ +loaders: + - type: python +processors: + - type: filter + skip_empty_modules: true + - type: smart + - type: crossref +renderer: + type: docusaurus diff --git a/scripts/generate_docs.sh b/scripts/generate_docs.sh new file mode 100755 index 00000000..ffc166fc --- /dev/null +++ b/scripts/generate_docs.sh @@ -0,0 +1,2 @@ +pydoc-markdown +rm -rf ./docs/reference/onepassword/lib diff --git a/src/onepassword/client.py b/src/onepassword/client.py index 60620da4..4d9bbc82 100644 --- a/src/onepassword/client.py +++ b/src/onepassword/client.py @@ -12,11 +12,13 @@ class Client: + """A client""" - """authenticate returns an authenticated client or errors if any provided information, including the SA token, is incorrect""" - """`integration_name` represents the name of your application and `integration_version` represents the version of your application.""" @classmethod async def authenticate(cls, auth, integration_name, integration_version): + """authenticate returns an authenticated client or errors if any provided information, including the SA token, is incorrect + `integration_name` represents the name of your application and `integration_version` represents the version of your application.""" + self = cls() self.config = new_default_config(auth=auth, integration_name=integration_name, integration_version=integration_version) client_id = int(await _init_client(self.config)) @@ -25,8 +27,9 @@ async def authenticate(cls, auth, integration_name, integration_version): return self -# Generates a configuration dictionary with the user's parameters def new_default_config(auth, integration_name, integration_version): + """Generates a configuration dictionary with the user's parameters""" + client_config_dict = { "serviceAccountToken": auth, "programmingLanguage": SDK_LANGUAGE, diff --git a/src/onepassword/secrets_api.py b/src/onepassword/secrets_api.py index 1c377b78..28ed7738 100644 --- a/src/onepassword/secrets_api.py +++ b/src/onepassword/secrets_api.py @@ -1,12 +1,14 @@ from .core import _invoke -"""Secrets represents all operations the SDK client can perform on 1Password secrets.""" class Secrets: + """Secrets represents all operations the SDK client can perform on 1Password secrets.""" + def __init__(self, client_id): self.client_id = client_id - """resolve returns the secret the provided reference points to.""" async def resolve(self, reference): + """resolve returns the secret the provided reference points to.""" + response = await _invoke({ "clientId": self.client_id, "invocation": {