tooling

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package tooling provides Tooling API operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApexClass

type ApexClass struct {
	Id                    string `json:"Id"`
	Name                  string `json:"Name"`
	Body                  string `json:"Body"`
	ApiVersion            string `json:"ApiVersion"`
	Status                string `json:"Status"`
	IsValid               bool   `json:"IsValid"`
	LengthWithoutComments int    `json:"LengthWithoutComments"`
	NamespacePrefix       string `json:"NamespacePrefix,omitempty"`
}

ApexClass represents an Apex class.

type ApexLog

type ApexLog struct {
	Id             string `json:"Id"`
	Application    string `json:"Application"`
	DurationMillis int    `json:"DurationMilliseconds"`
	Location       string `json:"Location"`
	LogLength      int    `json:"LogLength"`
	LogUserId      string `json:"LogUserId"`
	Operation      string `json:"Operation"`
	Request        string `json:"Request"`
	StartTime      string `json:"StartTime"`
	Status         string `json:"Status"`
}

ApexLog represents an Apex debug log.

type ApexTestResult

type ApexTestResult struct {
	ID            string  `json:"id"`
	ApexClassId   string  `json:"apexClassId"`
	ApexClassName string  `json:"apexClassName"`
	MethodName    string  `json:"methodName"`
	Outcome       string  `json:"outcome"`
	Message       string  `json:"message,omitempty"`
	StackTrace    string  `json:"stackTrace,omitempty"`
	RunTime       float64 `json:"runTime"`
}

ApexTestResult contains individual test results.

type ApexTrigger

type ApexTrigger struct {
	Id            string `json:"Id"`
	Name          string `json:"Name"`
	Body          string `json:"Body"`
	ApiVersion    string `json:"ApiVersion"`
	Status        string `json:"Status"`
	IsValid       bool   `json:"IsValid"`
	TableEnumOrId string `json:"TableEnumOrId"`
}

ApexTrigger represents an Apex trigger.

type Completion

type Completion struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	Signature string `json:"signature,omitempty"`
}

Completion represents a code completion suggestion.

type Completions

type Completions struct {
	Completions []Completion `json:"completions"`
}

Completions contains code completion results.

type ExecuteAnonymousResult

type ExecuteAnonymousResult struct {
	Line                int    `json:"line"`
	Column              int    `json:"column"`
	Compiled            bool   `json:"compiled"`
	Success             bool   `json:"success"`
	CompiledClass       string `json:"compiledClass,omitempty"`
	CompileProblem      string `json:"compileProblem,omitempty"`
	ExceptionMessage    string `json:"exceptionMessage,omitempty"`
	ExceptionStackTrace string `json:"exceptionStackTrace,omitempty"`
}

ExecuteAnonymousResult contains execute anonymous results.

type FieldMetadata

type FieldMetadata struct {
	Name       string `json:"name"`
	Label      string `json:"label"`
	Type       string `json:"type"`
	Createable bool   `json:"createable"`
	Updateable bool   `json:"updateable"`
}

FieldMetadata describes a tooling field.

type HTTPClient

type HTTPClient interface {
	Get(ctx context.Context, path string) ([]byte, error)
	Post(ctx context.Context, path string, body interface{}) ([]byte, error)
	Patch(ctx context.Context, path string, body interface{}) ([]byte, error)
	Delete(ctx context.Context, path string) ([]byte, error)
}

HTTPClient interface for dependency injection.

type QueryResult

type QueryResult struct {
	Size           int                      `json:"size"`
	TotalSize      int                      `json:"totalSize"`
	Done           bool                     `json:"done"`
	NextRecordsUrl string                   `json:"nextRecordsUrl,omitempty"`
	Records        []map[string]interface{} `json:"records"`
}

QueryResult contains tooling query results.

type SObjectMetadata

