Skip to content

Latest commit

 

History

History
545 lines (392 loc) · 31.3 KB

README.md

File metadata and controls

545 lines (392 loc) · 31.3 KB

Links

(links)

Overview

Available Operations

create

Create a new link for the authenticated workspace.

Example Usage

from dub import Dub

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

    res = dub.links.create(request={
        "url": "https://google.com",
        "external_id": "123456",
        "tag_ids": [
            "clux0rgak00011...",
        ],
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

components.LinkSchema

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 paginated list of links for the authenticated workspace.

Example Usage

from dub import Dub

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

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

    while res is not None:
        # Handle items

        res = res.next()

Parameters

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

Response

operations.GetLinksResponse

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 */*

count

Retrieve the number of links for the authenticated workspace.

Example Usage

from dub import Dub

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

    res = dub.links.count(request={})

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

float

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 */*

get

Retrieve the info for a link.

Example Usage

from dub import Dub

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

    res = dub.links.get(request={
        "link_id": "clux0rgak00011...",
        "external_id": "123456",
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

components.LinkSchema

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 link for the authenticated workspace. If there's no change, returns it as it is.

Example Usage

from dub import Dub

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

    res = dub.links.update(link_id="<value>", request_body={
        "url": "https://google.com",
        "external_id": "123456",
        "tag_ids": [
            "clux0rgak00011...",
        ],
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
link_id str ✔️ The id of the link to update. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_.
request_body Optional[operations.UpdateLinkRequestBody] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

components.LinkSchema

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 link for the authenticated workspace.

Example Usage

from dub import Dub

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

    res = dub.links.delete(link_id="<value>")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
link_id str ✔️ The id of the link to delete. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.DeleteLinkResponseBody

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 */*

create_many

Bulk create up to 100 links for the authenticated workspace.

Example Usage

from dub import Dub

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

    res = dub.links.create_many(request=[
        {
            "url": "https://google.com",
            "external_id": "123456",
            "tag_ids": [
                "clux0rgak00011...",
            ],
        },
    ])

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

List[components.LinkSchema]

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_many

Bulk update up to 100 links with the same data for the authenticated workspace.

Example Usage

from dub import Dub

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

    res = dub.links.update_many(request={
        "data": {
            "url": "https://google.com",
            "tag_ids": [
                "clux0rgak00011...",
            ],
        },
        "link_ids": [
            "<value>",
        ],
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

List[components.LinkSchema]

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_many

Bulk delete up to 100 links for the authenticated workspace.

Example Usage

from dub import Dub

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

    res = dub.links.delete_many(request={
        "link_ids": [
            "clux0rgak00011...",
            "clux0rgak00022...",
        ],
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

operations.BulkDeleteLinksResponseBody

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 */*

upsert

Upsert a link for the authenticated workspace by its URL. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created.

Example Usage

from dub import Dub

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

    res = dub.links.upsert(request={
        "url": "https://google.com",
        "external_id": "123456",
        "tag_ids": [
            "clux0rgak00011...",
        ],
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

components.LinkSchema

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 */*