Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.544.0
speakeasyVersion: 1.636.3
sources:
bank-feeds-source:
sourceNamespace: bank-feeds-source
Expand All @@ -18,11 +18,11 @@ sources:
- 3.0.0
platform-source:
sourceNamespace: platform-source
sourceRevisionDigest: sha256:22a642c12144b2db0229ae5cd0f7f387de2337e5483b7d9d67894510ab466434
sourceBlobDigest: sha256:d80a27e44fffb9c61f16a99e7d25c294f39be1a5a761d51a87c76477f8589f54
sourceRevisionDigest: sha256:0f78aa549819043f4ba97e688320aad9a246b4f96dd9427dddcc76973ac48cd2
sourceBlobDigest: sha256:b1168d9a178d8cca7ff8fea320ab38bbc14b279b8ef463011adf760747529c64
tags:
- latest
- speakeasy-sdk-regen-1732624920
- speakeasy-sdk-regen-1760520838
- 3.0.0
sync-for-commerce-source:
sourceNamespace: sync-for-commerce-source
Expand Down Expand Up @@ -80,10 +80,10 @@ targets:
platform-library:
source: platform-source
sourceNamespace: platform-source
sourceRevisionDigest: sha256:22a642c12144b2db0229ae5cd0f7f387de2337e5483b7d9d67894510ab466434
sourceBlobDigest: sha256:d80a27e44fffb9c61f16a99e7d25c294f39be1a5a761d51a87c76477f8589f54
codeSamplesNamespace: platform-source-code-samples
codeSamplesRevisionDigest: sha256:2ab0377bf53e999f63ed07738a6d8ab38a44b9aa133d0016d3326255c06acf68
sourceRevisionDigest: sha256:0f78aa549819043f4ba97e688320aad9a246b4f96dd9427dddcc76973ac48cd2
sourceBlobDigest: sha256:b1168d9a178d8cca7ff8fea320ab38bbc14b279b8ef463011adf760747529c64
codeSamplesNamespace: platform-source-csharp-code-samples
codeSamplesRevisionDigest: sha256:e9ac2ef0069007a2dd268e98934f1a19b0539db33822de0873a5625440a98cfd
sync-for-commerce-library:
source: sync-for-commerce-source
sourceNamespace: sync-for-commerce-source
Expand Down
5 changes: 5 additions & 0 deletions platform/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.DS_Store
**/.speakeasy/temp/
**/.speakeasy/logs/
.env
.env.local
obj/
bin/
debug/
1,481 changes: 731 additions & 750 deletions platform/.speakeasy/gen.lock

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion platform/.speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,38 @@ generation:
maintainOpenAPIOrder: true
usageSnippets:
optionalPropertyRendering: withExample
sdkInitStyle: constructor
useClassNamesForArrayFields: true
fixes:
nameResolutionDec2023: true
nameResolutionFeb2025: false
parameterOrderingFeb2024: true
requestResponseComponentNamesFeb2024: true
securityFeb2025: false
sharedErrorComponentsApr2025: false
auth:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
hoistGlobalSecurity: true
tests:
generateTests: true
generateNewTests: false
skipResponseBodyAssertions: false
csharp:
version: 6.0.0
version: 6.1.0
additionalDependencies: []
author: Codat
baseErrorName: CodatPlatformException
clientServerStatusCodesAsErrors: true
defaultErrorName: SDKException
description: Manage the building blocks of Codat, including companies, connections, and more.
disableNamespacePascalCasingApr2024: true
dotnetVersion: net8.0
enableCancellationToken: false
enableSourceLink: false
flattenGlobalSecurity: true
flatteningOrder: ""
httpClientPrefix: Speakeasy
imports:
option: openapi
paths:
Expand All @@ -41,3 +53,4 @@ csharp:
packageTags: ""
responseFormat: envelope
sourceDirectory: ""
useNodatime: true
4 changes: 2 additions & 2 deletions platform/Codat/Platform/Codat.Platform.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>Codat.Platform</PackageId>
<Version>6.0.0</Version>
<Version>6.1.0</Version>
<TargetFramework>net8.0</TargetFramework>
<Authors>Codat</Authors>
<Copyright>Copyright (c) Codat 2024</Copyright>
<Copyright>Copyright (c) Codat 2025</Copyright>
<RepositoryUrl>https://github.com/codatio/client-sdk-csharp.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>An API for the common components of all of Codat&apos;s products.<br/>
Expand Down
194 changes: 130 additions & 64 deletions platform/Codat/Platform/CodatPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace Codat.Platform
using Codat.Platform.Hooks;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Errors;
using Codat.Platform.Utils.Retries;
using Codat.Platform.Utils;
using Codat.Platform.Utils.Retries;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using System;

