Metadata-Version: 2.1
Name: nttblink
Version: 0.0.3
Summary: A small nttblink connector package
Author-email: Austin Arlint <austin.arlint@global.ntt>
Project-URL: Homepage, https://github.com/NTT-AM-DDD/python-nttblink
Project-URL: Bug Tracker, https://github.com/NTT-AM-DDD/python-nttblink/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# NTTBlink: An Elegant Solution for Secrets and Documents Management

NTTBlink is a sophisticated Python module that presents a seamless way to handle secrets and documents. 

## Installation

The installation of NTTBlink is a walk in the park, facilitated by pip:

```bash
pip install nttblink

```

Now, NTTBlink stands ready for your command.

Usage

The charm of Python lies in its simplicity and power, traits that NTTBlink embodies fully. Here's a step-by-step guide on how to wield this power:

## Import the Package
Start your journey by invoking the magic of NTTBlink.

```python
from nttblink import Blink
blink = Blink()
```

## Set Environment Variables for Secrets
With a single command, normalize your secrets - remove spaces, transform to uppercase, and set them as environment variables.  This is a easy one liner to get your secrets into your environment.

```python
blink.set_secrets_to_environment_variables()
```

## Create a New Secret
Creating a new secret is as easy as whispering to a trusted friend. Provide the key, a description, and the secret itself as a dictionary.

```python
new_secret = blink.create_secret('secretname', 'secret description', {'key': 'value'})
```

## List All Secrets
Summon the catalogue of all secrets at your disposal.

```python
secrets = blink.list_secrets()
for secret in secrets:
    print(secret)
```
## Unveil Secret Details
Peek into the contents of each secret, illuminating the hidden truth.

``` python
for secret in secrets:
    secret_details = blink.get_secret(secret['id'])
    print(secret_details)
```    
## Enumerate All Documents
With NTTBlink, documents are at your fingertips. List them with ease.

``` python

documents = blink.list_documents()
for document in documents:
    print(document)
```

## Store Each Document
Let no document be left unread. NTTBlink empowers you to retrieve each document and save it to your local directory.

``` python
for document in documents:
    with open(document['name'], 'wb') as file:
        content = blink.get_document(document['id'])
        file.write(content[0])
```   

With NTTBlink, you have a versatile tool to manage secrets and documents effortlessly. Enjoy this power responsibly.

# Environment Variables

To breathe life into NTTBlink, we need to supply it with the correct environment variables. These variables serve as the keys to the realm, enabling interactions with the Blink project.

To establish these variables, you'll need to venture to the developer panel on your project page in Blink and collect the correct values. As a guiding beacon, we provide a sample environment file for testing your Python scripts:

```bash
# Sample .env file

BLINK_PROJECT_ID = "622a1fab001900435372fecfb8fd8a13"
BLINK_TOKEN = "qwk23q8aaskqwu2iqasmasdf"
BLINK_BASE_URL = "https://am-automate.nttltd.global.ntt"
BLINK_AUTOMATION_ID = 9
```
Here's a brief explanation of each variable:

BLINK_PROJECT_ID: This is the unique identifier of your Blink project. It tells NTTBlink which project it should interact with.

BLINK_TOKEN: This is your authorization token. It's like the passport for NTTBlink, granting it permission to perform operations in your Blink project.

BLINK_BASE_URL: This is the base URL for your Blink instance. It's the address that NTTBlink will visit to carry out your commands.

BLINK_AUTOMATION_ID: This is the identifier for the specific automation you are working with.
Remember to replace the values in the sample .env file with your actual data.

For safety reasons, never expose these environment variables publicly as they can provide unrestricted access to your project. Use .env files for local development, but ensure they're included in your .gitignore file. For deployment, use secure environment variables provided by your hosting service.
