Skip to content

Commit

Permalink
SDK regeneration (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
  • Loading branch information
fern-api[bot] authored Jun 18, 2024
1 parent 217bb47 commit f7f8932
Show file tree
Hide file tree
Showing 51 changed files with 1,413 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/SchematicHQ.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{39566A81-4008-4EE6-8000-D6F1B416C595}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{EA356414-8080-48AE-9B9E-30A369A27D33}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{90CE9020-49FA-45BB-B122-0C3A6E7FAB28}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,13 +16,13 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD437CF4-C32D-45DA-A37D-B1BC0CA7D8E8}.Release|Any CPU.Build.0 = Release|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA356414-8080-48AE-9B9E-30A369A27D33}.Release|Any CPU.Build.0 = Release|Any CPU
{39566A81-4008-4EE6-8000-D6F1B416C595}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39566A81-4008-4EE6-8000-D6F1B416C595}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39566A81-4008-4EE6-8000-D6F1B416C595}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39566A81-4008-4EE6-8000-D6F1B416C595}.Release|Any CPU.Build.0 = Release|Any CPU
{90CE9020-49FA-45BB-B122-0C3A6E7FAB28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90CE9020-49FA-45BB-B122-0C3A6E7FAB28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90CE9020-49FA-45BB-B122-0C3A6E7FAB28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90CE9020-49FA-45BB-B122-0C3A6E7FAB28}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions src/SchematicHQ.Client/Companies/CompaniesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,37 @@ public async Task<LookupCompanyResponse> LookupCompanyAsync(LookupCompanyRequest
throw new Exception(responseBody);
}

public async Task<GetActiveDealsResponse> GetActiveDealsAsync(GetActiveDealsRequest request)
{
var _query = new Dictionary<string, object>()
{
{ "company_id", request.CompanyId },
{ "deal_stage", request.DealStage },
};
if (request.Limit != null)
{
_query["limit"] = request.Limit;
}
if (request.Offset != null)
{
_query["offset"] = request.Offset;
}
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Get,
Path = "/company-crm-deals",
Query = _query
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<GetActiveDealsResponse>(responseBody);
}
throw new Exception(responseBody);
}

public async Task<ListCompanyMembershipsResponse> ListCompanyMembershipsAsync(
ListCompanyMembershipsRequest request
)
Expand Down
18 changes: 18 additions & 0 deletions src/SchematicHQ.Client/Companies/Requests/GetActiveDealsRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace SchematicHQ.Client;

public class GetActiveDealsRequest
{
public string CompanyId { get; init; }

public string DealStage { get; init; }

/// <summary>
/// Page limit (default 100)
/// </summary>
public int? Limit { get; init; }

/// <summary>
/// Page offset (default 0)
/// </summary>
public int? Offset { get; init; }
}
20 changes: 20 additions & 0 deletions src/SchematicHQ.Client/Companies/Types/GetActiveDealsParams.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Text.Json.Serialization;

#nullable enable

namespace SchematicHQ.Client;

public class GetActiveDealsParams
{
[JsonPropertyName("company_id")]
public string? CompanyId { get; init; }

[JsonPropertyName("deal_stage")]
public string? DealStage { get; init; }

[JsonPropertyName("limit")]
public int? Limit { get; init; }

[JsonPropertyName("offset")]
public int? Offset { get; init; }
}
21 changes: 21 additions & 0 deletions src/SchematicHQ.Client/Companies/Types/GetActiveDealsResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Text.Json.Serialization;
using SchematicHQ.Client;

#nullable enable

namespace SchematicHQ.Client;

public class GetActiveDealsResponse
{
/// <summary>
/// The returned resources
/// </summary>
[JsonPropertyName("data")]
public List<CompanyCrmDealsResponseData> Data { get; init; }

/// <summary>
/// Input parameters
/// </summary>
[JsonPropertyName("params")]
public GetActiveDealsParams Params { get; init; }
}
129 changes: 129 additions & 0 deletions src/SchematicHQ.Client/Crm/CrmClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
using System.Text.Json;
using SchematicHQ.Client;

#nullable enable

namespace SchematicHQ.Client;

public class CrmClient
{
private RawClient _client;

public CrmClient(RawClient client)
{
_client = client;
}

public async Task<UpsertDealLineItemAssociationResponse> UpsertDealLineItemAssociationAsync(
CreateCrmDealLineItemAssociationRequestBody request
)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/crm/associations/deal-line-item",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<UpsertDealLineItemAssociationResponse>(responseBody);
}
throw new Exception(responseBody);
}

