Skip to content

Commit

Permalink
Add retrieve call to force client
Browse files Browse the repository at this point in the history
  • Loading branch information
tzmfreedom committed Feb 15, 2017
1 parent 7c05b06 commit 66d2710
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
34 changes: 34 additions & 0 deletions force.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,37 @@ func (client *ForceClient) CheckDeployStatus(resultId *ID) (*CheckDeployStatusRe
check_request := CheckDeployStatus{AsyncProcessId: resultId, IncludeDetails: true}
return client.portType.CheckDeployStatus(&check_request)
}

func (client *ForceClient) Retrieve() (*RetrieveResponse, error) {
request := Retrieve{
RetrieveRequest: &RetrieveRequest{
ApiVersion: 38,
Unpackaged: &Package{
Types: []*PackageTypeMembers{
&PackageTypeMembers{
Name: "ApexClass",
Members: []string{"HelloSpm_Dep"},
},
},
},
},
}
sessionHeader := SessionHeader{
SessionId: client.loginResult.SessionId,
}
client.portType.SetHeader(&sessionHeader)
client.portType.SetServerUrl(client.loginResult.MetadataServerUrl)
return client.portType.Retrieve(&request)
}

func (client *ForceClient) CheckRetrieveStatus(id *ID) (*CheckRetrieveStatusResponse, error) {
request := CheckRetrieveStatus{
AsyncProcessId: id,
}
sessionHeader := SessionHeader{
SessionId: client.loginResult.SessionId,
}
client.portType.SetHeader(&sessionHeader)
client.portType.SetServerUrl(client.loginResult.MetadataServerUrl)
return client.portType.CheckRetrieveStatus(&request)
}
17 changes: 4 additions & 13 deletions metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -4624,11 +4624,11 @@ type RetrieveResult struct {

ErrorStatusCode *StatusCode `xml:"errorStatusCode,omitempty"`

FileProperties []*FileProperties `xml:"fileProperties,omitempty"`
FileProperties []*FileProperties `xml:"FileProperties,omitempty"`

Id string `xml:"id,omitempty"`

Messages []*RetrieveMessage `xml:"messages,omitempty"`
Messages []*RetrieveMessage `xml:"RetrieveMessages,omitempty"`

Status *RetrieveStatus `xml:"status,omitempty"`

Expand Down Expand Up @@ -10686,10 +10686,6 @@ type OrganizationSettingsDetail struct {
}

type Package struct {
XMLName xml.Name `xml:"http://soap.sforce.com/2006/04/metadata Package"`

*Metadata

ApiAccessLevel *APIAccessLevel `xml:"apiAccessLevel,omitempty"`

Description string `xml:"description,omitempty"`
Expand Down Expand Up @@ -10730,8 +10726,6 @@ type ProfileObjectPermissions struct {
}

type PackageTypeMembers struct {
XMLName xml.Name `xml:"http://soap.sforce.com/2006/04/metadata PackageTypeMembers"`

Members []string `xml:"members,omitempty"`

Name string `xml:"name,omitempty"`
Expand Down Expand Up @@ -12889,8 +12883,6 @@ type ReadResult struct {
}

type RetrieveRequest struct {
XMLName xml.Name `xml:"http://soap.sforce.com/2006/04/metadata RetrieveRequest"`

ApiVersion float64 `xml:"apiVersion,omitempty"`

PackageNames []string `xml:"packageNames,omitempty"`
Expand Down Expand Up @@ -12991,7 +12983,7 @@ func (service *MetadataPortType) CheckDeployStatus(request *CheckDeployStatus) (
/* Check the current status of an asyncronous deploy call. */
func (service *MetadataPortType) CheckRetrieveStatus(request *CheckRetrieveStatus) (*CheckRetrieveStatusResponse, error) {
response := new(CheckRetrieveStatusResponse)
err := service.client.Call("", request, response)
err := service.client.Call("''", request, response)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -13102,7 +13094,7 @@ func (service *MetadataPortType) RenameMetadata(request *RenameMetadata) (*Renam
/* Retrieves a set of individually specified metadata entries. */
func (service *MetadataPortType) Retrieve(request *Retrieve) (*RetrieveResponse, error) {
response := new(RetrieveResponse)
err := service.client.Call("", request, response)
err := service.client.Call("''", request, response)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -13317,7 +13309,6 @@ func (s *SOAPClient) Call(soapAction string, request, response interface{}) erro
log.Println("empty response")
return nil
}
//log.Println(string(rawbody))

respEnvelope := new(SOAPEnvelope)
respEnvelope.Body = SOAPBody{Content: response}
Expand Down

0 comments on commit 66d2710

Please sign in to comment.