-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added readme * added the readme * corrected link * using tabs * Updating readme file * updated * updated the readme * Took out the println
- Loading branch information
1 parent
f3c89d0
commit b923c4a
Showing
9 changed files
with
418 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Composite Batch API | ||
[back](../../README.md) | ||
|
||
The `batch` package is an implementation of `Salesforce APIs` centered on `Composite Batch` operations. These operations include: | ||
* Limits Resources | ||
* SObject Resources | ||
* Query All | ||
* Query | ||
* Search | ||
* Connect Resources | ||
* Chatter Resources | ||
|
||
As a reference, see `Salesforce API` [documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_what_is_rest_api.htm) | ||
|
||
## Examples | ||
The following are examples to access the `APIs`. It is assumed that a `sfdc` [session](../../session/README.md) has been created. | ||
### Subrequest | ||
```go | ||
type batchSubrequester struct { | ||
url string | ||
method string | ||
richInput map[string]interface{} | ||
binaryPartName string | ||
binaryPartAlais string | ||
} | ||
|
||
func (b *batchSubrequester) URL() string { | ||
return b.url | ||
} | ||
func (b *batchSubrequester) Method() string { | ||
return b.method | ||
} | ||
func (b *batchSubrequester) BinaryPartName() string { | ||
return b.binaryPartName | ||
} | ||
func (b *batchSubrequester) BinaryPartNameAlias() string { | ||
return b.binaryPartAlais | ||
} | ||
func (b *batchSubrequester) RichInput() map[string]interface{} { | ||
return b.richInput | ||
} | ||
``` | ||
### Composite Batch | ||
```go | ||
subRequests := []batch.Subrequester{ | ||
&batchSubrequester{ | ||
url: "v44.0/sobjects/Account/0012E00001qLpKZQA0", | ||
method: http.MethodPatch, | ||
richInput: map[string]interface{}{ | ||
"Name": "NewName", | ||
}, | ||
}, | ||
&batchSubrequester{ | ||
url: "v44.0/sobjects/Account/0012E00001qLpKZQA0", | ||
method: http.MethodGet, | ||
}, | ||
} | ||
|
||
resource, err := batch.NewResource(session) | ||
if err != nil { | ||
fmt.Printf("Batch Composite Error %s\n", err.Error()) | ||
return | ||
} | ||
value, err := resource.Retrieve(false, subRequests) | ||
if err != nil { | ||
fmt.Printf("Batch Composite Error %s\n", err.Error()) | ||
return | ||
} | ||
|
||
fmt.Printf("%+v\n", value) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.