kevbite / CompaniesHouse.NET

A simple .NET client wrapper for CompaniesHouse API
MIT License
37 stars 44 forks source link

Please include a sample project to help new users #122

Closed s3quential closed 3 years ago

s3quential commented 4 years ago

Could you include a sample project with the simplest request set up? With apologies, I can't follow the docs sufficiently to get up and running.

Specifically, I'm struggling with:

1) HTTPClient creation - have you done this already in the package but for the following?

using(var client = new CompaniesHouseClient(settings)) { // Do some work... }

When I use this inside a razor component with @using CompaniesHouse I get an <invalid-global-code> error and VS cannot seem to find a CompaniesHouseClient

2. Deserialization - am I deserializing into a class model in the package; if so, which? I appreciate that it will differ for each search so an example for any one would help.

3. Searching for resources - are the parts in the docs to go on the page or in the component (Blazor) using them or in the service (brings me back to 1 and how the service, if any, is registered).

var request = new SearchRequest() { Query = "Jay2Base", StartIndex = 10, ItemsPerPage = 10 };

Context is that I'm trying to implement this in server side Blazor. Low experience but know sufficient that I think I can read across if I see a complete example or blog post, etc.

I'm asking for a sample as I assume that will be the least effort to someone familiar with this. Thank you for the work so far.

kevbite commented 4 years ago

Hello @s3quential There is an example scenario which we use for testing the library which can be found here: https://github.com/kevbite/CompaniesHouse.NET/blob/master/src/CompaniesHouse.ScenarioTests/SearchForAnOfficerAndFetchCorrespondingCompanyScenarioTests.cs#L22

Not sure if this is helpful or not, or would you want a more fully fledged example using say Blazor? The problem with us keeping examples like this is that they'll easily go out of date and there are unlimited usecases.

However, happy to help you along if the above example is not sufficient.

Thanks

Kev

s3quential commented 4 years ago

Thanks Kev, if that's the full set up then it should be super simple and its just my blind spot.

I'll implement and come back with any questions only if needed.

Cheers for that!

kevbite commented 3 years ago

I've added a hacktoberfest label as this would be a nice one for someone to do in the community, the code is already in the tests just needs pulling in to a console app/api/mvc site 👍.

mosoftwareenterprises commented 3 years ago

@kevbite can I take this one?

kevbite commented 3 years ago

Yeah that's great @mosoftwareenterprises, I've just seen the PR I'll review it later on today 👍