Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.01 KB

USAGE.md

File metadata and controls

59 lines (44 loc) · 1.01 KB
declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();

$request = new Operations\CreateLinkRequestBody(
    url: 'https://google.com',
    tagIds: [
        'clux0rgak00011...',
    ],
    externalId: '123456',
);

$response = $sdk->links->create(
    request: $request
);

if ($response->linkSchema !== null) {
    // handle response
}
declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();

$request = new Operations\UpsertLinkRequestBody(
    url: 'https://google.com',
    tagIds: [
        'clux0rgak00011...',
    ],
    externalId: '123456',
);

$response = $sdk->links->upsert(
    request: $request
);

if ($response->linkSchema !== null) {
    // handle response
}