cws

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SessionHeader is the header key for a session.
	SessionHeader = "Token"
	// HeaderAuthorization is the HTTP header Authorization.
	HeaderAuthorization = "Authorization"
	// AuthorizationBearer is the bearer HTTP authorization type.
	AuthorizationBearer = "BEARER"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client CWS client to perform actions the against CWS service

func NewClient

func NewClient(publicAPIHost, internalAPIHost, apiKey string) *Client

NewClient returns a new CWS client

func (*Client) CreateInstallation

func (c *Client) CreateInstallation(installationRequest *CreateInstallationRequest) (*CreateInstallationResponse, error)

CreateInstallation creates a new installation in CWS using the parameters paseed in the installation request

func (*Client) DeleteInstallation

func (c *Client) DeleteInstallation(installationID string) error

DeleteInstallation deleted the installation passed as parameter

func (*Client) DeleteStripeWebhook added in v0.3.11

func (c *Client) DeleteStripeWebhook(owner string) error

DeleteStripeWebhook Calls test portal's internal API to delete a webhook endpoint in Stripe

func (*Client) GetInstallations

func (c *Client) GetInstallations() ([]*Installation, error)

GetInstallations returns the installations associated that belongs to the logged user

func (*Client) GetMyCustomers

func (c *Client) GetMyCustomers() ([]*Customer, error)

GetMyCustomers returns the customers asociated to the logged user

func (*Client) Login

func (c *Client) Login(email, password string) (*User, error)

Login perform a login in the CWS API

func (*Client) RegisterStripeWebhook added in v0.3.11

func (c *Client) RegisterStripeWebhook(url, owner string) (string, error)

RegisterStripeWebhook Calls test portal's internal API to register a new webhook endpoint in Stripe

func (*Client) SignUp

func (c *Client) SignUp(email, password string) (*SignupResponse, error)

SignUp sign up a new user in the CWS service

func (*Client) VerifyUser

func (c *Client) VerifyUser(userID string) error

VerifyUser verifies the user passed a parameter

type CreateInstallationRequest

type CreateInstallationRequest struct {
	CustomerID             string `json:"customer_id"`
	RequestedWorkspaceName string `json:"workspace_name"`
	Version                string `json:"version"`
	Image                  string `json:"image"`
	GroupID                string `json:"group_id"`
	APILock                bool   `json:"api_lock"`
}

CreateInstallationRequest needed parameters to create a new installation in CWS

type CreateInstallationResponse

type CreateInstallationResponse struct {
	InstallationID string `json:"installationId"`
	Token          string `json:"token"`
}

CreateInstallationResponse model returned after a installation is created successfully

type Customer

type Customer struct {
	ID        string `json:"id"`
	CreatorID string `json:"creator_id"`
}

Customer model that represents a CWS customer

type Installation

type Installation struct {
	ID             string
	State          string
	SubscriptionID string
	CustomerID     string
}

Installation model that represents a CWS installation

type RegisterStripeWebhookResponse added in v0.3.11

type RegisterStripeWebhookResponse struct {
	Secret string `json:"secret"`
}

RegisterStripeWebhookResponse model returned after webhook endpoint is registered in Stripe by the test portal

type SignupResponse

type SignupResponse struct {
	User     *User     `json:"user"`
	Customer *Customer `json:"customer"`
}

SignupResponse model returned after the signup is called succesfully

type User

type User struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

User model that represents a CWS user

Jump to

Keyboard shortcuts

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