-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c03877
commit df7a633
Showing
16 changed files
with
1,148 additions
and
365 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Project specific | ||
daisycon-api-token.json | ||
test.php | ||
opt/** | ||
|
||
# Generic | ||
.externalToolBuilders | ||
.project | ||
.buildpath | ||
.settings | ||
.phpunit.result.cache | ||
tmp/ | ||
.DS_Store | ||
/data | ||
/conf | ||
/vendor/* | ||
*.php.pid | ||
**/nbproject | ||
**.pid | ||
**/*.pid | ||
.editorconfig | ||
*.komodo* | ||
.idea | ||
/_windows | ||
/inspection | ||
colors.scheme.xml | ||
databaseDrivers.xml | ||
debugger.xml | ||
diff.xml | ||
ide.general.xml | ||
ignore.xml | ||
IntelliLang.xml | ||
web-browsers.xml | ||
logs/ | ||
|
||
# Windows image file caches | ||
Thumbs.db |
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,22 +1,33 @@ | ||
{ | ||
"name": "samanthaadrichem/daisycon-api", | ||
"type": "library", | ||
"description": "Quick Daisycon Api Helper Class", | ||
"keywords": [ | ||
"Daisycon", | ||
"Api" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Samantha Adrichem" | ||
} | ||
], | ||
"require": { | ||
"ext-curl": "*", | ||
"ext-json": "*", | ||
"php": ">=5.5" | ||
}, | ||
"autoload": { | ||
"psr-0": { "DaisyconApi\\": "library/" } | ||
} | ||
"name": "samanthaadrichem/daisycon-api", | ||
"type": "library", | ||
"description": "Quick Daisycon Api Helper Class", | ||
"keywords": [ | ||
"Daisycon", | ||
"Api" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Samantha Adrichem" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"SamanthaAdrichem\\DaisyconApi\\": "library/" | ||
} | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "8.1.6" | ||
}, | ||
"process-timeout": 1800, | ||
"sort-packages": true | ||
}, | ||
"require": { | ||
"php": "^8.1", | ||
"ext-curl": "*", | ||
"ext-json": "*", | ||
"daisyconbv/oauth-examples": "^1.0", | ||
"symfony/serializer": "6.1.1" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
use SamanthaAdrichem\DaisyconApi\Exception\Http\NotFoundException; | ||
use SamanthaAdrichem\DaisyconApi\Exception\Http\HttpException; | ||
use SamanthaAdrichem\DaisyconApi\MethodEnum; | ||
use SamanthaAdrichem\DaisyconApi\RestClient; | ||
|
||
// Setup client | ||
|
||
$restClient = new RestClient( | ||
'myClientId', | ||
'myClientSecret' | ||
); | ||
|
||
// Fetch my publisher account | ||
var_dump($restClient->getPublishers()); | ||
|
||
// Fetch my publisher Ids | ||
var_dump($restClient->getPublisherIds()); | ||
|
||
// Fetch my advertiser account | ||
var_dump($restClient->getAdvertisers()); | ||
|
||
// Fetch my advertiser Ids | ||
var_dump($restClient->getAdvertiserIds()); | ||
|
||
// Fetch my lead generation account | ||
var_dump($restClient->getLeadGeneration()); | ||
|
||
// Fetch my lead generation Ids | ||
var_dump($restClient->getLeadGenerationIds()); | ||
|
||
// Catch errors | ||
try | ||
{ | ||
$restClient->performCall('/some/non/existing/url'); | ||
} | ||
// There are specific types, you can catch per type | ||
catch (NotFoundException $exception) | ||
{ | ||
var_dump($exception->getMessage()); | ||
} | ||
// Or just catch all HttpExceptions | ||
catch (HttpException $exception) | ||
{ | ||
var_dump($exception->getMessage()); | ||
} | ||
// Or just all exceptions | ||
catch (Exception $exception) | ||
{ | ||
var_dump($exception->getMessage()); | ||
} | ||
|
||
// You can also check the last response code | ||
var_dump($restClient->getLastResponseCode()); | ||
|
||
// Get the response headers | ||
$responseHeaders = []; | ||
$restClient->performCall( | ||
'/some/existing/url', | ||
MethodEnum::Get, | ||
[], | ||
$responseHeaders | ||
); | ||
var_dump($responseHeaders); | ||
|
||
// Enable sandbox mode | ||
$restClient->enableSandboxMode(); |
Oops, something went wrong.