primary_api

package
v0.0.0-...-de3990d Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID     int    `json:"id,omitempty"`
	Key    string `json:"key,omitempty"`
	UserID int    `json:"userId,omitempty"`
	User   *User  `json:"user,omitempty"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

type CourseDataResponse

type CourseDataResponse struct {
	Message    string                 `json:"message"`
	StatusCode int                    `json:"statusCode"`
	Data       []CourseDataResult     `json:"data"`
	Errors     *FieldValidationErrors `json:"errors"`
	Error      bool                   `json:"error"`
}

type CourseDataResult

type CourseDataResult struct {
	ID                  int         `json:"id"`
	Name                string      `json:"name"`
	Description         string      `json:"description"`
	ImageName           interface{} `json:"imageName"`
	ImagePath           interface{} `json:"imagePath"`
	ThumbnailPath       string      `json:"thumbnailPath"`
	PdfPath             interface{} `json:"pdfPath"`
	PdfName             interface{} `json:"pdfName"`
	ShortDesc           string      `json:"shortDesc"`
	LongDesc            string      `json:"longDesc"`
	Details             interface{} `json:"details"`
	Public              bool        `json:"public"`
	Demo                bool        `json:"demo"`
	Status              string      `json:"status"`
	Deleted             bool        `json:"deleted"`
	Industry            string      `json:"industry"`
	DistributorID       int         `json:"distributorId"`
	Developer           string      `json:"developer"`
	UpdatedBy           string      `json:"updatedBy"`
	IsMultiplayer       bool        `json:"isMultiplayer"`
	PassingScoreEnabled bool        `json:"passingScoreEnabled"`
	OrgModule           []OrgModule `json:"orgModule"`
	CreatedAt           time.Time   `json:"createdAt"`
	UpdatedAt           time.Time   `json:"updatedAt"`
}

type Event

type Event struct {
	ID        int         `json:"id"`
	UUID      string      `json:"uuid"`
	SessionID int         `json:"sessionId"`
	UserID    int         `json:"userId"`
	EventType string      `json:"eventType"`
	Data      EventResult `json:"jsonData"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type EventResult

type EventResult struct {
	Score           float32 `json:"score"`
	SessionDuration int     `json:"sessionDuration"`
}

type FieldValidationError

type FieldValidationError struct {
	Location string `json:"location"`
	Msg      string `json:"msg"`
	Path     string `json:"path"`
	Type     string `json:"type"`
	Value    string `json:"value"`
}

type FieldValidationErrors

type FieldValidationErrors struct {
	OrgID     *FieldValidationError `json:"orgID"`
	StartDate *FieldValidationError `json:"startDate"`
	EndDate   *FieldValidationError `json:"endDate"`
}

type GameProfileMetaDataResponse

