Skip to content

Latest commit

 

History

History
303 lines (214 loc) · 14.7 KB

README.md

File metadata and controls

303 lines (214 loc) · 14.7 KB

Customers

(customers)

Overview

Available Operations

  • create - Create a customer ⚠️ Deprecated
  • delete - Delete a customer
  • get - Retrieve a customer
  • list - Retrieve a list of customers
  • update - Update a customer

create

[Deprecated]: Customer creation can only be done via tracking a lead event. Use the /track/lead endpoint instead.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

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

$request = new Operations\CreateCustomerRequestBody(
    externalId: '<id>',
);

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

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

Parameters

Parameter Type Required Description
$request Operations\CreateCustomerRequestBody ✔️ The request object to use for the request.

Response

?Operations\CreateCustomerResponse

Errors

Error Type Status Code Content Type
Errors\BadRequest 400 application/json
Errors\Unauthorized 401 application/json
Errors\Forbidden 403 application/json
Errors\NotFound 404 application/json
Errors\Conflict 409 application/json
Errors\InviteExpired 410 application/json
Errors\UnprocessableEntity 422 application/json
Errors\RateLimitExceeded 429 application/json
Errors\InternalServerError 500 application/json
Errors\SDKException 4XX, 5XX */*

delete

Delete a customer from a workspace.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;

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



$response = $sdk->customers->delete(
    id: '<id>'
);

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

Parameters

Parameter Type Required Description
id string ✔️ The unique identifier of the customer in Dub.

Response

?Operations\DeleteCustomerResponse

Errors

Error Type Status Code Content Type
Errors\BadRequest 400 application/json
Errors\Unauthorized 401 application/json
Errors\Forbidden 403 application/json
Errors\NotFound 404 application/json
Errors\Conflict 409 application/json
Errors\InviteExpired 410 application/json
Errors\UnprocessableEntity 422 application/json
Errors\RateLimitExceeded 429 application/json
Errors\InternalServerError 500 application/json
Errors\SDKException 4XX, 5XX */*

get

Retrieve a customer by ID for the authenticated workspace.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;

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



$response = $sdk->customers->get(
    id: '<id>',
    includeExpandedFields: false

);

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

Parameters

Parameter Type Required Description
id string ✔️ The unique identifier of the customer in Dub.
includeExpandedFields ?bool Whether to include expanded fields on the customer (link, partner, discount).

Response

?Operations\GetCustomerResponse

Errors

Error Type Status Code Content Type
Errors\BadRequest 400 application/json
Errors\Unauthorized 401 application/json
Errors\Forbidden 403 application/json
Errors\NotFound 404 application/json
Errors\Conflict 409 application/json
Errors\InviteExpired 410 application/json
Errors\UnprocessableEntity 422 application/json
Errors\RateLimitExceeded 429 application/json
Errors\InternalServerError 500 application/json
Errors\SDKException 4XX, 5XX */*

list

Retrieve a list of customers for the authenticated workspace.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;

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



$response = $sdk->customers->list(
    email: '[email protected]',
    externalId: '<id>',
    includeExpandedFields: false

);

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

Parameters

Parameter Type Required Description
email ?string A case-sensitive filter on the list based on the customer's email field. The value must be a string.
externalId ?string A case-sensitive filter on the list based on the customer's externalId field. The value must be a string.
includeExpandedFields ?bool Whether to include expanded fields on the customer (link, partner, discount).

Response

?Operations\GetCustomersResponse

Errors

Error Type Status Code Content Type
Errors\BadRequest 400 application/json
Errors\Unauthorized 401 application/json
Errors\Forbidden 403 application/json
Errors\NotFound 404 application/json
Errors\Conflict 409 application/json
Errors\InviteExpired 410 application/json
Errors\UnprocessableEntity 422 application/json
Errors\RateLimitExceeded 429 application/json
Errors\InternalServerError 500 application/json
Errors\SDKException 4XX, 5XX */*

update

Update a customer for the authenticated workspace.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

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

$request = new Operations\UpdateCustomerRequest(
    id: '<id>',
);

$response = $sdk->customers->update(
    request: $request
);

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

Parameters

Parameter Type Required Description
$request Operations\UpdateCustomerRequest ✔️ The request object to use for the request.

Response

?Operations\UpdateCustomerResponse

Errors

Error Type Status Code Content Type
Errors\BadRequest 400 application/json
Errors\Unauthorized 401 application/json
Errors\Forbidden 403 application/json
Errors\NotFound 404 application/json
Errors\Conflict 409 application/json
Errors\InviteExpired 410 application/json
Errors\UnprocessableEntity 422 application/json
Errors\RateLimitExceeded 429 application/json
Errors\InternalServerError 500 application/json
Errors\SDKException 4XX, 5XX */*