Comments (9)
Actually, I made the PR.
from csharp-ovh.
Thank you for bringing that to my attention.
I'll be looking into this as soon as possible! (most probably tomorrow maximum)
from csharp-ovh.
Fixed with #20 and #21 for now.
When I'm done with #13 I'll update the nuget package and do a full check of documentation.
In the meantime I'll leave this issue opened as there might well be more obsolete stuff :)
from csharp-ovh.
This same code snippet also misses "using Ovh.Api.Models;"
By doing a copy paste of the code snippet, the compiler could not find "CredentialRequest" class without this "using".
from csharp-ovh.
I'll check this before the week end, thanks for the report
from csharp-ovh.
I think you also miss a code line to make the same code snippet working : "client.ConsumerKey = credentialRequestResult.ConsumerKey;"
Here is a proposed change. Sorry, I am too lazy to make a fork and a PR.
.. code:: csharp
using Ovh.Api;
using Ovh.Api.Models; // TO BE ADDED!!!!!!
using System;
using System.Collections.Generic;
namespace api_tester
{
class Program
{
static void Main(string[] args)
{
Client client = new Client();
CredentialRequest requestPayload = new CredentialRequest(
new List<AccessRight>(){
new AccessRight("GET", "/me")
},
"https://redirect.url" // CHANGE THIS URL IF YOU DON'T WANT TO SEE AN UNREACHING WEBPAGE AFTER YOU LOGGED IN
);
CredentialRequestResult credentialRequestResult =
client.RequestConsumerKey(requestPayload);
Console.Write(
String.Format("Please visit {0} to authenticate ",
credentialRequestResult.ValidationUrl));
Console.WriteLine("and press enter to continue");
Console.ReadLine();
client.ConsumerKey = credentialRequestResult.ConsumerKey; // TO BE ADDED!!!!!!
PartialMe me = client.Get<PartialMe>("/me");
Console.WriteLine(
String.Format("Welcome, {0}", me.firstname));
Console.WriteLine(
String.Format("Btw, your 'consumerKey' is {0}",
credentialRequestResult.ConsumerKey));
Console.ReadLine();
}
}
class PartialMe
{
public string firstname { get; set; }
public string name { get; set; }
}
}
from csharp-ovh.
Thank you very much!
I guess that I skipped that missing line because I had a key registered in my env, so it worked for me anyway :)
I'll check and merge is as soon as possible!
from csharp-ovh.
Hi Luke,
In documentation paragraph "Install a new mail redirection", this code line does not compile : client.Post(String.Format("/email/domain/{0}/redirection", domain), payload);
Indeed, payload is a dictionary but the post method requires a simple string as a second parameter, not a dictionary.
Could you correct this please?
from csharp-ovh.
@philippeVerney Fixed with #27.
Made me wonder why I dropped the simple API of Call<T>([...], object data)
and forced users to specify a Y
for the input data type. The only thing that is done is serialization by Json.Net.
If we still had the old way, that example would still be working. I might remove these <T,Y>
versions and use object
instead of Y
soon as I see no benefits to using them.
If you can confirm it's alright, I'll merge the PR and close that issue.
from csharp-ovh.
Related Issues (20)
- Add an IEnumerable API to ease subsequent calls HOT 1
- Object Storage API HOT 1
- Improve JSON parsing exception by sending back problematic string HOT 1
- WebClient not supporting concurrent I/O operations HOT 6
- Remove sync methods HOT 1
- Scope timeout to Ovh.Client instance
- Allow to give a timeout per call
- Replace all <T,Y> methods by <T> HOT 1
- Create releases directly on travis HOT 1
- No responses to any api calls HOT 9
- Dot Net Core 3.1, Can not find Ovh namespace. HOT 3
- No definition for "RequestConsumerKey" HOT 3
- Error logging? HOT 2
- Error Cannot deserialize the current JSON object into type 'System.Int64' HOT 3
- An exception occured while trying to issue the HTTP call ?? HOT 5
- How do you change the provider in code without declaring a new client? HOT 2
- Unable to handle HTTP 204 correctly
- Add US endpoint
- Support for .NET Standard HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharp-ovh.