# MindLake

## 1. connect() Method

Connect to Mind Lake while ensuring that all encryption keys are prepared and available. Prior to making any function calls within the SDK, execute this function as it serves as the entry point.

```python
mindlakesdk.connect(walletPrivateKey: str, appKey: str, chainID: str, gateWay: str = None) -> MindLake
MindLake(walletPrivateKey: str, appKey: str, chainID: str, gateWay: str = None) -> MindLake
```

### Parameters

1. `walletPrivateKey` - `str`: the private key of your wallet
2. `chainID` - `str`: the ID of the supported chain.
3. `appKey` - `str`: used for authorization, allowing users of your application to gain access to Mind Lake. As a developer, you can apply for APP Keys from Mind Scan.

### Returns

An object of [`ResultType`](#user-content-fn-1)[^1]. [For more information](#2.-resulttype-type).

### Example

<pre class="language-python"><code class="lang-python"><strong># '5' is example of Goerli Testnet chainID
</strong><strong>chainID = '5'
</strong><strong>mind = mindlakesdk.connect("YOUR_OWN_WALLET_PRIVATEKEY", "YOUR_OWN_APP_KEY", chainID)
</strong>assert mind, mind.message
</code></pre>

## 2. MindLake.ResultType

Every method call in the Mind Lake SDK returns an object of ResultType.

```python
class ResultType:
    def __init__(self, code: int, message: str = None, data = None):
        self.code = code
        self.message = message
        self.data = data

    def __bool__(self):
        return self.code == 0
```

* `code` - `int`: The return code of the method call. A return value of 0 indicates success, while non-zero values represent a specific error code.
* `message` - `str`: If the return code is non-zero, an error message will be provided to describe the specific error encountered during the method call.
* `data` - `any`: If a method call returns a result, it will be stored in the `data` field.

## 3. MindLake.DataType

The `DataType` enum defines a comprehensive range of supported data types. This enum can be used in conjunction with the `MindLake.DataLake.Column` class, which represents a single column in a table, to specify the data type of the column. By utilizing the `DataType` enum, you can ensure that your data is stored in the appropriate format and can be processed correctly by the system.

#### Members

1. int4
2. int8
3. float4
4. float8
5. decimal
6. text
7. timestamp

[^1]: ```python
    class ResultType:
        def __init__(self, code: int, message: str = None, data = None):
            self.code = code
            self.message = message
            self.data = data
                
        def __bool__(self):
            return self.code == 0
    ```
