cyberrisk

package module
v0.0.0-...-9d0e7ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 8 Imported by: 0

README

cyberrisk

(BETA) Go SDK for the cyberrisk rating

Documentation

The link to the documentation can found at Open API Nimbusec. The format of the documentation is OpenAPI using the version 3.

Documentation

Index

Constants

View Source
const (
	StatusRatingInProgress    = "in-progress"
	StatusRatingValidation    = "validation"
	StatusRatingJustification = "justification"
	StatusRatingRevalidation  = "revalidation"
	StatusRatingFinalization  = "finalization"
	StatusRatingDone          = "done"
	StatusRatingDeclined      = "declined"
	StatusRatingBlocked       = "blocked"
	StatusRatingExpired       = "expired"
)
View Source
const (
	StatusCScoreInProgress = "in-progress"
	StatusCScoreDone       = "done"
	StatusCScoreFailed     = "failed"
	StatusCScoreMissing    = "missing"
)

Variables

View Source
var DefaultEndpoint = Endpoint{
	AuthURL:   "https://auth.nimbusec.com/oauth2/token",
	ServerURL: "https://cr.nimbusec.com",
}

Functions

This section is empty.

Types

type Account

type Account struct {
	Contingent int `json:"contingent,omitempty"`
}

type AccountService

type AccountService service

func (AccountService) Get

func (srv AccountService) Get() (Account, error)

type Client

type Client struct {
	Suppliers *SupplierService
	Ratings   *RatingService
	Account   *AccountService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config ClientConfig) *Client

func (*Client) Do

func (client *Client) Do(method, path string, in, out interface{}) error

func (*Client) Ping

func (client *Client) Ping() error

type ClientConfig

type ClientConfig struct {
	ClientID     string
	ClientSecret string
	Endpoint     Endpoint
	Dry          bool
}

type ContingentUsage

type ContingentUsage struct {
	ContingentBefore int      `json:"contingentBefore"`
	ContingentAfter  int      `json:"contingentAfter"`
	OrderedSuppliers []string `json:"orderedSuppliers"`
}

type Endpoint

type Endpoint struct {
	AuthURL   string
	ServerURL string
}

type Error

type Error struct {
	Message    string            `json:"message"`
	Validation map[string]string `json:"validation,omitempty"`
}

func (Error) Error

func (e Error) Error() string

type OrderRating

type OrderRating struct {
	RequestedCategory string `json:"requestedCategory"` // mandatory
}

type PostSuppliersReturn

type PostSuppliersReturn struct {
	Created int              `json:"created"`
	Existed int              `json:"existed"`
	Orders  *ContingentUsage `json:"orders,omitempty"`
}

type Rating

type Rating struct {
	CompanyName          string     `json:"companyName,omitempty"`
	SupplierID           string     `json:"supplierID"`
	ExternalID           string     `json:"externalID,omitempty"` // Deprecated
	ExternalIDs          []string   `json:"externalIDs,omitempty"`
	AScore               int        `json:"aScore,omitempty"`
	BScore               int        `json:"bScore,omitempty"`
	Status               string     `json:"status,omitempty"`
	ValidFrom            *time.Time `json:"validFrom,omitempty"`
	ValidUntil           *time.Time `json:"validUntil,omitempty"`
	AssessmentValidUntil *time.Time `json:"-"` // internal only
	CyberTrustLabel      string     `json:"cyberTrustLabel,omitempty"`
	CScore               int        `json:"cScore,omitempty"`
	StatusCScore         string     `json:"statusCScore,omitempty"`
	Websites             []string   `json:"websites,omitempty"`
}

type RatingFilter

type RatingFilter struct {
	Status      []string `url:"status"`
	SupplierIDs []string `url:"supplier-id"`
	ExternalIDs []string `url:"external-id"`
}

type RatingService

type RatingService service

func (RatingService) Create

func (srv RatingService) Create(create []RequestRating) ([]Rating, error)

func (RatingService) List

func (srv RatingService) List(filter *RatingFilter) ([]Rating, error)

type RequestRating

type RequestRating struct {
	Category   string `json:"category"`
	SupplierID string `json:"supplierID,omitempty"`
	ExternalID string `json:"externalID,omitempty"`
}

type RequestSupplier

type RequestSupplier struct {
	VAT         string   `json:"vat"`         // mandatory
	CompanyName string   `json:"companyName"` // mandatory
	Language    string   `json:"language"`    // mandatory
	Email       string   `json:"email"`       // mandatory
	Websites    []string `json:"websites"`    // mandatory

	Forename string `json:"forename,omitempty"` // optional
	Surname  string `json:"surname,omitempty"`  // optional
	Tel      string `json:"tel,omitempty"`      // optional

	Street      string   `json:"street,omitempty"`      // optional
	ZipCode     string   `json:"zipCode,omitempty"`     // optional
	City        string   `json:"city,omitempty"`        // optional
	Country     string   `json:"country,omitempty"`     // optional
	Sector      string   `json:"sector,omitempty"`      // optional
	ExternalID  string   `json:"externalID,omitempty"`  // Deprecated
	ExternalIDs []string `json:"externalIDs,omitempty"` // optional

	OrderRating *OrderRating `json:"orderRating,omitempty"` // optional
}

type Supplier

type Supplier struct {
	VAT         string   `json:"vat"`
	CompanyName string   `json:"companyName"`
	Language    string   `json:"language"`
	Email       string   `json:"email"`
	Websites    []string `json:"websites"`

	Forename string `json:"forename,omitempty"`
	Surname  string `json:"surname,omitempty"`
	Tel      string `json:"tel,omitempty"`

	Street  string `json:"street,omitempty"`
	ZipCode string `json:"zipCode,omitempty"`
	City    string `json:"city,omitempty"`
	Country string `json:"country,omitempty"`
	Sector  string `json:"sector,omitempty"`

	ExternalID string `json:"externalID,omitempty"`
	ID         string `json:"id"`

	Rating *Rating `json:"rating,omitempty"`
}

type SupplierFilter

type SupplierFilter struct {
	IncludeRatings bool `url:"include-ratings"`
}

type SupplierService

type SupplierService service

func (SupplierService) Create

func (srv SupplierService) Create(create []RequestSupplier) ([]Supplier, error)

func (SupplierService) List

func (srv SupplierService) List(filter *SupplierFilter) ([]Supplier, error)

func (SupplierService) Unassign

func (srv SupplierService) Unassign(unassign UnassignSupplier) error

type UnassignSupplier

type UnassignSupplier struct {
	SupplierIDs []string `url:"supplier-id"`
	ExternalIDs []string `url:"external-id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL