Skip to content

Commit ad6f73f

Browse files
chore(internal): codegen related update
1 parent b71251d commit ad6f73f

File tree

1,317 files changed

+94499
-38382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,317 files changed

+94499
-38382
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ insert_final_newline = true
2323

2424
dotnet_diagnostic.IDE0060.severity = none # Caused by resource with no methods and no subresources
2525
dotnet_diagnostic.IDE1006.severity = none # Some names may not match up with C# conventions
26-
dotnet_diagnostic.IDE0290.severity = none # Don't prefer primary constructors
26+
dotnet_diagnostic.IDE0290.severity = none # Don't prefer primary constructors

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ jobs:
2929

3030
- name: Run lints
3131
run: ./scripts/lint
32+
build:
33+
timeout-minutes: 10
34+
name: build
35+
runs-on: ${{ github.repository == 'stainless-sdks/orb-csharp' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
36+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up .NET
42+
uses: actions/setup-dotnet@v3
43+
with:
44+
dotnet-version: '8.0.x'
45+
46+
- name: Build SDK
47+
run: ./scripts/build
48+
3249
test:
3350
timeout-minutes: 10
3451
name: test

README.md

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,37 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho
1313

1414
## Installation
1515

16-
### Dotnet
17-
1816
```bash
19-
dotnet add reference /path/to/orb-csharp/src/Orb/
17+
git clone git@github.com:orbcorp/orb-csharp.git
18+
dotnet add reference orb-csharp/src/Orb
2019
```
2120

21+
## Requirements
22+
23+
This library requires .NET 8 or later.
24+
25+
> [!NOTE]
26+
> The library is currently in **beta**. The requirements will be lowered in the future.
27+
2228
## Usage
2329

2430
See the [`examples`](examples) directory for complete and runnable examples.
2531

26-
```C#
32+
```csharp
33+
using System;
2734
using Orb;
2835
using Orb.Models.Customers;
29-
using System;
3036

3137
// Configured using the ORB_API_KEY, ORB_WEBHOOK_SECRET and ORB_BASE_URL environment variables
3238
OrbClient client = new();
3339

34-
CustomerCreateParams param = new()
40+
CustomerCreateParams parameters = new()
3541
{
3642
Email = "example-customer@withorb.com",
3743
Name = "My Customer",
3844
};
3945

40-
var customer = await client.Customers.Create(param);
46+
var customer = await client.Customers.Create(parameters);
4147

4248
Console.WriteLine(customer);
4349
```
@@ -46,7 +52,7 @@ Console.WriteLine(customer);
4652

4753
Configure the client using environment variables:
4854

49-
```C#
55+
```csharp
5056
using Orb;
5157

5258
// Configured using the ORB_API_KEY, ORB_WEBHOOK_SECRET and ORB_BASE_URL environment variables
@@ -55,10 +61,35 @@ OrbClient client = new();
5561

5662
Or manually:
5763

58-
```C#
64+
```csharp
5965
using Orb;
6066

6167
OrbClient client = new() { APIKey = "My API Key" };
6268
```
6369

64-
Alternatively, you can use a combination of the two approaches.
70+
Or using a combination of the two approaches.
71+
72+
See this table for the available options:
73+
74+
| Property | Environment variable | Required | Default value |
75+
| --------------- | -------------------- | -------- | ------------------------------ |
76+
| `APIKey` | `ORB_API_KEY` | true | - |
77+
| `WebhookSecret` | `ORB_WEBHOOK_SECRET` | false | - |
78+
| `BaseUrl` | `ORB_BASE_URL` | true | `"https://api.withorb.com/v1"` |
79+
80+
## Requests and responses
81+
82+
To send a request to the Orb API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a C# class.
83+
84+
For example, `client.Customers.Create` should be called with an instance of `CustomerCreateParams`, and it will return an instance of `Task<Customer>`.
85+
86+
## Semantic versioning
87+
88+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
89+
90+
1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
91+
2. Changes that we do not expect to impact the vast majority of users in practice.
92+
93+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
94+
95+
We are keen for your feedback; please open an [issue](https://www.github.com/orbcorp/orb-csharp/issues) with questions, bugs, or suggestions.

release-please-config.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
],
6262
"release-type": "simple",
6363
"extra-files": [
64-
"README.md"
64+
"README.md",
65+
{
66+
"type": "xml",
67+
"path": "src/Orb/Orb.csproj",
68+
"xpath": "//Project/PropertyGroup/VersionPrefix"
69+
}
6570
]
6671
}

scripts/mock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
2121

2222
# Run prism mock on the given spec
2323
if [ "$1" == "--daemon" ]; then
24-
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
24+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
2525

2626
# Wait for server to come online
2727
echo -n "Waiting for server"
@@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
3737

3838
echo
3939
else
40-
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
40+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
4141
fi

scripts/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ elif ! prism_is_running ; then
4343
echo -e "To run the server, pass in the path or url of your OpenAPI"
4444
echo -e "spec to the prism command:"
4545
echo
46-
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
46+
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
4747
echo
4848

4949
exit 1

src/Orb.Tests/Orb.Tests.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<IsPackable>false</IsPackable>
55
<IsTestProject>true</IsTestProject>
66
<ImplicitUsings>disable</ImplicitUsings>
7+
<!-- Disable skipped tests warnings -->
8+
<NoWarn>$(NoWarn),xUnit1004</NoWarn>
79
</PropertyGroup>
810
<ItemGroup>
911
<PackageReference Include="coverlet.collector" Version="6.0.0" />

src/Orb.Tests/Services/Alerts/AlertServiceTest.cs

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using System;
21
using System.Threading.Tasks;
3-
using AlertCreateForCustomerParamsProperties = Orb.Models.Alerts.AlertCreateForCustomerParamsProperties;
2+
using Orb.Models.Alerts.AlertCreateForCustomerParamsProperties;
43
using AlertCreateForExternalCustomerParamsProperties = Orb.Models.Alerts.AlertCreateForExternalCustomerParamsProperties;
54
using AlertCreateForSubscriptionParamsProperties = Orb.Models.Alerts.AlertCreateForSubscriptionParamsProperties;
65

@@ -24,23 +23,10 @@ public async Task Update_Works()
2423
alert.Validate();
2524
}
2625

