Giter Club home page Giter Club logo

salesforcesharp's Introduction

SalesforceSharp

Build Status

An easy-to-use .NET client library for Salesforce REST API


Features

  • Create, Update, Delete and Query records.
  • FindById to easy found records.
  • Authentication flows
    • UsernamePasswordAuthenticationFlow
    • Others authentication flows can be added implementing IAuthenticationFlow.
  • Mono support
  • Fully tested on Windows and OSX
  • 100% Unit Tests coveraged
  • 100% code documentation
  • FxCop validated
  • Good (and good used) design patterns

Setup

PM> Install-Package SalesforceSharp

Usage

Authenticating

var client = new SalesforceClient();
var authFlow = new UsernamePasswordAuthenticationFlow(clientId, clientSecret, username, password);

try 
{
	client.Authenticate(authFlow);
}
catch(SalesforceException ex)
{
	Console.WriteLine("Authentication failed: {0} : {1}", ex.Error, ex.Message);
}

Querying records

public class Account
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
}

....

var records = client.Query<Account>("SELECT id, name, description FROM Account");

foreach(var r in records)
{
	Console.WriteLine("{0}: {1}", r.Id, r.Name);
}

Finding a record by Id

var record = client.FindById<Account>("Account", "<ID>");

Creating a record

// Using a class. 
client.Create("Account", new Account() 
{ Name = "name created", Description = "description created" }));

// Using an anonymous.
client.Create("Account", new { Name = "name created", Description = "description created" }));

Updating a record

// Using a class. Ever required property should be set.
client.Update("Account", "<record id>", new Account() 
{ Name = "name updated", Description = "description updated" }));

// Using an anonymous. Only required properties will be updated.
client.Update("Account", "<record id>", new { Description = "description updated" }));

Deleting a record

client.Delete("Account", "<ID">);

FAQ

Having troubles?

Roadmap

  • Implements others authentcation flows:
    • Web server flow, where the server can securely protect the consumer secret.
    • User-agent flow, used by applications that cannot securely store the consumer secret.

How to improve it?

Create a fork of SalesforceSharp.

Did you change it? Submit a pull request.

License

Licensed under the The MIT License (MIT). In others words, you can use this library for developement any kind of software: open source, commercial, proprietary and alien.

Change Log

  • 0.6.6 Marked constructor and helper methods as protected to allow extension (http://goo.gl/aPCL4f).
  • 0.6.5 Added ability to use alternate/custom service end-point (http://goo.gl/PddRiW).
  • 0.6.1 Publish NuGet package.
  • 0.5.0 First version.

salesforcesharp's People

Contributors

giacomelli avatar romeoqngo avatar rokitsalad avatar matt-hensley avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.