Skip to content

Commit c330571

Browse files
committed
feat: updated readme examples
1 parent 7802a12 commit c330571

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,32 @@ Please follow the [installation procedure](#installation--usage) and then run th
5454
require_once(__DIR__ . '/vendor/autoload.php');
5555

5656

57-
5857
// Configure API key authorization: apiKeyAuth
5958
$config = sendx\Configuration::getDefaultConfiguration()->setApiKey('X-Team-ApiKey', 'YOUR_API_KEY');
6059
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
6160
// $config = sendx\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Team-ApiKey', 'Bearer');
6261

6362

64-
$apiInstance = new sendx\Api\CampaignApi(
63+
$apiInstance = new sendx\Api\ContactApi(
6564
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
6665
// This is optional, `GuzzleHttp\Client` will be used as default.
6766
new GuzzleHttp\Client(),
6867
$config
6968
);
70-
$campaign_request = new \sendx\model\CampaignRequest(); // \sendx\model\CampaignRequest | The campaign content
69+
$contact_request = new \sendx\model\ContactRequest(); // \sendx\model\ContactRequest
70+
$contact_request->setEmail("john@doe.com"); // Required: Set email
71+
$contact_request->setFirstName("John"); // Optional: Set first name
72+
$contact_request->setLastName("Doe"); // Optional: Set last name
73+
$contact_request->setCompany("SendX"); // Optional: Set company
74+
$contact_request->setLastTrackedIp("192.168.1.1"); // Optional: Set last tracked IP
75+
$contact_request->setCustomFields(["sendf13kn2k3kjm2d" => "Developer", "ckjsnck234nm2kn42" => "Engineering"]); // Optional: Set custom fields
76+
$contact_request->setLists(["list_id_1", "list_id_2"]); // Optional: Subscribe to lists
7177

7278
try {
73-
$result = $apiInstance->createCampaign($campaign_request);
79+
$result = $apiInstance->createContact($contact_request);
7480
print_r($result);
7581
} catch (Exception $e) {
76-
echo 'Exception when calling CampaignApi->createCampaign: ', $e->getMessage(), PHP_EOL;
82+
echo 'Exception when calling ContactApi->createContact: ', $e->getMessage(), PHP_EOL;
7783
}
7884

7985
```

0 commit comments

Comments
 (0)