8000 GitHub - tzmfreedom/go-metaforce: Salesforce Metadata API Client for Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tzmfreedom/go-metaforce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Metaforce

Salesforce Metadata API Client for Go

Usage

import "github.com/tzmfreedom/go-metaforce"
  • Login to production/developer
client := metaforce.NewClient()
err := client.Login("username", "password")
  • Login to sandbox
client := metaforce.NewClient("test.salesforce.com", "37.0")
err := client.Login("username", "password")
  • Retrieve Metadata
res, err := client.Retrieve(&metaforce.RetrieveRequest{
 	ApiVersion: 37.0,
   	PackageNames: []string{"CustomObject"},
   	SinglePackage: true,
   	SpecificFiles: []string{},
   	Unpackaged: nil,
})
  • Deploy
res, err := client.Deploy(buf.Bytes())
  • Check Deploy Status
res, err := client.CheckDeployStatus(resultId)
  • Cancel Deploy
res, err := client.CancelDeploy("0Af*********")
  • Check Retrieve Status
res, err := client.DeployRecentValidation("0Af************")
  • Create Metadata
request := []metaforce.MetadataInterface{
  &metaforce.CustomObject{
    FullName: "Go__c",
    Type: "CustomObject",
    DeploymentStatus: metaforce.DeploymentStatusDeployed,
    Description: "from go",
    Label: "Go",
    NameField: &metaforce.CustomField{
      Label: "Go name",
      Length: 80,
      Type: metaforce.FieldTypeText,
    },
    PluralLabel: "Go objects",
    SharingModel: metaforce.SharingModelReadWrite,
  },
}
res, err := client.CreateMetadata(request)
  • Delete Metadata
res, err := client.DeleteMetadata("CustomObject", []string{ "GO__c" })
  • Deploy Recent Validation

  • Describe Metadata

res, err := client.DescribeMetadata()
  • Describe ValueType
res, err := client.DescribeValueType("{http://soap.sforce.com/2006/04/metadata}ApexClass")
  • List Metadata
query := []*metaforce.ListMetadataQuery{
  &metaforce.ListMetadataQuery{
    Type: "ApexClass",
  },
}
res, err := client.ListMetadata(query)
  • Read Metadata
res, err := client.ReadMetadata("CustomObject", []string{ "GO__c" })
  • Rename Metadata
res, err := client.RenameMetadata(&metaforce.RenameMetadata{
	Type: "CustomObject",
    OldFullName: "OLD__c",
    NewFullName: "NEW__c",
})
  • Update Metadata
request := []metaforce.MetadataInterface{
  &metaforce.CustomObject{
    FullName: "Go__c",
    Type: "CustomObject",
    DeploymentStatus: metaforce.DeploymentStatusDeployed,
    Description: "from go",
    Label: "Go",
    NameField: &metaforce.CustomField{
      Label: "Go name",
      Length: 80,
      Type: metaforce.FieldTypeText,
    },
    PluralLabel: "Go objects",
    SharingModel: metaforce.SharingModelReadWrite,
  },
}
res, err := client.UpdateMetadata(request)
  • Upsert Metadata
request := []metaforce.MetadataInterface{
  &metaforce.CustomObject{
    FullName: "Go__c",
    Type: "CustomObject",
    DeploymentStatus: metaforce.DeploymentStatusDeployed,
    Description: "from go",
    Label: "Go",
    NameField: &metaforce.CustomField{
      Label: "Go name",
      Length: 80,
      Type: metaforce.FieldTypeText,
    },
    PluralLabel: "Go objects",
    SharingModel: metaforce.SharingModelReadWrite,
  },
}
res, err := client.UpsertMetadata(request)

About

Salesforce Metadata API Client for Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0