Code Monkey home page Code Monkey logo

csharp-ovh's People

Contributors

deathiop avatar jotune avatar lukemarlin avatar namaneo avatar philippeverney avatar rbeuque74 avatar rubenmch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csharp-ovh's Issues

Replace all <T,Y> methods by <T>

Currently, to send an object as the data, it is mandatory to use the <T,Y> override, which isn't providing anything useful.

Using and passing an object without type checking would be way simpler, and allows to give anonymous objects to simplifies PUT calls (partial payloads)

Scope timeout to Ovh.Client instance

Timeout param currently works in a strange way.
Ovh.Client._httpClient is static and instantiated at the first construction of an Ovh.Client.
During that first instantiation, _httpClient.Timeout is set to Ovh.Client constuctor's timeout param.

It means that during subsequent instantiations, the timeout param is effectively ignore.

No definition for "RequestConsumerKey"

CredentialRequestResult credentialRequestResult = client.RequestConsumerKey(requestPayload);

seems to be obsolete? I'm trying to get the consumer key but "RequestConsumerKey" seems like it does not exist.

Error Cannot deserialize the current JSON object into type 'System.Int64'

I'm trying to use this library with .NET Core 3.1 but all the calls throw the following exception:

Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.
To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Ovh.Api.Client.CallAsync[T](String method, String path, String data, Boolean needAuth, Boolean isBatch, Nullable`1 timeout)
   at Ovh.Api.Client.ComputeTimeDelta()
   at Ovh.Api.Client.GetTimeDelta()
   at Ovh.Api.Client.SetHeaders(HttpRequestMessage msg, String method, String target, String data, Boolean needAuth, Boolean isBatch)
   at Ovh.Api.Client.CallAsync(String method, String path, String data, Boolean needAuth, Boolean isBatch, Nullable`1 timeout)
   at Ovh.Api.Client.CallAsync[T](String method, String path, String data, Boolean needAuth, Boolean isBatch, Nullable`1 timeout)

Github documentation is obsolete.

Right from the start , the documentation says :

CredentialRequest requestPayload = new CredentialRequest(
    new List<AccessRight>(){
        new AccessRight("GET", "/me"),
    }
);

This method takes 2 parameters.

Add an IEnumerable API to ease subsequent calls

Goal: achieve some mechanism that would fetch an array from a route ("/route/thing") and then issue automatic calls to "/route/thing/", enabling code like this:

foreach (var thing in Client.GetEnumerator("/route/thing"))

No responses to any api calls

Hello,

I've created a script token and using it to authenticate my app (eu ovh).
But I'm not getting any response from the api to any request I send.
For example, I'm doing PartialMe me = await client.GetAsync("/me"); and my app freezes because there is no response. Same for any other endpoint.
Is there a way to get any help with this?

It would be great to have a basic example app (full solution) that I could use to try and pinpoint the issue.

Thank you
Andrew

An exception occured while trying to issue the HTTP call ??

Even with the simple example (bellow) I alway receive the error An exception occured while trying to issue the HTTP call
How can I debug this issue?

        public static async Task<string> MyInfo()
        {
            try
            {
                Log.Info($"Connecting to OVH...");
                Client client = new Client();
                Log.Info($"Connected");
                PartialMe me = await client.GetAsync<PartialMe>("/me");
                Log.Info($"Hello {me.firstname}!");
                return me.firstname;
            }
            catch (Exception ex)
            {
                Log.Warn(ex.Message);
                return null;
            }
        }

I have a .ovh.conf file

WebClient not supporting concurrent I/O operations

Hi,

I´m getting some exceptions with WebClients not supporting concurrent I/O operations.

11.07.2019 09:46:26 WebClient unterstützt keine gleichzeitigen E/A-Vorgänge. 11.07.2019 09:46:26 bei System.Net.WebClient.ClearWebClientState() bei System.Net.WebClient.DownloadString(Uri address) bei System.Net.WebClient.DownloadString(String address) bei Ovh.Api.Client.Call(String method, String path, String data, Boolean needAuth, Boolean isBatch) bei Ovh.Api.Client.Call[T](String method, String path, String data, Boolean needAuth, Boolean isBatch) bei Ovh.Api.Client.Get[T](String target, QueryStringParams kwargs, Boolean needAuth) bei OVHDomainSwitcher.Service.<>c__DisplayClass8_0.<OnStart>b__0(Object state) in E:\workspace\vs2017\ovhdomainswitcher\OVHDomainSwitcher\OVHDomainSwitcher\Service.cs:Zeile 172.

I use the "Get<>" method so I don´t think it´s async and I run it in sync on a for loop so a call and only execute when the pevious already finished, that causes some confusion on my side.
Could you check if the issue might be caused inside the API in any way ?

That´s my logic in pseudo-code:

ovh.getDomains()
foreach(domain in domains){
ovh.Get(RecordIDs)
ovh.Get(RecordID/Target)
if(ping target != success) {
ovh.Post(RecordID/Target, newIP)
}
}

Best regards,
Fabian

Support for .NET Standard

The project should be available in .NET Standard 2.0 more than in .NET Core 2.0.
.NET Standard 2.0 support .NET Core 2.0, .NET Framework 4.6.1+, Mono, Xamarin and UWP - ref

Should I go for it ?

EDIT: It seems that ini-parser 2.5.2 does not support .NET Core nor .NET Standard (Warning NU1701). The ini-parser team planned support for version 3.

Error logging?

This is probably not an issue but how do I error log the response? I did not find anything regarding "error logging" inside the doc.

Support batch GET calls

Batch calls require a HTTP header X-Ovh-Batch specifying the split character (e.g. ,) and allows to send calls like that:

GET /domain/zone/example.com/record/123456788,123456789,...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.