/// <summary>
/// Platform API: Platform API
Expand Down Expand Up @@ -66,6 +66,12 @@ public interface ICodatPlatform
/// Configure UI and retrieve access tokens for authentication used by **Connections SDK**.
/// </summary>
public IConnectionManagement ConnectionManagement { get; }
public ICors Cors { get; }

/// <summary>
/// Manage company profile configuration, sync settings, and API keys.
/// </summary>
public ISettings Settings { get; }

/// <summary>
/// Initiate data refreshes, view pull status and history.
Expand All @@ -83,9 +89,9 @@ public interface ICodatPlatform
public IIntegrations Integrations { get; }

/// <summary>
/// Manage company profile configuration, sync settings, and API keys.
/// View validation outcomes for completed read data operations.
/// </summary>
public ISettings Settings { get; }
public IReadData ReadData { get; }

/// <summary>
/// Initiate and monitor Create, Update, and Delete operations.
Expand All @@ -103,40 +109,6 @@ public interface ICodatPlatform
public ICustomDataType CustomDataType { get; }
}

public class SDKConfig
{
/// <summary>
/// List of server URLs available to the SDK.
/// </summary>
public static readonly string[] ServerList = {
"https://api.codat.io",
};

public string ServerUrl = "";
public int ServerIndex = 0;
public SDKHooks Hooks = new SDKHooks();
public RetryConfig? RetryConfig = null;

public string GetTemplatedServerUrl()
{
if (!String.IsNullOrEmpty(this.ServerUrl))
{
return Utilities.TemplateUrl(Utilities.RemoveSuffix(this.ServerUrl, "/"), new Dictionary<string, string>());
}
return Utilities.TemplateUrl(SDKConfig.ServerList[this.ServerIndex], new Dictionary<string, string>());
}

public ISpeakeasyHttpClient InitHooks(ISpeakeasyHttpClient client)
{
string preHooksUrl = GetTemplatedServerUrl();
var (postHooksUrl, postHooksClient) = this.Hooks.SDKInit(preHooksUrl, client);
if (preHooksUrl != postHooksUrl)
{
this.ServerUrl = postHooksUrl;
}
return postHooksClient;
}
}

/// <summary>
/// Platform API: Platform API
Expand Down Expand Up @@ -172,25 +144,52 @@ public class CodatPlatform: ICodatPlatform
public SDKConfig SDKConfiguration { get; private set; }

private const string _language = "csharp";
private const string _sdkVersion = "6.0.0";
private const string _sdkGenVersion = "2.462.1";
private const string _sdkVersion = "6.1.0";
private const string _sdkGenVersion = "2.723.11";
private const string _openapiDocVersion = "3.0.0";
private const string _userAgent = "speakeasy-sdk/csharp 6.0.0 2.462.1 3.0.0 Codat.Platform";
private string _serverUrl = "";
private int _serverIndex = 0;
private ISpeakeasyHttpClient _client;
private Func<Codat.Platform.Models.Components.Security>? _securitySource;
public ICompanies Companies { get; private set; }
public IConnections Connections { get; private set; }
public IConnectionManagement ConnectionManagement { get; private set; }
public ICors Cors { get; private set; }
public ISettings Settings { get; private set; }
public IRefreshData RefreshData { get; private set; }
public IWebhooks Webhooks { get; private set; }
public IIntegrations Integrations { get; private set; }
public ISettings Settings { get; private set; }
public IReadData ReadData { get; private set; }
public IPushData PushData { get; private set; }
public ISupplementalData SupplementalData { get; private set; }
public ICustomDataType CustomDataType { get; private set; }

public CodatPlatform(SDKConfig config)
{
SDKConfiguration = config;
InitHooks();

Companies = new Companies(SDKConfiguration);

Connections = new Connections(SDKConfiguration);

ConnectionManagement = new ConnectionManagement(SDKConfiguration);

Cors = new Cors(SDKConfiguration);

Settings = new Settings(SDKConfiguration);

RefreshData = new RefreshData(SDKConfiguration);

Webhooks = new Webhooks(SDKConfiguration);

Integrations = new Integrations(SDKConfiguration);

ReadData = new ReadData(SDKConfiguration);

PushData = new PushData(SDKConfiguration);

SupplementalData = new SupplementalData(SDKConfiguration);

CustomDataType = new CustomDataType(SDKConfiguration);
}

