(Links)
- Create - Create a new link
- List - Retrieve a list of links
- Count - Retrieve links count
- Get - Retrieve a link
- Update - Update a link
- Delete - Delete a link
- CreateMany - Bulk create links
- UpdateMany - Bulk update links
- DeleteMany - Bulk delete links
- Upsert - Upsert a link
Create a new link for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.Create(ctx, &operations.CreateLinkRequestBody{
URL: "https://google.com",
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateLinkRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LinkSchema, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Retrieve a paginated list of links for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.List(ctx, operations.GetLinksRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetLinksRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetLinksResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Retrieve the number of links for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.Count(ctx, operations.GetLinksCountRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetLinksCountRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*float64, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Retrieve the info for a link.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.Get(ctx, operations.GetLinkInfoRequest{
LinkID: dubgo.String("clux0rgak00011..."),
ExternalID: dubgo.String("123456"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetLinkInfoRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LinkSchema, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Update a link for the authenticated workspace. If there's no change, returns it as it is.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.Update(ctx, "<id>", &operations.UpdateLinkRequestBody{
URL: dubgo.String("https://google.com"),
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateUpdateLinkTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
linkID |
string | ✔️ | The id of the link to update. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
requestBody |
*operations.UpdateLinkRequestBody | ➖ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LinkSchema, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Delete a link for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.Delete(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
linkID |
string | ✔️ | The id of the link to delete. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DeleteLinkResponseBody, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Bulk create up to 100 links for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.CreateMany(ctx, []operations.RequestBody{
operations.RequestBody{
URL: "https://google.com",
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateBulkCreateLinksTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
},
operations.RequestBody{
URL: "https://google.com",
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateBulkCreateLinksTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
[]operations.RequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
[]operations.ResponseBody, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Bulk update up to 100 links with the same data for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.UpdateMany(ctx, &operations.BulkUpdateLinksRequestBody{
Data: operations.Data{
URL: dubgo.String("https://google.com"),
TagIds: dubgo.Pointer(operations.CreateBulkUpdateLinksTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.BulkUpdateLinksRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
[]components.LinkSchema, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Bulk delete up to 100 links for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.DeleteMany(ctx, operations.BulkDeleteLinksRequest{
LinkIds: []string{
"clux0rgak00011...",
"clux0rgak00022...",
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.BulkDeleteLinksRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.BulkDeleteLinksResponseBody, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
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.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Links.Upsert(ctx, &operations.UpsertLinkRequestBody{
URL: "https://google.com",
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateUpsertLinkTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpsertLinkRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LinkSchema, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |