Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eng 6888 dotnet 3.0.x documentation #409

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Pre-configured proxies
  • Loading branch information
greathouse committed Jul 1, 2024
commit 108988e210b80567604d94e8b75f13ef3cca70b0
217 changes: 130 additions & 87 deletions docs/api/proxies/pre-configured-proxies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,52 @@ const proxy = await bt.proxies.create({
<TabItem value="csharp" label="C#">

```csharp showLineNumbers
using BasisTheory.net.Proxies;
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

var client = new ProxyClient("<MANAGEMENT_API_KEY>");
Configuration config = new Configuration();
config.BasePath = "http://api.basistheory.com";
config.AddApiKey("BT-API-KEY", "YOUR_API_KEY");

var proxy = await client.CreateAsync(new ProxyCreateRequest {
Name = "My Proxy",
DestinationUrl = "https://example.com/api",
RequestTransform = new ProxyTransform {
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY
var apiInstance = new ProxiesApi(config);
var createProxyRequest = new CreateProxyRequest("My Proxy", "https://example.com/api")
{
RequestTransform = new ProxyTransform
{
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY

return {
headers: req.args.headers,
body: req.args.body
};
};
"
},
ResponseTransform = new ProxyTransform {
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY
return {
headers: req.args.headers,
body: req.args.body
};
};
"
},
ResponseTransform = new ProxyTransform {
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY

return {
headers: req.args.headers,
body: req.args.body
};
};
"
},
Configuration = new Dictionary<string, string> {
{ "SERVICE_API_KEY", "key_abcd1234" }
},
Application = new Application {
Id = new Guid("45c124e7-6ab2-4899-b4d9-1388b0ba9d04")
},
RequireAuthentication = true
});
return {
headers: req.args.headers,
body: req.args.body
};
};
"
},
_Configuration = new Dictionary<string, string> {
{ "SERVICE_API_KEY", "key_abcd1234" }
},
Application = new Application {
Id = new Guid("45c124e7-6ab2-4899-b4d9-1388b0ba9d04")
},
RequireAuth = true
};

Proxy result = apiInstance.Create(createProxyRequest);
```

</TabItem>
Expand Down Expand Up @@ -408,11 +415,22 @@ const proxies = await bt.proxies.list();
<TabItem value="csharp" label="C#">

```csharp showLineNumbers
using BasisTheory.net.Proxies;

var client = new ProxyClient("<MANAGEMENT_API_KEY>");

var proxies = await client.GetAsync();
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

Configuration config = new Configuration();
config.BasePath = "https://api.basistheory.com";
config.AddApiKey("BT-API-KEY", "YOUR_API_KEY");

var apiInstance = new ProxiesApi(config);
var id = new List<Guid>();
var name = "";
var page = 1;
var start = "";
var size = 1;

ProxyPaginatedList result = apiInstance.Get(id, name, page, start, size);
```

</TabItem>
Expand Down Expand Up @@ -577,11 +595,18 @@ const proxy = await bt.proxies.retrieve("5b493235-6917-4307-906a-2cd6f1a90b13");
<TabItem value="csharp" label="C#">

```csharp showLineNumbers
using BasisTheory.net.Proxies;
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

Configuration config = new Configuration();
config.BasePath = "https://api.basistheory.com";
config.AddApiKey("BT-API-KEY", "YOUR_API_KEY");

var client = new ProxyClient("<MANAGEMENT_API_KEY>");
var apiInstance = new ProxiesApi(config);
var id = "";

var proxy = await client.GetByIdAsync("5b493235-6917-4307-906a-2cd6f1a90b13");
Proxy result = apiInstance.GetById(id);
```

</TabItem>
Expand Down Expand Up @@ -797,46 +822,53 @@ const proxy = await bt.proxies.update('433013a6-a614-4e1e-b2aa-5fba67aa85e6', {
<TabItem value="csharp" label="C#">

```csharp showLineNumbers
using BasisTheory.net.Proxies;

var client = new ProxyClient("<MANAGEMENT_API_KEY>");

var proxy = await client.UpdateAsync("433013a6-a614-4e1e-b2aa-5fba67aa85e6",
new ProxyUpdateRequest {
Name = "My Proxy",
DestinationUrl = "https://example.com/api",
RequestTransform = new ProxyTransform {
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY

return {
headers: req.args.headers,
body: req.args.body
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

Configuration config = new Configuration();
config.BasePath = "http://api.basistheory.com";
config.AddApiKey("BT-API-KEY", "YOUR_API_KEY");

var apiInstance = new ProxiesApi(config);
var id = "";
var updateProxyRequest = new UpdateProxyRequest("My Proxy", "https://echo.basistheory.com")
{
RequestTransform = new ProxyTransform
{
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY

return {
headers: req.args.headers,
body: req.args.body
};
};
};
"
"
},
ResponseTransform = new ProxyTransform {
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY
Code = @"
module.exports = async function (req) {
// Do something with req.configuration.SERVICE_API_KEY

return {
headers: req.args.headers,
body: req.args.body
return {
headers: req.args.headers,
body: req.args.body
};
};
};
"
"
},
Configuration = new Dictionary<string, string> {
{ "SERVICE_API_KEY", "key_abcd1234" }
_Configuration = new Dictionary<string, string> {
{ "SERVICE_API_KEY", "key_abcd1234" }
},
Application = new Application {
Id = new Guid("45c124e7-6ab2-4899-b4d9-1388b0ba9d04")
Id = new Guid("45c124e7-6ab2-4899-b4d9-1388b0ba9d04")
},
RequireAuthentication = true
});
RequireAuth = true
};

Proxy result = apiInstance.Update(id, updateProxyRequest);
```

</TabItem>
Expand Down Expand Up @@ -1119,18 +1151,22 @@ const proxy = await bt.proxies.patch("433013a6-a614-4e1e-b2aa-5fba67aa85e6", {
<TabItem value="csharp" label="C#">

```csharp showLineNumbers
using BasisTheory.net.Proxies;
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

var client = new ProxyClient("<MANAGEMENT_API_KEY>");
Configuration config = new Configuration();
config.BasePath = "https://api.basistheory.com";
config.AddApiKey("BT-API-KEY", "YOUR_API_KEY");

var proxy = await client.PatchAsync("433013a6-a614-4e1e-b2aa-5fba67aa85e6",
new ProxyPatchRequest {
Name = "My Proxy",
DestinationUrl = "https://example.com/api",
Configuration = new Dictionary<string, string> {
{ "SERVICE_API_KEY", "key_abcd1234" }
}
});
var apiInstance = new ProxiesApi(config);
var id = "";
var patchProxyRequest = new PatchProxyRequest()
{
// Additional parameters
};

apiInstance.Patch(id, patchProxyRequest);
```

</TabItem>
Expand Down Expand Up @@ -1269,11 +1305,18 @@ await bt.proxies.delete("433013a6-a614-4e1e-b2aa-5fba67aa85e6");
<TabItem value="csharp" label="C#">

```csharp showLineNumbers
using BasisTheory.net.Proxies;
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

Configuration config = new Configuration();
config.BasePath = "https://api.basistheory.com";
config.AddApiKey("BT-API-KEY", "YOUR_API_KEY");

var client = new ProxyClient("<MANAGEMENT_API_KEY>");
var apiInstance = new ProxiesApi(config);
var id = "";

await client.DeleteAsync("433013a6-a614-4e1e-b2aa-5fba67aa85e6");
apiInstance.Delete(id);
```

</TabItem>
Expand Down