https://github.com/coveooss/sfdx4csharp
https://github.com/coveooss/sfdx4csharp
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/coveooss/sfdx4csharp
- Owner: coveooss
- License: mit
- Created: 2018-09-17T12:54:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T15:30:38.000Z (7 months ago)
- Last Synced: 2024-10-23T19:39:12.137Z (7 months ago)
- Language: C#
- Size: 460 KB
- Stars: 5
- Watchers: 8
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/Website/sfdx4csharp/branch/master)
# sfdx4csharp
Coveo C# Salesforce CLI wrapper. Allow to call the Salesforce CLI using C#.## Requirements
* Salesforce CLI: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm## How to use
This lib is compiled and deployed to nuget. So you can just add it as a dependency to you your C# project and it should work.
https://www.nuget.org/packages/sfdx4csharp## Code examples
You can see additional examples in the `Program.cs` file.```c#
// Creating a client to call the Salesforce CLI installed using the npm method:
// npm install @salesforce/cli --global
var client = new SfClient("C:\\Program Files\\nodejs\\sf.cmd");// Creats a Salesforce scratch organization. This following will execute:
// $ sf org create scratch --definition-file "config\project-scratch-def.json" --alias "MyOrg" -- wait 5
client.Org.CreateScratch(new OrgCreateScratchOptions
{
DefinitionFile = "config\\project-scratch-def.json",
Alias = "MyOrg",
Wait = 5
});// Fetches the created organization information. This following will execute:
// $ sf org display "MyOrg"
client.Org.Display(new OrgDisplayOptions
{
TargetOrg = "MyOrg"
});// Executes an SOQL query to retrieve all Salesforce Case ids from the scratch organizaiton. This following will execute:
// $ sf data query --query "Select id from Case" --target-org "MyOrg"
client.Data.Query(new DataQueryOptions
{
Query = "Select id from Case",
TargetOrg = "MyOrg"
});
```## Typescipt code generator
This repostory includes a typescript application to generate c# classes from the Salesforce CLI command documentation.To run it (from the root of the repository):
* have a working node JS enviroment.
* `npm install`: Installs the dependencies.
* `npm run generate`: Loads documentation from the Salesforce CLI and then generates the c# classes.