Skip to content

Generate reference docs #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docs/reference/onepassword/client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
sidebar_label: client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this metadata is appearing on the front end as a table. Is there a way to avoid that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look into it.

title: onepassword.client
---

#### SDK\_VERSION

v0.1.0

## Client Objects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to edit the doc generator so these headers are sentence cased? For example: "Client objects"


```python
class Client()
```

A client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look correct. I'm not sure where it's being source from.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's sourced from a comment from client.py. It can be edited there, in place

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange - I don't see "A client" in that file. Could you point me to it in case I'm missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


#### 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

21 changes: 21 additions & 0 deletions docs/reference/onepassword/secrets_api.md
Original file line number Diff line number Diff line change
@@ -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.

34 changes: 34 additions & 0 deletions docs/reference/sidebar.json
Original file line number Diff line number Diff line change
@@ -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"
}
9 changes: 9 additions & 0 deletions pydoc-markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
loaders:
- type: python
processors:
- type: filter
skip_empty_modules: true
- type: smart
- type: crossref
renderer:
type: docusaurus
2 changes: 2 additions & 0 deletions scripts/generate_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pydoc-markdown
rm -rf ./docs/reference/onepassword/lib
9 changes: 6 additions & 3 deletions src/onepassword/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions src/onepassword/secrets_api.py
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down