Skip to content

Commit

Permalink
upgrade to dotnet 8 from 5
Browse files Browse the repository at this point in the history
allow more dotnet target
rename namespace and client class
  • Loading branch information
Victor Benarbia committed Jan 14, 2024
1 parent 33ee694 commit f61459e
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2022 SerpApi
Copyright (c) 2018-2024 SerpApi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

.PHONY: test

name=google-search-results-dotnet
name=serpapi
root=`pwd`
example=google

# set default framework version
framework_version=net5.0
framework_version=net8.0

# all
all: clean restore build test
Expand Down
4 changes: 2 additions & 2 deletions serpapi/serpapi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
namespace SerpApi
{
public class Client
public class SerpApi
{
const string JSON_FORMAT = "json";
const string HTML_FORMAT = "html";
Expand All @@ -23,7 +23,7 @@ public class Client
public HttpClient client;


public Client(Hashtable parameter = null)
public SerpApi(Hashtable parameter = null)
{
// assign query parameter
if(parameter == null) {
Expand Down
8 changes: 4 additions & 4 deletions serpapi/serpapi.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- net6.0 -->
<TargetFrameworks>net48;netcoreapp3.1;netstandard2.1;net5.0</TargetFrameworks>
<TargetFrameworks>net48;netcoreapp3.1;netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<RootNamespace>serpapi</RootNamespace>
<PackageId>serpapi</PackageId>
<Version>1.0.0</Version>
Expand All @@ -11,10 +11,10 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReleaseNotes>README.md</PackageReleaseNotes>
<Title>Google-Search-Results</Title>
<PackageDescription>Search Results via SERP API. Hash, JSON, and HTML format supported for Google, Bing, Baidu, Yandex, eBay, Google Product, YouTube, Walmart and more...</PackageDescription>
<Title>serpapi</Title>
<PackageDescription>Integrate search data into your Ruby application. This library is the official wrapper for SerpApi. SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.</PackageDescription>
<PackageTags>Search,Engine,Google,Search,Result,JSON,Scraping,Scrape,Crawl,Baidu,Bing,eBay,Walmart,Yandex,YouTube,ML,Machine,learning</PackageTags>
<Copyright>SerpApi LLC 2019-2022</Copyright>
<Copyright>SerpApi LLC 2019-2024</Copyright>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<IsPackable>true</IsPackable>
<IsTestProject>true</IsTestProject>
Expand Down
4 changes: 2 additions & 2 deletions test/account_test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace SerpApi.Test
[TestClass]
public class AccountTest
{
private SerpApi.Client client;
private SerpApi client;
private string apiKey;

public AccountTest()
{
apiKey = Environment.GetEnvironmentVariable("API_KEY");
Hashtable ht = new Hashtable();
ht.Add("api_key", apiKey);
this.client = new SerpApi.Client(ht);
this.client = new SerpApi(ht);
}

public void TestGetAccount()
Expand Down
4 changes: 2 additions & 2 deletions test/archive_search_test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SerpApi.Test
[TestClass]
public class ArchiveSearchTest
{
private SerpApi.Client client;
private SerpApi client;
private Hashtable ht;
private string apiKey;

Expand All @@ -33,7 +33,7 @@ public void TestArchiveSearch()
return;
}

client = new SerpApi.Client(ht);
client = new SerpApi(ht);

Hashtable searchParameter = new Hashtable();
searchParameter.Add("location", "Austin, Texas, United States");
Expand Down
6 changes: 3 additions & 3 deletions test/google_search_test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SerpApi.Test
[TestClass]
public class GoogleSearchTest
{
private SerpApi.Client client;
private SerpApi client;
private Hashtable ht;
private string apiKey;

Expand All @@ -27,7 +27,7 @@ public GoogleSearchTest()
[TestMethod]
public void TestSearch()
{
client = new SerpApi.Client(ht);
client = new SerpApi(ht);

Hashtable searchParameter = new Hashtable();
searchParameter.Add("location", "Austin, Texas, United States");
Expand Down Expand Up @@ -61,7 +61,7 @@ public void TestSearch()
[TestMethod]
public void TestHtml()
{
client = new SerpApi.Client(ht);
client = new SerpApi(ht);

Hashtable searchParameter = new Hashtable();
searchParameter.Add("location", "Austin, Texas, United States");
Expand Down
4 changes: 2 additions & 2 deletions test/location_test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SerpApi.Test
[TestClass]
public class LocationTest
{
private SerpApi.Client client;
private SerpApi client;
private string apiKey;

public LocationTest()
Expand All @@ -21,7 +21,7 @@ public LocationTest()
[TestMethod]
public void TestLocation()
{
client = new SerpApi.Client();
client = new SerpApi();
Hashtable locationParameter = new Hashtable();
locationParameter.Add("q", "Austin,TX");
locationParameter.Add("limit", "5");
Expand Down
4 changes: 2 additions & 2 deletions test/serpapi_search_test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void TestSpecialCharactersEncoding()
ht.Add("google_domain", "google.com");
ht.Add("engine", "google");
ht.Add("api_key", apiKey);
SerpApi.Client client = new SerpApi.Client(ht);
SerpApi client = new SerpApi(ht);
client.defaultParameter.Remove("q");
client.defaultParameter.Remove("location");
client.defaultParameter.Remove("hl");
Expand All @@ -69,7 +69,7 @@ public void TestSearchModifiedSpecialCharacters()
ht.Add("q", "(h)wīt ˈkôfē !");
ht.Add("engine", "google");
ht.Add("api_key", apiKey);
SerpApi.Client client = new SerpApi.Client(ht);
SerpApi client = new SerpApi(ht);
JObject data = client.search(ht);
dynamic first = ((JArray)data["organic_results"])[0];
Assert.AreEqual<string>((string)first["position"], "1");
Expand Down
2 changes: 1 addition & 1 deletion test/test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
Expand Down

0 comments on commit f61459e

Please sign in to comment.