Skip to content

Latest commit

 

History

History
109 lines (79 loc) · 3.99 KB

File metadata and controls

109 lines (79 loc) · 3.99 KB

Client

(Client)

Overview

Client API

Available Operations

GetConfiguration

Returns the configuration for the agent.

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Client.GetConfiguration(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetConfigurationResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

Authenticate

Authenticates the client. This is used to verify that the client is able to connect to the server.

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Client.Authenticate(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.AuthenticateResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*