Documentation
¶
Overview ¶
Package tooling provides Tooling API operations.
Index ¶
- type ApexClass
- type ApexLog
- type ApexTestResult
- type ApexTrigger
- type Completion
- type Completions
- type ExecuteAnonymousResult
- type FieldMetadata
- type HTTPClient
- type QueryResult
- type SObjectMetadata
- type Service
- func (s *Service) CreateApexClass(ctx context.Context, name, body string, apiVersion float64) (*ApexClass, error)
- func (s *Service) DeleteApexClass(ctx context.Context, id string) error
- func (s *Service) Describe(ctx context.Context, objectType string) (*SObjectMetadata, error)
- func (s *Service) DescribeGlobal(ctx context.Context) ([]SObjectMetadata, error)
- func (s *Service) ExecuteAnonymous(ctx context.Context, apexCode string) (*ExecuteAnonymousResult, error)
- func (s *Service) GetApexClass(ctx context.Context, id string) (*ApexClass, error)
- func (s *Service) GetApexLogBody(ctx context.Context, logId string) (string, error)
- func (s *Service) GetApexLogs(ctx context.Context, limit int) ([]ApexLog, error)
- func (s *Service) GetCompletions(ctx context.Context, completionType string) (*Completions, error)
- func (s *Service) Query(ctx context.Context, query string) (*QueryResult, error)
- func (s *Service) QueryMore(ctx context.Context, nextRecordsURL string) (*QueryResult, error)
- func (s *Service) RunTestsAsynchronous(ctx context.Context, classIds []string) (string, error)
- func (s *Service) RunTestsSynchronous(ctx context.Context, classNames []string) (*TestResult, error)
- func (s *Service) UpdateApexClass(ctx context.Context, id, body string) error
- type TestQueueItem
- type TestResult
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 ¶
DeleteApexClass deletes an Apex class.
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 ¶
GetApexClass retrieves an Apex class by ID.
func (*Service) GetApexLogBody ¶
GetApexLogBody retrieves the body of a debug log.
func (*Service) GetApexLogs ¶
GetApexLogs retrieves debug logs.
func (*Service) GetCompletions ¶
GetCompletions retrieves code completions.
func (*Service) RunTestsAsynchronous ¶
RunTestsAsynchronous runs Apex tests asynchronously.
func (*Service) RunTestsSynchronous ¶
func (s *Service) RunTestsSynchronous(ctx context.Context, classNames []string) (*TestResult, error)
RunTestsSynchronous runs Apex tests synchronously.
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.