Skip to content

release: 0.1.0 #1

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ insert_final_newline = true

dotnet_diagnostic.IDE0060.severity = none # Caused by resource with no methods and no subresources
dotnet_diagnostic.IDE1006.severity = none # Some names may not match up with C# conventions
dotnet_diagnostic.IDE0290.severity = none # Don't prefer primary constructors
dotnet_diagnostic.IDE0290.severity = none # Don't prefer primary constructors
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ jobs:

- name: Run lints
run: ./scripts/lint
build:
timeout-minutes: 10
name: build
runs-on: ${{ github.repository == 'stainless-sdks/scrapegraphai-csharp' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4

- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Build SDK
run: ./scripts/build

test:
timeout-minutes: 10
name: test
Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/scrapegraphai%2Fscrapegraphai-969ebada41127057e4cda129b2e7206224743b5c7fd33aa8ae062ff71b775ac9.yml
openapi_spec_hash: 2b2c2c684e6f6885398efca5f2b1f854
config_hash: 30d69c79e34a1ea6a0405573ce30d927
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/scrapegraphai%2Fscrapegraphai-633fdeab6abaefbe666099e8f86ce6b2acc9dacff1c33a80813bb04e8e437229.yml
openapi_spec_hash: f41ec90694ca8e7233bd20cc7ff1afbf
config_hash: 6889576ba0fdc14f2c71cea09a60a0f6
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Changelog

## 0.1.0 (2025-08-23)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/ScrapeGraphAI/scrapegraphai-c/compare/v0.0.1...v0.1.0)

### Features

* add files ([d02f336](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/d02f3362c13702753d986b0d0c35a753e3d28136))
* **client:** add switch and match helpers for unions ([ccad199](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/ccad1993a305c58d2595477e5ecc171dd798de9d))
* **client:** allow omitting all params object when all optional ([cf7d535](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/cf7d535c8802a1328e22dbccd58bff9186029827))
* **client:** improve signature of `trypickx` methods ([3af2386](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/3af2386fb58dc706227669f721e42ef5f45c72f6))
* **client:** shorten union variant names ([5d8fbc6](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/5d8fbc62da23aadf61ee88248acb409fec9c8bad))
* **internal:** add dedicated build job in ci ([19debc8](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/19debc832713e17708c2524bb9a09c1b967b36e5))


### Bug Fixes

* **client:** better type names ([198d17a](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/198d17a1e81f613235b5de7413ebe317c0965af0))
* **docs:** re-order using statements ([1529f4f](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/1529f4fa633537e3dfcf942d3898b400b074009c))
* **internal:** remove unused null class ([4625b19](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/4625b19d0f56f102c6e2a7cb8e953e8f83956e37))


### Chores

* configure new SDK language ([f87e130](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/f87e1302fbf8f0911a99c6ac94b704df8952798b))
* **internal:** codegen related update ([30ebeb9](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/30ebeb9bd332cb0a60dd013238811b8b7c2e781c))
* **internal:** remove unnecessary internal aliasing ([da2adae](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/da2adaed4478e4c9dea6629e9d5f30a1c1693267))
* **internal:** rename parameters ([136affb](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/136affb4677cc727730d120abf6f9232eda5d9b8))
* update SDK settings ([00653bc](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/00653bcbabf976cabc53a46e0ad4c6045f559509))


### Documentation

* **client:** add more property comments ([f427733](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/f427733d982b19d0cc1012be19978f34ae729f6f))
* fix installation instructions ([3d59690](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/3d5969023ab80e6e87b6770f15de1c4248fe5cf1))


### Refactors

* **client:** refine enum representation ([f427733](https://github.com/ScrapeGraphAI/scrapegraphai-c/commit/f427733d982b19d0cc1012be19978f34ae729f6f))
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
> This library has not yet been exhaustively tested in production environments and may be missing some features you'd expect in a stable release. As we continue development, there may be breaking changes that require updates to your code.
>
> **We'd love your feedback!** Please share any suggestions, bug reports, feature requests, or general thoughts by [filing an issue](https://www.github.com/stainless-sdks/scrapegraphai-csharp/issues/new).
> **We'd love your feedback!** Please share any suggestions, bug reports, feature requests, or general thoughts by [filing an issue](https://www.github.com/ScrapeGraphAI/scrapegraphai-c/issues/new).

The Scrapegraphai C# SDK provides convenient access to the [Scrapegraphai REST API](https://scrapegraphai.com) from applications written in C#.

Expand All @@ -16,7 +16,8 @@ The REST API documentation can be found on [scrapegraphai.com](https://scrapegra
## Installation

```bash
dotnet add package Scrapegraphai
git clone [email protected]:ScrapeGraphAI/scrapegraphai-c.git
dotnet add reference scrapegraphai-c/src/Scrapegraphai
```

## Requirements
Expand All @@ -31,9 +32,9 @@ This library requires .NET 8 or later.
See the [`examples`](examples) directory for complete and runnable examples.

```csharp
using System;
using Scrapegraphai;
using Scrapegraphai.Models.Smartscraper;
using System;

// Configured using the SCRAPEGRAPHAI_API_KEY and SCRAPEGRAPHAI_BASE_URL environment variables
ScrapegraphaiClient client = new();
Expand Down Expand Up @@ -91,4 +92,4 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/scrapegraphai-csharp/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/ScrapeGraphAI/scrapegraphai-c/issues) with questions, bugs, or suggestions.
71 changes: 71 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "simple",
"extra-files": [
"README.md",
{
"type": "xml",
"path": "src/Scrapegraphai/Scrapegraphai.csproj",
"xpath": "//Project/PropertyGroup/VersionPrefix"
}
]
}
2 changes: 2 additions & 0 deletions src/Scrapegraphai.Tests/Scrapegraphai.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<ImplicitUsings>disable</ImplicitUsings>
<!-- Disable skipped tests warnings -->
<NoWarn>$(NoWarn),xUnit1004</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class CreditServiceTest : TestBase
[Fact(Skip = "Prism tests are disabled")]
public async Task Retrieve_Works()
{
var credit = await this.client.Credits.Retrieve(new());
var credit = await this.client.Credits.Retrieve();
credit.Validate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class HealthzServiceTest : TestBase
[Fact(Skip = "Prism tests are disabled")]
public async Task Check_Works()
{
var response = await this.client.Healthz.Check(new());
var response = await this.client.Healthz.Check();
response.Validate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task Retrieve_Works()
[Fact(Skip = "Prism tests are disabled")]
public async Task List_Works()
{
var smartscrapers = await this.client.Smartscraper.List(new());
var smartscrapers = await this.client.Smartscraper.List();
smartscrapers.Validate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ValidateServiceTest : TestBase
[Fact(Skip = "Prism tests are disabled")]
public async Task APIKey_Works()
{
var response = await this.client.Validate.APIKey(new());
var response = await this.client.Validate.APIKey();
response.Validate();
}
}
56 changes: 56 additions & 0 deletions src/Scrapegraphai/ApiEnum.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Scrapegraphai;

public record struct ApiEnum<TRaw, TEnum>(JsonElement Json)
where TEnum : struct, Enum
{
public readonly TRaw Raw() =>
JsonSerializer.Deserialize<TRaw>(this.Json, ModelBase.SerializerOptions)
?? throw new NullReferenceException(nameof(this.Json));

public readonly TEnum Value() =>
JsonSerializer.Deserialize<TEnum>(this.Json, ModelBase.SerializerOptions);

public readonly void Validate()
{
if (!Enum.IsDefined(Value()))
{
throw new Exception();
}
}

public static implicit operator TRaw(ApiEnum<TRaw, TEnum> value) => value.Raw();

public static implicit operator TEnum(ApiEnum<TRaw, TEnum> value) => value.Value();

public static implicit operator ApiEnum<TRaw, TEnum>(TRaw value) =>
new(JsonSerializer.SerializeToElement(value, ModelBase.SerializerOptions));

public static implicit operator ApiEnum<TRaw, TEnum>(TEnum value) =>
new(JsonSerializer.SerializeToElement(value, ModelBase.SerializerOptions));
}

sealed class ApiEnumConverter<TRaw, TEnum> : JsonConverter<ApiEnum<TRaw, TEnum>>
where TEnum : struct, Enum
{
public override ApiEnum<TRaw, TEnum> Read(
ref Utf8JsonReader reader,
Type typeToConvert,
JsonSerializerOptions options
)
{
return new(JsonSerializer.Deserialize<JsonElement>(ref reader, options));
}

public override void Write(
Utf8JsonWriter writer,
ApiEnum<TRaw, TEnum> value,
JsonSerializerOptions options
)
{
JsonSerializer.Serialize(writer, value.Json, options);
}
}
4 changes: 2 additions & 2 deletions src/Scrapegraphai/HttpException.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System = System;

namespace Scrapegraphai;

public sealed class HttpException : System::Exception
public sealed class HttpException : Exception
{
public required HttpStatusCode? StatusCode { get; set; }
public required string ResponseBody { get; set; }
Expand Down
8 changes: 0 additions & 8 deletions src/Scrapegraphai/IEnum.cs

This file was deleted.

44 changes: 22 additions & 22 deletions src/Scrapegraphai/IScrapegraphaiClient.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
using Crawl = Scrapegraphai.Services.Crawl;
using Credits = Scrapegraphai.Services.Credits;
using Feedback = Scrapegraphai.Services.Feedback;
using GenerateSchema = Scrapegraphai.Services.GenerateSchema;
using Healthz = Scrapegraphai.Services.Healthz;
using Http = System.Net.Http;
using Markdownify = Scrapegraphai.Services.Markdownify;
using Searchscraper = Scrapegraphai.Services.Searchscraper;
using Smartscraper = Scrapegraphai.Services.Smartscraper;
using System = System;
using Validate = Scrapegraphai.Services.Validate;
using System;
using System.Net.Http;
using Scrapegraphai.Services.Crawl;
using Scrapegraphai.Services.Credits;
using Scrapegraphai.Services.Feedback;
using Scrapegraphai.Services.GenerateSchema;
using Scrapegraphai.Services.Healthz;
using Scrapegraphai.Services.Markdownify;
using Scrapegraphai.Services.Searchscraper;
using Scrapegraphai.Services.Smartscraper;
using Scrapegraphai.Services.Validate;

namespace Scrapegraphai;

public interface IScrapegraphaiClient
{
Http::HttpClient HttpClient { get; init; }
HttpClient HttpClient { get; init; }

System::Uri BaseUrl { get; init; }
Uri BaseUrl { get; init; }

/// <summary>
/// API key for authentication
/// </summary>
string APIKey { get; init; }

Smartscraper::ISmartscraperService Smartscraper { get; }
ISmartscraperService Smartscraper { get; }

Markdownify::IMarkdownifyService Markdownify { get; }
IMarkdownifyService Markdownify { get; }

Searchscraper::ISearchscraperService Searchscraper { get; }
ISearchscraperService Searchscraper { get; }

GenerateSchema::IGenerateSchemaService GenerateSchema { get; }
IGenerateSchemaService GenerateSchema { get; }

Crawl::ICrawlService Crawl { get; }
ICrawlService Crawl { get; }

Credits::ICreditService Credits { get; }
ICreditService Credits { get; }

Validate::IValidateService Validate { get; }
IValidateService Validate { get; }

Feedback::IFeedbackService Feedback { get; }
IFeedbackService Feedback { get; }

Healthz::IHealthzService Healthz { get; }
IHealthzService Healthz { get; }
}
Loading
Loading