public CodatPlatform(string? authHeader = null, Func<string>? authHeaderSource = null, int? serverIndex = null, string? serverUrl = null, Dictionary<string, string>? urlParams = null, ISpeakeasyHttpClient? client = null, RetryConfig? retryConfig = null)
{
if (serverIndex != null)
Expand All @@ -199,7 +198,6 @@ public CodatPlatform(string? authHeader = null, Func<string>? authHeaderSource =
{
throw new Exception($"Invalid server index {serverIndex.Value}");
}
_serverIndex = serverIndex.Value;
}

if (serverUrl != null)
Expand All @@ -208,10 +206,8 @@ public CodatPlatform(string? authHeader = null, Func<string>? authHeaderSource =
{
serverUrl = Utilities.TemplateUrl(serverUrl, urlParams);
}
_serverUrl = serverUrl;
}

_client = client ?? new SpeakeasyHttpClient();
Func<Codat.Platform.Models.Components.Security>? _securitySource = null;

if(authHeaderSource != null)
{
Expand All @@ -226,44 +222,114 @@ public CodatPlatform(string? authHeader = null, Func<string>? authHeaderSource =
throw new Exception("authHeader and authHeaderSource cannot both be null");
}

SDKConfiguration = new SDKConfig()
SDKConfiguration = new SDKConfig(client)
{
ServerIndex = _serverIndex,
ServerUrl = _serverUrl,
ServerIndex = serverIndex == null ? 0 : serverIndex.Value,
ServerUrl = serverUrl == null ? "" : serverUrl,
SecuritySource = _securitySource,
RetryConfig = retryConfig
};

_client = SDKConfiguration.InitHooks(_client);
InitHooks();

Companies = new Companies(SDKConfiguration);

Companies = new Companies(_client, _securitySource, _serverUrl, SDKConfiguration);
Connections = new Connections(SDKConfiguration);

ConnectionManagement = new ConnectionManagement(SDKConfiguration);

Connections = new Connections(_client, _securitySource, _serverUrl, SDKConfiguration);
Cors = new Cors(SDKConfiguration);

Settings = new Settings(SDKConfiguration);

ConnectionManagement = new ConnectionManagement(_client, _securitySource, _serverUrl, SDKConfiguration);
RefreshData = new RefreshData(SDKConfiguration);

Webhooks = new Webhooks(SDKConfiguration);

RefreshData = new RefreshData(_client, _securitySource, _serverUrl, SDKConfiguration);
Integrations = new Integrations(SDKConfiguration);

ReadData = new ReadData(SDKConfiguration);

Webhooks = new Webhooks(_client, _securitySource, _serverUrl, SDKConfiguration);
PushData = new PushData(SDKConfiguration);

SupplementalData = new SupplementalData(SDKConfiguration);

Integrations = new Integrations(_client, _securitySource, _serverUrl, SDKConfiguration);
CustomDataType = new CustomDataType(SDKConfiguration);
}

private void InitHooks()
{
string preHooksUrl = SDKConfiguration.GetTemplatedServerUrl();
var (postHooksUrl, postHooksClient) = SDKConfiguration.Hooks.SDKInit(preHooksUrl, SDKConfiguration.Client);
var config = SDKConfiguration;
if (preHooksUrl != postHooksUrl)
{
config.ServerUrl = postHooksUrl;
}
config.Client = postHooksClient;
SDKConfiguration = config;
}

Settings = new Settings(_client, _securitySource, _serverUrl, SDKConfiguration);
public class SDKBuilder
{
private SDKConfig _sdkConfig = new SDKConfig(client: new SpeakeasyHttpClient());

public SDKBuilder() { }

PushData = new PushData(_client, _securitySource, _serverUrl, SDKConfiguration);
public SDKBuilder WithServerIndex(int serverIndex)
{
if (serverIndex < 0 || serverIndex >= SDKConfig.ServerList.Length)
{
throw new Exception($"Invalid server index {serverIndex}");
}
_sdkConfig.ServerIndex = serverIndex;
return this;
}

public SDKBuilder WithServerUrl(string serverUrl, Dictionary<string, string>? serverVariables = null)
{
if (serverVariables != null)
{
serverUrl = Utilities.TemplateUrl(serverUrl, serverVariables);
}
_sdkConfig.ServerUrl = serverUrl;
return this;
}

public SDKBuilder WithAuthHeaderSource(Func<string> authHeaderSource)
{
_sdkConfig.SecuritySource = () => new Codat.Platform.Models.Components.Security() { AuthHeader = authHeaderSource() };
return this;
}

public SDKBuilder WithAuthHeader(string authHeader)
{
_sdkConfig.SecuritySource = () => new Codat.Platform.Models.Components.Security() { AuthHeader = authHeader };
return this;
}

SupplementalData = new SupplementalData(_client, _securitySource, _serverUrl, SDKConfiguration);
public SDKBuilder WithClient(ISpeakeasyHttpClient client)
{
_sdkConfig.Client = client;
return this;
}

public SDKBuilder WithRetryConfig(RetryConfig retryConfig)
{
_sdkConfig.RetryConfig = retryConfig;
return this;
}

public CodatPlatform Build()
{
if (_sdkConfig.SecuritySource == null) {
throw new Exception("securitySource cannot be null. One of `AuthHeader` or `authHeaderSource` needs to be defined.");
}
return new CodatPlatform(_sdkConfig);
}

CustomDataType = new CustomDataType(_client, _securitySource, _serverUrl, SDKConfiguration);
}

public static SDKBuilder Builder() => new SDKBuilder();
}
}
Loading