C# Library Quickstart
Configure Project
- First install the library from
nuget
and add it to your project.
<PackageReference Include="Dapi" Version="1.0.0"/>
- Import Dapi's library in your code.
using Dapi;
using Dapi.Products;
using Dapi.Response;
using Dapi.Types;
- Create a Dapi app with your App Secret
namespace TestConsoleApp {
public class TestClass {
private DapiApp myApp;
public TestClass() {
myApp = new DapiApp("YOUR_APP_SECRET");
}
}
}
- Now you can use any of the functions of the
DapiApp
instance,myApp
. Here is an example forgetAccounts
.
namespace TestConsoleApp {
public class TestClass {
public void TestFunc() {
var resp = myApp.getAccounts("YOUR_ACCESS_TOKEN", "YOUR_USER_SECRET");
// do something with the resp
}
}
}
Complete example
You need to replace the placeholders in this code snippet(appSecret
, accessToken
, userSecret
) with your own values.
using System.Collections.Generic;
using Dapi;
using Dapi.Products;
using Dapi.Response;
using Dapi.Types;
namespace TestConsoleApp {
public class TestClass {
private DapiApp myApp;
public TestClass() {
myApp = new DapiApp("YOUR_APP_SECRET");
}
public void TestFunc() {
var resp = myApp.getAccounts("YOUR_ACCESS_TOKEN", "YOUR_USER_SECRET");
// do something with the resp
}
}
}
Updated about 1 year ago