Skip to content

Latest commit

 

History

History
219 lines (156 loc) · 13.1 KB

README.md

File metadata and controls

219 lines (156 loc) · 13.1 KB

Domains

(domains)

Overview

Available Operations

  • create - Create a domain
  • list - Retrieve a list of domains
  • update - Update a domain
  • delete - Delete a domain

create

Create a domain for the authenticated workspace.

Example Usage

from dub import Dub

with Dub(
    token="DUB_API_KEY",
) as dub:

    res = dub.domains.create(request={
        "slug": "acme.com",
        "expired_url": "https://acme.com/expired",
        "not_found_url": "https://acme.com/not-found",
        "archived": False,
        "placeholder": "https://dub.co/help/article/what-is-dub",
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request operations.CreateDomainRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

components.DomainSchema

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.SDKError 4XX, 5XX */*

list

Retrieve a list of domains associated with the authenticated workspace.

Example Usage

from dub import Dub

with Dub(
    token="DUB_API_KEY",
) as dub:

    res = dub.domains.list(request={
        "page": 1,
        "page_size": 50,
    })

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description
request operations.ListDomainsRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.ListDomainsResponse

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.SDKError 4XX, 5XX */*

update

Update a domain for the authenticated workspace.

Example Usage

from dub import Dub

with Dub(
    token="DUB_API_KEY",
) as dub:

    res = dub.domains.update(slug="acme.com", request_body={
        "slug": "acme.com",
        "expired_url": "https://acme.com/expired",
        "not_found_url": "https://acme.com/not-found",
        "archived": False,
        "placeholder": "https://dub.co/help/article/what-is-dub",
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
slug str ✔️ The domain name. acme.com
request_body Optional[operations.UpdateDomainRequestBody] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

components.DomainSchema

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.SDKError 4XX, 5XX */*

delete

Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain.

Example Usage

from dub import Dub

with Dub(
    token="DUB_API_KEY",
) as dub:

    res = dub.domains.delete(slug="acme.com")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
slug str ✔️ The domain name. acme.com
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.DeleteDomainResponseBody

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.SDKError 4XX, 5XX */*