I just knew about the RestSharp and started exploring it.
I could find how to "Log-in" using a user already created doing this:
var client = new RestClient("http://example.com");
client.Authenticator = new SimpleAuthenticator("username", "foo", "password", "bar");
var request = new RestRequest("resource", Method.GET);
client.Execute(request);
But is there a way of actually creating a user in the firebase using the Restshart? Equivilant to this using the Firebase object in JAVA
var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");
ref.createUser({email:"bobtony#firebase.com",password:"correcthorsebatterystaple"});
I know it is possible to create a node for emails/passwords and manage them manually, but I would like to use the Firebase users auths.
Since the library is called RestSharp, it likely builds on top of the Firebase Legacy REST API. That API does not have functionality to create users.
Related
The graphQLClient package: https://github.com/graphql-dotnet/graphql-client
Integrating queries and mutations through the GraphQL client package was pretty easy. Since I was able to add authentication through a custom HttpMessageHandler and I was then able to use the AWSV4Signer to sign the request before it is sent. The problem which I am currently facing with subscriptions is that this message handler is not being invoked for the requests sent through the subscriptions. Which makes sense since it uses WebSockets and not Http. My question is whether I can use something like the HttpMessageHandler but for web sockets in order to sign the requests(more generally, edit them before they are sent) or I will just have to build and send the web socket requests from scratch like in this post:
AWS Appsync implementation using GraphQL-client library in .Net
The code for sending a mutation or query:
var graphQlRequest = new GraphQLRequest
{
Query = mutation
};
var graphQlClient = new GraphQLHttpClient(new GraphQLHttpClientOptions
{
EndPoint = new Uri(endpoint),
HttpMessageHandler = new AWSMessageHandler(accessKey, secretKey)
},
new NewtonsoftJsonSerializer());
graphQlClient.HttpClient.DefaultRequestHeaders.Add("x-amz-security-token", sessionToken);
var respoonse = await graphQlClient.SendMutationAsync<T>(graphQlRequest);
The AWSMessageHandler is a custom class I built, It simply signs the HttpRequestMessage before it is sent.
I've got a C# project and the dialogflow google api reference added in it.
using Google.Cloud.Dialogflow.V2;
And I want to know if I can use that to import a zip to my dialogflow agent.
Using the Dialogflow Web Console I can do this:
Would be great if I could achieve this functionality in C# somehow.
Any help / advice would be appreciated.
I'd expect that to be a matter of calling AgentsClient.ImportAgent, e.g.
var zipFile = File.ReadAllBytes("agent.zip");
var zipByteString = ByteString.CopyFrom(zipFile);
var client = AgentsClient.Create();
var request = new ImportAgentRequest
{
ParentAsProjectName = new ProjectName("[YOUR PROJECT ID]")
AgentContent = zipByteString
};
var operation = client.ImportAgent(client);
operation.PollUntilCompleted();
I am trying to use Bing's speech API within the Bot Framework (I am familiarizing myself with both of these technologies). Specifically, I am trying to use the DataClientWithIntent that it supports. I was able to look at this example in GitHub, but unfortunately this is seems to be using DataClient only and I am not able to identify where this is specified. The API is being called in the following manner:
using (var client = new HttpClient())
{
var token = Authentication.Instance.GetAccessToken();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token.access_token);
using (var binaryContent = new ByteArrayContent(StreamToBytes(audiostream)))
{
binaryContent.Headers.TryAddWithoutValidation("content-type", "audio/wav; codec=\"audio/pcm\"; samplerate=16000");
var response = await client.PostAsync(requestUri, binaryContent);
var responseString = await response.Content.ReadAsStringAsync();
dynamic data = JsonConvert.DeserializeObject(responseString);
return data.header.name;
}
As you can see a stream is passed in, but unfortunately this only writes back what the user wrote.
I have already developed a test bot that uses a Luis application for what I want, but I want to add the ability for the user to either talk to it or type and achieve the same results. I did find this other example, but this is implementing it directly through the Skype framework, which is something I am not interested in at the moment.
Any ideas, documentation, or clarification would be appreciated.
i have created desktop Facebook application using c# .net. i want to retrieve users message,post and chat history. which is convenient way to retrieve users all information.i have started with Facebook Graph API but i am not getting any example.
can any one help me ?
A bit late to the party but anyway:
Add a reference to System.Net.Http and Newtonsoft.Json
string userToken = "theusertokentogiveyoumagicalpowers";
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://graph.facebook.com");
HttpResponseMessage response = client.GetAsync($"me?fields=name,email&access_token={userToken}").Result;
response.EnsureSuccessStatusCode();
string result = response.Content.ReadAsStringAsync().Result;
var jsonRes = JsonConvert.DeserializeObject<dynamic>(result);
var email = jsonRes["email"].ToString();
}
Go to developer.facebook.com -> Tools & Support -> Select Graph API Explorer
Here U get FQL Query, Access Token
Then write code in C#.....
var client = new FacebookClient();
client.AccessToken = Your Access Token;
//show user's profile picture
dynamic me = client.Get("me?fields=picture");
pictureBoxProfile.Load(me.picture.data.url);
//show user's birthday
me = client.Get("me/?fields=birthday");
labelBirthday.Text = Convert.ToString(me.birthday);
http://www.codeproject.com/Articles/380635/Csharp-Application-Integration-with-Facebook-Twitt
I hope this will help you.!!!
you can check the Graph explorer tool on Developer.facebook.com , go to Tools and select graph explorer, its a nice tool which gives you exact idea about what you can fetch by sending "GET" and "POST" method on FB Graph APis
From what i see the app now only uses webhooks to post data to a data endpoint (in your app) at which point you can parse and use this. (FQL is deprecated). This is used for things like messaging.
A get request can be send to the API to get info - like the amt. of likes on your page.
The docs of FB explain the string you have to send pretty nicely. Sending requests can be done with the webclient, or your own webrequests.
https://msdn.microsoft.com/en-us/library/bay1b5dh(v=vs.110).aspx
Then once you have a string of the JSON formatted page you can parse this using JSON.NET library. It's available as a NUGEt package.
I'm trying to create a valid RestRequest for taking advantage of the GET statuses/user_timeline.json provided by the Twitter API.
I have a dev account and my Consumer Key/Secret and AccessToken/TokenSecret
_restClient.Timeout = 60000;
_restClient.BaseUrl = "http://api.twitter.com/1.1"
_restClient.Authenticator = OAuth1Authenticator.ForProtectedResource(cKey, cSecret, aT, aTSecret)
var request = new RestRequest("statuses/user_timeline.json?screen_name=default", Method.GET)
var response = _restClient.Execute(request)
To this request I receive the response
{"errors":[{"message":"Could not authenticate you","code":32}]}
I suspect that I'm missing a step, since many resources I've found reach out to the BaseUrl of "api.twitter.com" first in order to make an TokenRequest, but I already have my token, so I'm not sure why that step would be necessary.
Thanks!
SOLUTION:
I've solved the problem simply by using the c# package TweetSharp
var service = new TwitterService(_twitterConfiguration.ConsumerKey, _twitterConfiguration.ConsumerSecret);
service.AuthenticateWith(_twitterConfiguration.AccessToken, _twitterConfiguration.AccessTokenSecret);
The above is everything you need to get connected to the twitter-api-1.1 service (as well as you're relevant tokens)