27-
[Fact]
26+
[Fact(Skip = "plan_version=0 breaks Prism")]
2827
public async Task List_Works()
2928
{
30-
var page = await this.client.Alerts.List(
31-
new()
32-
{
33-
CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"),
34-
CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"),
35-
CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"),
36-
CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"),
37-
Cursor = "cursor",
38-
CustomerID = "customer_id",
39-
ExternalCustomerID = "external_customer_id",
40-
Limit = 1,
41-
SubscriptionID = "subscription_id",
42-
}
43-
);
29+
var page = await this.client.Alerts.List();
4430
page.Validate();
4531
}
4632

@@ -52,8 +38,7 @@ public async Task CreateForCustomer_Works()
5238
{
5339
CustomerID = "customer_id",
5440
Currency = "currency",
55-
Type = AlertCreateForCustomerParamsProperties::Type.CreditBalanceDepleted,
56-
Thresholds = [new(0)],
41+
Type = Type.CreditBalanceDepleted,
5742
}
5843
);
5944
alert.Validate();
@@ -68,7 +53,6 @@ public async Task CreateForExternalCustomer_Works()
6853
ExternalCustomerID = "external_customer_id",
6954
Currency = "currency",
7055
Type = AlertCreateForExternalCustomerParamsProperties::Type.CreditBalanceDepleted,
71-
Thresholds = [new(0)],
7256
}
7357
);
7458
alert.Validate();
@@ -83,7 +67,6 @@ public async Task CreateForSubscription_Works()
8367
SubscriptionID = "subscription_id",
8468
Thresholds = [new(0)],
8569
Type = AlertCreateForSubscriptionParamsProperties::Type.UsageExceeded,
86-
MetricID = "metric_id",
8770
}
8871
);
8972
alert.Validate();
@@ -93,11 +76,7 @@ public async Task CreateForSubscription_Works()
9376
public async Task Disable_Works()
9477
{
9578
var alert = await this.client.Alerts.Disable(
96-
new()
97-
{
98-
AlertConfigurationID = "alert_configuration_id",
99-
SubscriptionID = "subscription_id",
100-
}
79+
new() { AlertConfigurationID = "alert_configuration_id" }
10180
);
10281
alert.Validate();
10382
}
@@ -106,11 +85,7 @@ public async Task Disable_Works()
10685
public async Task Enable_Works()
10786
{
10887
var alert = await this.client.Alerts.Enable(
109-
new()
110-
{
111-
AlertConfigurationID = "alert_configuration_id",
112-
SubscriptionID = "subscription_id",
113-
}
88+
new() { AlertConfigurationID = "alert_configuration_id" }
11489
);
11590
alert.Validate();
11691
}

0 commit comments

Comments
 (0)