daspuru / contentful-xamarin-forms

This is a test for using Contentful.Net in a Xamarin.Forms project. It loads a string of content in the main page.
MIT License
0 stars 0 forks source link

2 errors and 1 warning from the start. #1

Open LouieSalinas23 opened 6 years ago

LouieSalinas23 commented 6 years ago

I am getting the following 2 errors and 1 warning even after I add my Keys and ID's.


Warning is line 15 public partial class ContentfulFormsTestPage : ContentPage { public ContentfulFormsTestPage() { InitializeComponent(); getLabel(); }

ContentfulFormsTestPage.xaml.cs(15,13,15,23): warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.


Errors are lines 20 and 21 var client = new ContentfulClient(httpClient, "Contentful's Key xxxxxxx", "Space Id xxxxxx"); var entry = await client.GetEntryAsync<Entry>("Entry's Id xxxxxx");

---ContentfulFormsTestPage.xaml.cs(20,30,20,46): error CS7036: There is no argument given that corresponds to the required formal parameter 'spaceId' of 'ContentfulClient.ContentfulClient(HttpClient, string, string, string, bool)'

---ContentfulFormsTestPage.xaml.cs(21,38,21,67): error CS1061: 'ContentfulClient' does not contain a definition for 'GetEntryAsync' and no extension method 'GetEntryAsync' accepting a first argument of type 'ContentfulClient' could be found (are you missing a using directive or an assembly reference?) 1 Warning(s) 2 Error(s)

Thank You so much for your time and assistance!

daspuru commented 6 years ago

Hi!

This code was an functional experiment 5 months ago, by now, for you error's description, It may be that the API in the Contentful client have changed. Please check the updated API for the class ContentfulClient of the SDK.

We used the beta version of the Nuget packet "contentful.csharp" : "0.12.0-beta", please check the new definition of their API at https://github.com/contentful/contentful.net. Now the version is 2.02!

I hope this helps.

Greetings

LouieSalinas23 commented 6 years ago

Thank You for pointing that out, it was just implemented differently in the newer version of the API. Instead of: var client = new ContentfulClient(httpClient, "Contentful's Key xxxxxxx", "Space Id xxxxxx"); var entry = await client.GetEntryAsync("Entry's Id xxxxxx");

It had to be: // contentful.csharp 2.x.x var client = new ContentfulClient(httpClient, "", "" ""); var entry = await client.GetEntry("");