Skip to content

Latest commit

 

History

History
140 lines (106 loc) · 9.49 KB

README.md

File metadata and controls

140 lines (106 loc) · 9.49 KB

Connectors

(Connector.Connectors)

Overview

Available Operations

  • List - List Connectors
  • Get - Get Connector

List

List Connectors

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Connector.Connectors.List(ctx, nil, nil, nil, &components.ConnectorsFilter{
        UnifiedAPI: components.UnifiedAPIIDFileStorage.ToPointer(),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetConnectorsResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
appID *string The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
cursor *string Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
limit *int64 Number of results to return. Minimum 1, Maximum 200, Default 20
filter *components.ConnectorsFilter Apply filters {
"unified_api": "file-storage"
}
opts []operations.Option The options for this request.

Response

*operations.ConnectorConnectorsAllResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.APIError 4XX, 5XX */*

Get

Get Connector

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Connector.Connectors.Get(ctx, "<id>", nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.GetConnectorResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
id string ✔️ ID of the record you are acting upon.
appID *string The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
opts []operations.Option The options for this request.

Response

*operations.ConnectorConnectorsOneResponse, error

Errors

Error Type Status Code Content Type
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.APIError 4XX, 5XX */*