Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
improve doc and tests about users managements endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas GASC committed Nov 7, 2016
1 parent 09011be commit 4db99a2
Show file tree
Hide file tree
Showing 21 changed files with 807 additions and 95 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ With the `real` testsuite, you could execute a serie of test who will be applied
- soap_login
- soap_password
- soap_wsdl
- selligent_listid
- selligent_list
- selligent_gate


## Read More
Expand Down
45 changes: 42 additions & 3 deletions doc/Reference/Campaigns.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Campaigns

- [TriggerCampaign](#triggercampaign)
- [TriggerCampaignWithResult](#triggercampaignwithresult)
- [TriggerCampaignForUser](#triggercampaignforuser)
- [TriggerCampaignForUserWithResult](#triggercampaignforuserwithresult)


## TriggerCampaign

Expand Down Expand Up @@ -61,7 +66,13 @@ Trigger the execution of the specified journey map for a specific contact.
<?php

$inputData = new Properties();
$TriggerCampaignWithResultResponse = $client->TriggerCampaign([
$TriggerCampaignForUserResponse = $client->TriggerCampaign([

/* ID or code of the targeted list */
'List' => 1,

/* ID of the selected contact */
'UserID' => 1,

/* Name of the targeted gate */
'GateName' => 'TESTGATE',
Expand All @@ -70,8 +81,36 @@ $TriggerCampaignWithResultResponse = $client->TriggerCampaign([
'InputData' => $inputData,
]);

if (Response::SUCCESSFUL === $TriggerCampaignWithResultResponse->getCode()) {
print $TriggerCampaignWithResultResponse->getResult();
if (Response::SUCCESSFUL === $TriggerCampaignForUserResponse->getCode()) {
print "campaign sent";
}


```## TriggerCampaignForUserWithResult

Trigger the execution of the specified journey map for a specific contact.

```php
<?php

$inputData = new Properties();
$TriggerCampaignForUserWithResultResponse = $client->TriggerCampaign([

/* ID or code of the targeted list */
'List' => 1,

/* ID of the selected contact */
'UserID' => 1,

/* Name of the targeted gate */
'GateName' => 'TESTGATE',

/* List of input properties */
'InputData' => $inputData,
]);

if (Response::SUCCESSFUL === $TriggerCampaignForUserWithResultResponse->getCode()) {
print $TriggerCampaignForUserWithResultResponse->getResult();
}

```
212 changes: 172 additions & 40 deletions doc/Reference/Users.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Manage Users

- [CreateUser](#createuser)
- [UpdateUser](#updateuser)
- [UpdateUsers](#updateusers)
- [GetUserById](#getuserbyid)
- [RetrieveHashForUser](#retrievehashforuser)
- [CountUserByFilter](#countuserbyfilter)
- [GetUsersByFilter](#getusersbyfilter)
- [GetUserByFilter](#getusersbyfilter)
- [CountUserByConstraint](#countuserbyconstraint)
- [GetUsersByConstraint](#getusersbyconstraint)
- [GetUserByConstraint](#getusersbyconstraint)


## CreateUser

Expand Down Expand Up @@ -28,7 +40,7 @@ if (Response::SUCCESSFUL === $CreateUserResponse->getCode()) {
```


### UpdateUser
## UpdateUser

Update a contact profile in the specified list.

Expand Down Expand Up @@ -59,7 +71,57 @@ if (Response::SUCCESSFUL !== $UpdateUserResponse->getCode()) {
```


### GetUserById
## UpdateUsers

Update multiple contact profiles in the specified list.

```php
<?php

use Mediapart\Selligent\Properties;
use Mediapart\Selligent\Request\UpdateUsers;

$user1Properties = new Properties();
$user1Properties['Foo'] = 'Bar 1';

$user2Properties = new Properties();
$user2Properties['Foo'] = 'Bar 2';

$UpdateUsersResponse = $client->UpdateUsers([

/* ID or Code of the targeted list */
'List' => 1,

/* An array of contact profiles to update.
The ID is used to perform mapping with existing records.
In case of insert, set the ID to 0. */
'UserChanges' => [
[
'ID' => 1,
'Changes' => $user1Properties
],
[
'ID' => 2,
'Changes' => $user2Properties
],
],

/* The type of operation.
- 1, insert only
- 2, update only
- 3, insert and update */
'mode' => UpdateUsers::INSERT & UpdateUsers::UPDATE,

]);

if (Response::SUCCESSFUL === $UpdateUsersResponse->getCode()) {
print "changes saved."
}

```


## GetUserById

Retrieve contact information based on a user ID.

Expand All @@ -83,10 +145,36 @@ if (Response::SUCCESSFUL === $GetUsersByConstraintResponse->getCode()) {
```


## RetrieveHashForUser

### CountUserByConstraint
Retrieve the hash code for the selected contact.

Count the number of contacts based on a filter.
```php
<?php

$RetrieveHashForUserResponse = $client->RetrieveHashForUser([

/* Name of the targeted gate */
'GateName' => $gate_name,

/* ID or Code of the targeted list */
'List' => $list_id,

/* ID of the targeted contact */
'UserID' => $user_id,

]);

if (Response::SUCCESSFUL === $RetrieveHashForUserResponse->getCode()) {
$user_hash_code = $RetrieveHashForUserResponse->getHashCode();
}

```


## CountUserByConstraint

Count the number of contacts based on a constraint.

```php
<?php
Expand All @@ -98,7 +186,7 @@ $CountUserByConstraintResponse = $client->CountUsersByConstraint([

/* Constraint applied to the contact’s selection.
The constraint corresponds to the sql WHERE statement */
'Constraint' => '',
'Constraint' => 'NAME LIKE %foobar%',

]);

Expand All @@ -109,9 +197,9 @@ if (Response::SUCCESSFUL === $CountUserByConstraintResponse->getCode()) {
```


### GetUsersByConstraint
## GetUsersByConstraint

Retrieve user information based on a constraint.
Retrieve a list of contacts based on a constraint.

```php
<?php
Expand All @@ -122,7 +210,10 @@ $GetUsersByConstraintResponse = $client->GetUsersByConstraint([
'List' => $list_id,

/* Constraint applied to the contact selection */
'Constraint' => '',
'Constraint' => 'NAME LIKE %foobar%',

/* Maximum amount of records retrieved */
'MaxCount' => 5,

]);

Expand All @@ -138,75 +229,116 @@ if (Response::SUCCESSFUL === $GetUsersByConstraintResponse->getCode()) {
```


## GetUserByConstraint

Retrieve user information based on a constraint.

```php
<?php

$GetUserByConstraintResponse = $client->GetUsersByConstraint([

/* ID or Code of the targeted list */
'List' => $list_id,

/* Constraint applied to the contact selection */
'Constraint' => 'NAME = %foobar%',

]);

if (Response::SUCCESSFUL === $GetUserByConstraintResponse->getCode()) {
$user = $GetUserByConstraintResponse->getProperperties();
}

```


### UpdateUsers
## CountUserByFilter

Update multiple contact profiles in the specified list.
Count the number of contacts based on a filter.

```php
<?php

use Mediapart\Selligent\Request\UpdateUsers;
$filter = new Properties();
$filter['NAME'] = 'foobar';

$UpdateUsersResponse = $client->UpdateUsers([
$CountUserByFilterResponse = $client->CountUsersByFilter([

/* ID or Code of the targeted list */
'List' => 1,

/* An array of contact profiles to update.
The ID is used to perform mapping with existing records.
In case of insert, set the ID to 0. */
'UserChanges' => [
[
'ID' => 1,
'Changes' => $properties
],
],
'List' => $list_id,

/* The type of operation.
- 1, insert only
- 2, update only
- 3, insert and update */
'mode' => UpdateUsers::INSERT & UpdateUsers::UPDATE,
/* Filter applied to the contact’s selection.
This is represented by an array of keys and values */
'Filter' => $filter,

]);

if (Response::SUCCESSFUL === $UpdateUsersResponse->getCode()) {
print "changes saved."
if (Response::SUCCESSFUL === $CountUserByFilterResponse->getCode()) {
print $CountUserByFilterResponse->getUserCount();
}

```


## RetrieveHashForUser
## GetUsersByFilter

Retrieve the hash code for the selected contact.
Retrieve a list of contacts based on a filter.

```php
<?php

$RetrieveHashForUserResponse = $client->RetrieveHashForUser([

/* Name of the targeted gate */
'GateName' => $gate_name,
$filter = new Properties();
$filter['NAME'] = 'foobar';

$GetUsersByFilterResponse = $client->GetUsersByFilter([

/* ID or Code of the targeted list */
'List' => $list_id,

/* ID of the targeted contact */
'UserID' => $user_id,
/* Filter applied to the contact’s selection.
This is represented by an array of keys and values */
'Filter' => $filter,

/* Maximum amount of records retrieved */
'MaxCount' => 5,

]);

if (Response::SUCCESSFUL === $RetrieveHashForUserResponse->getCode()) {
$user_hash_code = $RetrieveHashForUserResponse->getHashCode();
$users = [];
if (Response::SUCCESSFUL === $GetUsersByFilterResponse->getCode()) {

foreach ($GetUsersByFilterResponse->getIds() as $user_id) {
$users[] = $client->GetUserById($user_id);
}

}

```


## GetUserByFilter

Retrieve contact information based on a filter

```php
<?php

$filter = new Properties();
$filter['NAME'] = 'foobar';

$GetUserByFilterResponse = $client->GetUsersByFilter([

/* ID or Code of the targeted list */
'List' => $list_id,

/* Filter applied to the contact selection */
'Filter' => $filter,

]);

if (Response::SUCCESSFUL === $GetUserByFilterResponse->getCode()) {
$user = $GetUserByFilterResponse->getProperperties();
}

```
6 changes: 5 additions & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ public function __construct($client = 'SoapClient', $header = 'SoapHeader')
# Manage Users
'CreateUserResponse' => 'Mediapart\Selligent\Response\CreateUserResponse',
'UpdateUserResponse' => 'Mediapart\Selligent\Response\UpdateUserResponse',
'UpdateUsersResponse' => 'Mediapart\Selligent\Response\UpdateUsersResponse',
'GetUserByIDResponse' => 'Mediapart\Selligent\Response\GetUserByIDResponse',

'RetrieveHashForUserResponse' => 'Mediapart\Selligent\Response\RetrieveHashForUserResponse',
'CountUsersByConstraintResponse' => 'Mediapart\Selligent\Response\CountUsersByConstraintResponse',
'GetUsersByConstraintResponse' => 'Mediapart\Selligent\Response\GetUsersByConstraintResponse',
'GetUserByConstraintResponse' => 'Mediapart\Selligent\Response\GetUserByConstraintResponse',
'CountUsersByFilterResponse' => 'Mediapart\Selligent\Response\CountUsersByFilterResponse',
'GetUsersByFilterResponse' => 'Mediapart\Selligent\Response\GetUsersByFilterResponse',
'GetUserByFilterResponse' => 'Mediapart\Selligent\Response\GetUserByFilterResponse',

# Manage Campaign
Expand Down
Loading

0 comments on commit 4db99a2

Please sign in to comment.