type GameProfileMetaDataResponse struct {
	Error      bool                   `json:"error"`
	StatusCode int                    `json:"statusCode"`
	Message    string                 `json:"message"`
	Profiles   []*GameProfileMetadata `json:"profiles"`

	CreatedBy string `json:"createdBy"`
	UpdatedBy string `json:"updatedBy"`

	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

type GameProfileMetadata

type GameProfileMetadata struct {
	OrgID         int                      `json:"orgId"`
	Config        MultiplayerServerConfig  `json:"config"`
	ServerVersion MultiplayerServerVersion `json:"serverVersion"`

	CreatedBy string `json:"createdBy"`
	UpdatedBy string `json:"updatedBy"`

	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

type GitConfig

type GitConfig struct {
	Provider string `json:"provider,omitempty"`
	OrgName  string `json:"orgName,omitempty"`
	RepoName string `json:"repoName,omitempty"`
}

type JSONEvent

type JSONEvent struct {
	ID              string  `json:"id,omitempty"`
	SessionDuration float64 `json:"sessionDuration,omitempty"`
	LessonStatus    *string `json:"lessonStatus,omitempty"`
	ModuleName      string  `json:"moduleName,omitempty"`
	Actor           struct {
		Name *string `json:"name,omitempty"`
		Mbox *string `json:"mBox,omitempty"`
	} `json:"actor,omitempty"`
	Verb struct {
		ID      *string `json:"id,omitempty"`
		Display struct {
			EN *string `json:"en,omitempty"`
		} `json:"display,omitempty"`
	} `json:"verb,omitempty"`
	Object *struct {
		ID *string `json:"id,omitempty"`
	} `json:"object,omitempty"`
	Result  *Result `json:"result,omitempty"`
	Context *struct {
		Registration string                 `json:"registration,omitempty"`
		Revision     string                 `json:"revision,omitempty"`
		Extensions   map[string]interface{} `json:"extensions,omitempty"`
	} `json:"context,omitempty"`

	Score       *float64 `json:"score,omitempty"`
	ScoreMin    *float64 `json:"scoreMin,omitempty"`
	ScoreMax    *float64 `json:"scoreMax,omitempty"`
	ScoreScaled *float64 `json:"scoreScaled,omitempty"`
	Success     *bool    `json:"success,omitempty"`
}

type LearningHistoryResponse

type LearningHistoryResponse struct {
	Message    string                  `json:"message"`
	StatusCode int                     `json:"statusCode"`
	Data       []LearningHistoryResult `json:"data"`
	Errors     *FieldValidationErrors  `json:"errors"`
	Error      bool                    `json:"error"`
}

type LearningHistoryResult

type LearningHistoryResult struct {
	ID        int       `json:"id"`
	ModuleID  int       `json:"moduleId"`
	UserID    int       `json:"userId"`
	Module    Module    `json:"module"`
	User      User      `json:"user"`
	Events    []Event   `json:"events"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type LegacyAuthResponse

type LegacyAuthResponse struct {
	User struct {
		Token string `json:"authToken"`
		Role  string `json:"role"`
	}
}

type LoginRequest

type LoginRequest struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

type MockClient

type MockClient struct {
	NumCalledLogin int
	LoginError     error

	NumCalledCreateWebhook int
	CreateWebhookError     error

	NumCalledGetWebhooks int
	GetWebhooksError     error

	NumCalledDeleteWebhook int
	DeleteWebhookError     error
}

func (*MockClient) CreateWebhook

func (m *MockClient) CreateWebhook(webhook Webhook) error

func (*MockClient) DeleteWebhook

func (m *MockClient) DeleteWebhook(id int) error

func (*MockClient) GetWebhooks

func (m *MockClient) GetWebhooks(orgID int) ([]Webhook, error)

func (*MockClient) Login

func (m *MockClient) Login(username, password string) error

type Module

type Module struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`

	GitConfigID int       `json:"gitConfigId,omitempty"`
	GitConfig   GitConfig `json:"gitConfig,omitempty"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

type MultiplayerServerConfig

type MultiplayerServerConfig struct {
	ID              int    `json:"id"`
	Capacity        int    `json:"capacity,omitempty"`
	StandbyReplicas string `json:"standbyReplicas,omitempty"`
	Disabled        bool   `json:"disabled,omitempty"`

	ModuleID int     `json:"moduleId,omitempty"`
	Module   *Module `json:"module,omitempty"`

	ServerVersions []*MultiplayerServerVersion `json:"serverVersions,omitempty"`

	CreatedBy string `json:"createdBy,omitempty"`
	UpdatedBy string `json:"updatedBy,omitempty"`
}

type MultiplayerServerTrigger

type MultiplayerServerTrigger struct {
	ID         int    `json:"id,omitempty"`
	Revision   string `json:"revision,omitempty"`
	Dockerfile string `json:"dockerfile,omitempty"`
	Context    string `json:"context,omitempty"`
	Config     string `json:"config,omitempty"`

	Module   *Module `json:"module,omitempty"`
	ModuleID int     `json:"moduleId,omitempty"`

	CreatedBy string `json:"createdBy,omitempty"`
	UpdatedBy string `json:"updatedBy,omitempty"`

	CreatedAt string `json:"createdAt,omitempty"`
	UpdatedAt string `json:"updatedAt,omitempty"`
}

type MultiplayerServerVersion

type MultiplayerServerVersion struct {
	ID              int    `json:"id,omitempty" graphql:"id"`
	Engine          string `json:"engine,omitempty" graphql:"engine"`
	Status          string `json:"status,omitempty" graphql:"status"`
	ImageRegistry   string `json:"imageRegistry" graphql:"imageRegistry"`
	SemanticVersion string `json:"semanticVersion,omitempty" graphql:"semanticVersion"`
	FileLink        string `json:"fileLink,omitempty" graphql:"fileLink"`

	ModuleID int     `json:"moduleId,omitempty" graphql:"moduleId"`
	Module   *Module `json:"module,omitempty" graphql:"module"`

	CreatedBy string `json:"createdBy" graphql:"createdBy"`
	UpdatedBy string `json:"updatedBy" graphql:"updatedBy"`
}

type OldAPIClient

type OldAPIClient interface {
	Login(username, password string) error
	CreateWebhook(webhook Webhook) error
	GetWebhooks(orgID int) ([]Webhook, error)
	DeleteWebhook(webhookID int) error
}

type Org

type Org struct {
	ID        int       `json:"id"`
	Name      string    `json:"name"`
	Type      string    `json:"type"`
	Status    string    `json:"enabled"`
	CreatedAt time.Time `json:"createdAt"`
}

type OrgModule

type OrgModule struct {
	ID             int       `json:"id"`
	ModuleID       int       `json:"moduleId"`
	OrgID          int       `json:"orgId"`
	Lifetime       bool      `json:"lifetime"`
	ExpirationDate time.Time `json:"expirDate"`
	LearningType   string    `json:"learningType"`
	CompleteStatus string    `json:"completeStatus"`
	ExternalID     string    `json:"externalId"`
}

type OrgResponse

type OrgResponse struct {
	Error      bool                   `json:"error"`
	Message    string                 `json:"message"`
	StatusCode *int                   `json:"statusCode"`
	Orgs       *[]Org                 `json:"orgs"`
	Errors     *FieldValidationErrors `json:"errors"`
}

type PrimaryAPIClient

type PrimaryAPIClient struct {
	abstractClient.AbstractServiceClient
}

PrimaryAPIClient is a struct for the primary API that contains an abstract client

func NewClient

func NewClient(config urlfinder.ClientConfig) *PrimaryAPIClient

NewClient is a function that returns a AbstractServiceClient

func NewClientWithBasicAuth

func NewClientWithBasicAuth(username, password string, config urlfinder.ClientConfig) (*PrimaryAPIClient, error)

NewClientWithBasicAuth is a function that returns a AbstractServiceClient with basic auth performed

func (*PrimaryAPIClient) ActiveUserID

func (p *PrimaryAPIClient) ActiveUserID() int

func (*PrimaryAPIClient) CreateWebhook

func (p *PrimaryAPIClient) CreateWebhook(input Webhook) error

CreateWebhook creates a webhook with the given description and endpoint.

func (*PrimaryAPIClient) DeleteWebhook

func (p *PrimaryAPIClient) DeleteWebhook(id int) error

DeleteWebhook deletes a webhook with the given ID.

func (*PrimaryAPIClient) DeployMultiplayerServerVersion

func (p *PrimaryAPIClient) DeployMultiplayerServerVersion(moduleID int, image, semanticVersion string) (*resty.Response, error)

func (*PrimaryAPIClient) GetMatchmakingProfiles

func (p *PrimaryAPIClient) GetMatchmakingProfiles() ([]*GameProfileMetadata, error)

func (*PrimaryAPIClient) GetWebhooks

func (p *PrimaryAPIClient) GetWebhooks(orgID int) ([]Webhook, error)

GetWebhooks returns a list of webhooks.

func (*PrimaryAPIClient) Login

func (p *PrimaryAPIClient) Login(username, password string) error

Login performs a login request to the API

func (*PrimaryAPIClient) UpdateMultiplayerServerVersion

func (p *PrimaryAPIClient) UpdateMultiplayerServerVersion(versionID int, image string) (*resty.Response, error)

type Result

type Result struct {
	Completion bool   `json:"completion,omitempty"`
	Success    bool   `json:"success,omitempty"`
	Duration   string `json:"duration,omitempty"`
	Score      *struct {
		Scaled float32 `json:"scaled,omitempty"`
		Raw    float64 `json:"raw,omitempty"`
		Min    float32 `json:"min,omitempty"`
		Max    float32 `json:"max,omitempty"`
	} `json:"score,omitempty"`
}

type User

type User struct {
	ID         int    `json:"id,omitempty"`
	Role       string `json:"role,omitempty"`
	OrgID      int    `json:"orgId,omitempty"`
	Org        Org    `json:"org,omitempty"`
	Username   string `json:"username,omitempty"`
	Password   string `json:"-"`
	FirstName  string `json:"firstName,omitempty"`
	LastName   string `json:"lastName,omitempty"`
	Email      string `json:"email,omitempty"`
	ExternalID string `json:"externalId,omitempty"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

type Webhook

type Webhook struct {
	ID          int    `json:"id,omitempty"`
	OrgID       int    `json:"orgId,omitempty"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
}

Jump to

Keyboard shortcuts

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