---
# System prepended metadata

title: This document contains

---

# This document contains

**1. GADI-IOS-AGENT**
**2. GADI-ANDROID-AGENT**

# GADI-IOS-AGENT


## Methods

**1. createDigitalAddress( NSString apiEndpoint, NSDictionary userDocuments ) -> NSString**
---
This method sends an api request to `DAP` to create a digital address for the `Holder`.
This method will return response in `NSString`

`apiEndpoint`: NSString - endpoint specifying the route where the holder should request the `DAP` for creation of digital address.
`userDocument`: NSDictionary - an array of holder documents to be sent to `DAP` as a post request payload. (**NOTE** Please send the `userDocument` as an empty array i.e, `[]`)

**Example**
```
#import <GadiAgentModule.h>
#import <Realm/Realm.h>
...
NSString *response = [[[GadiAgentModule alloc] init] createDigitalAddress:@"https://10.10.10.10:3000/da" userDocuments:@[]];
```

**2 saveDigitalAddress(String digitalAddress) -> String**
---
This method saves the digital address generated by `DAP` agent into local database.

**Example**

```
#import <GadiAgentModule.h>
#import <Realm/Realm.h>
...
NSString *response = [[[GadiAgentModule alloc] init] saveDigitalAddress:@"did:gadi:bba04f6985f560446c122d235ed2e51bf7c10864"];
```


**3 getDigitalAddress() -> RLMResults**
---
This method returns the digital address generated by DAP and saved in local database by createDigitalAddress method.

**Example**

```
#import <GadiAgentModule.h>
#import <Realm/Realm.h>
...
RLMResults *results = [[[GadiAgentModule alloc] init] getDigitalAddress];
```

**4 getMediatorAgentUrl() -> RLMResults**
---
This method returns the mediator agent url discovered from DAP and saved in local database.

**Example**

```
#import <GadiAgentModule.h>
#import <Realm/Realm.h>
...
RLMResults *results = [[[GadiAgentModule alloc] init] getMediatorAgentUrl];
```

**5 registerWithMediatorAgent(String label, String digitalAddress) -> RLMResults**
---
This method registers holder's digital address on mediator agent.

**Example**

```
#import <GadiAgentModule.h>
#import <Realm/Realm.h>
...
NSString *receive = [[[GadiAgentModule alloc] init] registerWithMediatorAgent:@"ANY RANDOM NAME" digitalAddress:@"DIGITAL ADDRESS RECEIVED FROM getDigitalAddress"];
```

---
# GADI-ANDROID-AGENT

## Methods

**1. createDigitalAddress( String apiEndpoint, JSONArray userDocuments ) -> String**
---
This method sends an api request to `DAP` to create a digital address for the `Holder`.
This method will return response in `String`

`apiEndpoint`: String - endpoint specifying the route where the holder should request the `DAP` for creation of digital address.
`userDocument`: JSONArray - an array of holder documents to be sent to `DAP` as a post request payload. (**NOTE** Please send the `userDocument` as an empty array i.e, `[]`)

**Example**
```
import com.digitaltrust.gadiandroidagent.GadiAgentModule;
...
 GadiAgentModule.createDigitalAddress(
        "https://dap-service.dev.digitaltrust.net/api/digital-address",
        userDocuments, new NetworkModule.NetworkModuleListener() {
            @Override
            public void createDigitalAddressStatus(String digitalAddress) {
                Log.d(TAG, "DigitalAddress: result: " + digitalAddress);
            }
        }
);
```

**2. saveDigitalAddress(String digitalAddress) -> String**
---
This method saves the digital address generated by `DAP` agent into local database.

**Example**

```
import com.digitaltrust.gadiandroidagent.GadiAgentModule;
...
String digitalAddressStatus = GadiAgentModule.saveDigitalAddress(digitalAddress);
```


**3. getDigitalAddress() -> String**
---
This method returns the digital address generated by DAP and saved in local database by createDigitalAddress method.

**Example**

```
import com.digitaltrust.gadiandroidagent.GadiAgentModule;
...
String digitalAddress = GadiAgentModule.getDigitalAddress();
Log.d(TAG, "Digital Address: " + digitalAddress);
```

**4. getMediatorAgentUrl() -> String**
---
This method returns the mediator agent url discovered from DAP and saved in local database.

**Example**

```
import com.digitaltrust.gadiandroidagent.GadiAgentModule;
...
String mediatorAgentUrl = GadiAgentModule.getMediatorAgentUrl();
Log.d(TAG, "Mediator Agent Url: " + mediatorAgentUrl);
```

**5. registerWithMediatorAgent(String label, String digitalAddress) -> String**
---
This method registers holder's digital address on mediator agent.

**Example**

```
import com.digitaltrust.gadiandroidagent.GadiAgentModule;
...
GadiAgentModule.registerWithMediatorAgent("RANDOM_LABEL", digitalAddress, new MediatorAgentListener() {
    @Override
    public void registerMediatorAgentResponse(String response) {
        Log.d(TAG, "registerMediatorAgentResponse:response:  " + response);
    }
});
```