-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Changed the default response decoding to output an array instead of…
… an object. - Replace old long array(...) syntax with newer [...] short syntax. - Completed the home page with links to all available examples.
- Loading branch information
Showing
12 changed files
with
143 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"editor.rulers": [80], | ||
"cSpell.words": [ | ||
"Proximify", | ||
"Uniweb" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<?php | ||
|
||
/** | ||
* 1. Query by ID (single result instead of array). | ||
* 2. Iterate over the interests. | ||
*/ | ||
|
||
require_once __DIR__ . '/../src/UniwebClient.php'; | ||
|
||
use Proximify\Uniweb\API\UniwebClient; | ||
|
@@ -9,14 +14,11 @@ | |
// When selecting one member, you can use the property 'id' instead of a filter. In that | ||
// case, the response won't be an array of members but just the member that you need | ||
$id = '[email protected]'; | ||
$resources = array('profile/membership_information', 'profile/research_interests'); | ||
$params = array('id' => $id, 'resources' => $resources); | ||
$resources = ['profile/membership_information', 'profile/research_interests']; | ||
$params = ['id' => $id, 'resources' => $resources]; | ||
|
||
// Retrieve the data from the server | ||
// For Bruno: I added a second parameter so that the response is an array instead of an | ||
// object. I find that easier to deal with. | ||
|
||
$response = $client->read($params, true); | ||
$response = $client->read($params); | ||
|
||
if (!$response) { | ||
throw new Exception('Count not find the member'); | ||
|
@@ -36,7 +38,7 @@ | |
// research there, name of the parent of the research them, name of the grand parent of | ||
// the research theme, and so on. Here I'm just using the base name of the interest. | ||
|
||
$researchInterestsList = array(); | ||
$researchInterestsList = []; | ||
|
||
foreach ($interests as $tuple) { | ||
$researchInterestsList[] = $tuple['interest'][1]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php | ||
|
||
/** | ||
* Edit some of the information on the membership section. | ||
* It is important to notice that if there is already an item with data in the | ||
* section, then only the field values that we send will modify existing values. | ||
* In other words, if, for example, we don't send a middle name, and the user | ||
* had set a middle name, then the existing middle name will be unchanged. | ||
*/ | ||
require_once __DIR__ . '/../src/UniwebClient.php'; | ||
|
||
use Proximify\Uniweb\API\UniwebClient; | ||
|
@@ -9,21 +16,15 @@ | |
// Set the login name of the user whose profile we want to write to. | ||
$id = '[email protected]'; | ||
|
||
// We are editing some of the information on the membership section. It is important to | ||
// notice that if there is already an item with data in the section, then only the field | ||
// values that we send will modify existing values. In other words, if, for example, | ||
// we don't send a middle name, and the user had set a middle name, then the existing | ||
// middle name will be unchanged. | ||
|
||
$resources = array('profile/membership_information' => [ | ||
$resources = ['profile/membership_information' => [ | ||
"first_name" => "Juan", | ||
"last_name" => "Pedro", | ||
"account_type" => 1, | ||
"position_title" => 1, | ||
"email" => "dmac" | ||
]); | ||
]]; | ||
|
||
$params = array('id' => $id, 'resources' => $resources); | ||
$params = ['id' => $id, 'resources' => $resources]; | ||
$response = $client->edit($params); | ||
|
||
if ($response) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,22 +11,22 @@ | |
$client = new UniwebClient(UniwebClient::loadCredentials()); | ||
|
||
$id = '[email protected]'; | ||
$resources = array('cv/user_profile'); | ||
$readParams = array('id' => $id, 'resources' => $resources); | ||
$resources = ['cv/user_profile']; | ||
$readParams = ['id' => $id, 'resources' => $resources]; | ||
|
||
$response = $client->read($readParams); | ||
$client->printResponse($response, 'User profile in CV before "edit"'); | ||
|
||
$currentInterests = array(); | ||
$currentInterests = []; | ||
|
||
// Create a bilingual string | ||
$bilingualStr = array( | ||
$bilingualStr = [ | ||
'english' => 'Artificial intelligence', | ||
'french' => 'Intelligence artificielle' | ||
); | ||
]; | ||
|
||
$resources = array('cv/user_profile' => array('research_interests' => $bilingualStr)); | ||
$editParams = array('id' => $id, 'resources' => $resources); | ||
$resources = ['cv/user_profile' => ['research_interests' => $bilingualStr]]; | ||
$editParams = ['id' => $id, 'resources' => $resources]; | ||
$response = $client->edit($editParams); | ||
|
||
if ($response) { | ||
|
Oops, something went wrong.