public async Task<UpsertLineItemResponse> UpsertLineItemAsync(
CreateCrmLineItemRequestBody request
)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/crm/deal-line-item/upsert",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<UpsertLineItemResponse>(responseBody);
}
throw new Exception(responseBody);
}

public async Task<UpsertCrmDealResponse> UpsertCrmDealAsync(CreateCrmDealRequestBody request)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/crm/deals/upsert",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<UpsertCrmDealResponse>(responseBody);
}
throw new Exception(responseBody);
}

public async Task<ListCrmProductsResponse> ListCrmProductsAsync(ListCrmProductsRequest request)
{
var _query = new Dictionary<string, object>() { };
if (request.Ids != null)
{
_query["ids"] = request.Ids;
}
if (request.Name != null)
{
_query["name"] = request.Name;
}
if (request.Limit != null)
{
_query["limit"] = request.Limit;
}
if (request.Offset != null)
{
_query["offset"] = request.Offset;
}
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Get,
Path = "/crm/products",
Query = _query
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<ListCrmProductsResponse>(responseBody);
}
throw new Exception(responseBody);
}

public async Task<UpsertCrmProductResponse> UpsertCrmProductAsync(
CreateCrmProductRequestBody request
)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/crm/products/upsert",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<UpsertCrmProductResponse>(responseBody);
}
throw new Exception(responseBody);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

#nullable enable

namespace SchematicHQ.Client;

public class CreateCrmDealLineItemAssociationRequestBody
{
[JsonPropertyName("deal_external_id")]
public string DealExternalId { get; init; }

[JsonPropertyName("line_item_external_id")]
public string LineItemExternalId { get; init; }
}
35 changes: 35 additions & 0 deletions src/SchematicHQ.Client/Crm/Requests/CreateCrmDealRequestBody.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Text.Json.Serialization;

#nullable enable

namespace SchematicHQ.Client;

public class CreateCrmDealRequestBody
{
[JsonPropertyName("arr")]
public string? Arr { get; init; }

[JsonPropertyName("crm_company_id")]
public string? CrmCompanyId { get; init; }

[JsonPropertyName("crm_company_key")]
public string CrmCompanyKey { get; init; }

[JsonPropertyName("crm_product_id")]
public string? CrmProductId { get; init; }

[JsonPropertyName("crm_type")]
public string CrmType { get; init; }

[JsonPropertyName("deal_external_id")]
public string DealExternalId { get; init; }

[JsonPropertyName("deal_name")]
public string? DealName { get; init; }

[JsonPropertyName("deal_stage")]
public string? DealStage { get; init; }

[JsonPropertyName("mrr")]
public string? Mrr { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;

#nullable enable

namespace SchematicHQ.Client;

public class CreateCrmLineItemRequestBody
{
[JsonPropertyName("TermMonth")]
public int? TermMonth { get; init; }

[JsonPropertyName("amount")]
public string Amount { get; init; }

[JsonPropertyName("discount_percentage")]
public string? DiscountPercentage { get; init; }

[JsonPropertyName("interval")]
public string Interval { get; init; }

[JsonPropertyName("line_item_external_id")]
public string LineItemExternalId { get; init; }

[JsonPropertyName("product_external_id")]
public string ProductExternalId { get; init; }

[JsonPropertyName("quantity")]
public int Quantity { get; init; }

[JsonPropertyName("total_discount")]
public string? TotalDiscount { get; init; }
}
32 changes: 32 additions & 0 deletions src/SchematicHQ.Client/Crm/Requests/CreateCrmProductRequestBody.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;

#nullable enable

namespace SchematicHQ.Client;

public class CreateCrmProductRequestBody
{
[JsonPropertyName("currency")]
public string Currency { get; init; }

[JsonPropertyName("description")]
public string Description { get; init; }

[JsonPropertyName("external_id")]
public string ExternalId { get; init; }

[JsonPropertyName("interval")]
public string Interval { get; init; }

[JsonPropertyName("name")]
public string Name { get; init; }

[JsonPropertyName("price")]
public string Price { get; init; }

[JsonPropertyName("quantity")]
public int Quantity { get; init; }

[JsonPropertyName("sku")]
public string Sku { get; init; }
}
18 changes: 18 additions & 0 deletions src/SchematicHQ.Client/Crm/Requests/ListCrmProductsRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace SchematicHQ.Client;

public class ListCrmProductsRequest
{
public string? Ids { get; init; }

public string? Name { get; init; }

/// <summary>
/// Page limit (default 100)
/// </summary>
public int? Limit { get; init; }

/// <summary>
/// Page offset (default 0)
/// </summary>
public int? Offset { get; init; }
}
Loading

0 comments on commit f7f8932

Please sign in to comment.