type SObjectMetadata struct {
	Name       string          `json:"name"`
	Label      string          `json:"label"`
	Createable bool            `json:"createable"`
	Updateable bool            `json:"updateable"`
	Queryable  bool            `json:"queryable"`
	Fields     []FieldMetadata `json:"fields,omitempty"`
}

SObjectMetadata contains describe metadata for tooling objects.

type Service

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

Service provides Tooling API operations.

func NewService

func NewService(client HTTPClient, apiVersion string) *Service

NewService creates a new Tooling service.

func (*Service) CreateApexClass

func (s *Service) CreateApexClass(ctx context.Context, name, body string, apiVersion float64) (*ApexClass, error)

CreateApexClass creates a new Apex class.

func (*Service) DeleteApexClass

func (s *Service) DeleteApexClass(ctx context.Context, id string) error

DeleteApexClass deletes an Apex class.

func (*Service) Describe

func (s *Service) Describe(ctx context.Context, objectType string) (*SObjectMetadata, error)

Describe retrieves metadata for a Tooling API object.

func (*Service) DescribeGlobal

func (s *Service) DescribeGlobal(ctx context.Context) ([]SObjectMetadata, error)

DescribeGlobal lists all Tooling API objects.

func (*Service) ExecuteAnonymous

func (s *Service) ExecuteAnonymous(ctx context.Context, apexCode string) (*ExecuteAnonymousResult, error)

ExecuteAnonymous executes anonymous Apex code.

func (*Service) GetApexClass

func (s *Service) GetApexClass(ctx context.Context, id string) (*ApexClass, error)

GetApexClass retrieves an Apex class by ID.

func (*Service) GetApexLogBody

func (s *Service) GetApexLogBody(ctx context.Context, logId string) (string, error)

GetApexLogBody retrieves the body of a debug log.

func (*Service) GetApexLogs

func (s *Service) GetApexLogs(ctx context.Context, limit int) ([]ApexLog, error)

GetApexLogs retrieves debug logs.

func (*Service) GetCompletions

func (s *Service) GetCompletions(ctx context.Context, completionType string) (*Completions, error)

GetCompletions retrieves code completions.

func (*Service) Query

func (s *Service) Query(ctx context.Context, query string) (*QueryResult, error)

Query executes a Tooling API query.

func (*Service) QueryMore

func (s *Service) QueryMore(ctx context.Context, nextRecordsURL string) (*QueryResult, error)

QueryMore retrieves additional query results.

func (*Service) RunTestsAsynchronous

func (s *Service) RunTestsAsynchronous(ctx context.Context, classIds []string) (string, error)

RunTestsAsynchronous runs Apex tests asynchronously.

func (*Service) RunTestsSynchronous

func (s *Service) RunTestsSynchronous(ctx context.Context, classNames []string) (*TestResult, error)

RunTestsSynchronous runs Apex tests synchronously.

func (*Service) UpdateApexClass

func (s *Service) UpdateApexClass(ctx context.Context, id, body string) error

UpdateApexClass updates an Apex class body.

type TestQueueItem

type TestQueueItem struct {
	Id              string `json:"Id"`
	ApexClassId     string `json:"ApexClassId"`
	Status          string `json:"Status"`
	ExtendedStatus  string `json:"ExtendedStatus,omitempty"`
	ParentJobId     string `json:"ParentJobId,omitempty"`
	TestRunResultId string `json:"TestRunResultId,omitempty"`
}

TestQueueItem represents an item in the test queue.

type TestResult

type TestResult struct {
	ApexTestResults []ApexTestResult `json:"apexTestResults,omitempty"`
	ApexTestClassId string           `json:"apexTestClassId"`
	AsyncApexJobId  string           `json:"asyncApexJobId"`
	Status          string           `json:"status"`
	NumberRun       int              `json:"numberRun"`
	NumberFailed    int              `json:"numberFailed"`
	TotalTime       float64          `json:"totalTime"`
}

TestResult contains unit test results.

Jump to

Keyboard shortcuts

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