本文整理汇总了C#中RestRequest.AddUrlSegment方法的典型用法代码示例。如果您正苦于以下问题:C# RestRequest.AddUrlSegment方法的具体用法?C# RestRequest.AddUrlSegment怎么用?C# RestRequest.AddUrlSegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RestRequest
的用法示例。
在下文中一共展示了RestRequest.AddUrlSegment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIncomingPhoneNumberAsyncInternal
private async Task<IncomingPhoneNumber> GetIncomingPhoneNumberAsyncInternal(string incomingPhoneNumberSid)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/IncomingPhoneNumbers/{IncomingPhoneNumberSid}.json";
request.AddUrlSegment("IncomingPhoneNumberSid", incomingPhoneNumberSid);
var result = await ExecuteAsync(request, typeof(IncomingPhoneNumber));
return (IncomingPhoneNumber)result;
}
示例2: GetAccountAsyncInternal
private async Task<Account> GetAccountAsyncInternal(string accountSid)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}.json";
request.AddUrlSegment("AccountSid", accountSid);
var result = await ExecuteAsync(request, typeof(Account));
return (Account)result;
}
示例3: GetApplicationAsyncInternal
private async Task<Application> GetApplicationAsyncInternal(string applicationSid)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/Applications/{ApplicationSid}.json";
request.AddUrlSegment("ApplicationSid", applicationSid);
var result = await ExecuteAsync(request, typeof(Application));
return (Application)result;
}
示例4: GetAuthorizedConnectAppAsyncInternal
private async Task<AuthorizedConnectApp> GetAuthorizedConnectAppAsyncInternal(string authorizedConnectAppSid)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/AuthorizedConnectApps/{AuthorizedConnectAppSid}.json";
request.AddUrlSegment("AuthorizedConnectAppSid", authorizedConnectAppSid);
var result = await ExecuteAsync(request, typeof(AuthorizedConnectApp));
return (AuthorizedConnectApp)result;
}
示例5: GET_with_resource_containing_tokens
public void GET_with_resource_containing_tokens()
{
var request = new RestRequest("resource/{foo}");
request.AddUrlSegment("foo", "bar");
var client = new RestClient("http://example.com");
var expected = new Uri("http://example.com/resource/bar");
var output = client.BuildUri(request);
Assert.Equal(expected, output);
}
示例6: GetConferenceAsyncInternal
private async Task<Conference> GetConferenceAsyncInternal(string conferenceSid)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/Conferences/{ConferenceSid}.json";
request.AddUrlSegment("ConferenceSid", conferenceSid);
var result = await ExecuteAsync(request, typeof(Conference));
return (Conference)result;
}
示例7: GetSmsMessageAsyncInternal
private async Task<SMSMessage> GetSmsMessageAsyncInternal(string smsMessageSid)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/SMS/Messages/{SMSMessageSid}.json";
request.AddUrlSegment("SMSMessageSid", smsMessageSid);
//return Execute<SMSMessage>(request);
var result = await ExecuteAsync(request, typeof(SMSMessage));
return (SMSMessage)result;
}
示例8: ListAvailableTollFreePhoneNumbersAsyncInternal
private async Task<AvailablePhoneNumberResult> ListAvailableTollFreePhoneNumbersAsyncInternal(string isoCountryCode)
{
Require.Argument("isoCountryCode", isoCountryCode);
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/AvailablePhoneNumbers/{IsoCountryCode}/TollFree.json";
request.AddUrlSegment("IsoCountryCode", isoCountryCode);
var result = await ExecuteAsync(request, typeof(AvailablePhoneNumberResult));
return (AvailablePhoneNumberResult)result;
}
示例9: TestGetMtGoxTicker
public async Task TestGetMtGoxTicker()
{
var client = new RestClient(new Uri("https://data.mtgox.com/api/2/"));
client.AddEncoding("GZIP", new RestSharp.Portable.Encodings.GzipEncoding());
//client.IgnoreResponseStatusCode = true;
var request = new RestRequest("BTC{currency}/money/ticker", HttpMethod.Get);
request.AddUrlSegment("currency", BitCoin.Trade.MtGox.Currency.USD);
var tmp = await client.Execute<TickerResult>(request);
Assert.IsNotNull(tmp.Data);
Assert.AreEqual(BitCoin.Trade.MtGox.Currency.BTC, tmp.Data.Data.Item);
Assert.IsNotNull(tmp.Data.Data.Last);
System.Diagnostics.Debug.WriteLine(System.Text.Encoding.UTF8.GetString(tmp.RawBytes));
}
示例10: TestHttpBasicAuthHidden
public async Task TestHttpBasicAuthHidden(Type factoryType)
{
const string username = "user name";
const string password = "passwd";
using (var client = new RestClient("http://httpbin.org")
{
CookieContainer = new CookieContainer(),
HttpClientFactory = CreateClientFactory(factoryType, false),
Credentials = new NetworkCredential(username, password),
Authenticator = new HttpHiddenBasicAuthenticator(),
})
{
var request = new RestRequest("hidden-basic-auth/{username}/{password}", Method.GET);
request.AddUrlSegment("username", username);
request.AddUrlSegment("password", password);
var response = await client.Execute<AuthenticationResult>(request);
Assert.True(response.Data.Authenticated);
Assert.Equal(username, response.Data.User);
}
}
示例11: ListTranscriptionsAsyncInternal
private async Task<TranscriptionResult> ListTranscriptionsAsyncInternal(string recordingSid, int? pageNumber, int? count)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions.json";
request.AddUrlSegment("RecordingSid", recordingSid);
if (pageNumber.HasValue) request.AddParameter("Page", pageNumber.Value);
if (count.HasValue) request.AddParameter("PageSize", count.Value);
var result = await ExecuteAsync(request, typeof(TranscriptionResult));
return (TranscriptionResult)result;
}
示例12: ListAvailableLocalPhoneNumbersAsyncInternal
private async Task<AvailablePhoneNumberResult> ListAvailableLocalPhoneNumbersAsyncInternal(string isoCountryCode, AvailablePhoneNumberListRequest options)
{
Require.Argument("isoCountryCode", isoCountryCode);
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/AvailablePhoneNumbers/{IsoCountryCode}/Local.json";
request.AddUrlSegment("IsoCountryCode", isoCountryCode);
AddNumberSearchParameters(options, request);
var result = await ExecuteAsync(request, typeof(AvailablePhoneNumberResult));
return (AvailablePhoneNumberResult)result;
}
示例13: ListConferenceParticipantsAsyncInternal
private async Task<ParticipantResult> ListConferenceParticipantsAsyncInternal(string conferenceSid, bool? muted, int? pageNumber, int? count)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants.json";
request.AddUrlSegment("ConferenceSid", conferenceSid);
if (muted.HasValue) request.AddParameter("Muted", muted.Value);
if (pageNumber.HasValue) request.AddParameter("Page", pageNumber.Value);
if (count.HasValue) request.AddParameter("PageSize", count.Value);
var result = await ExecuteAsync(request, typeof(ParticipantResult));
return (ParticipantResult)result;
}
示例14: KickConferenceParticipantAsyncInternal
private async Task<bool> KickConferenceParticipantAsyncInternal(string conferenceSid, string callSid)
{
var request = new RestRequest();
request.Method = Method.DELETE;
request.Resource = "Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json";
request.AddUrlSegment("ConferenceSid", conferenceSid);
request.AddUrlSegment("CallSid", callSid);
var response = (RestResponse)await ExecuteAsync(request);
return response.StatusCode == (int)System.Net.HttpStatusCode.NoContent;
}
示例15: ChangeSubAccountStatusAsyncInternal
private async Task<Account> ChangeSubAccountStatusAsyncInternal(string subAccountSid, AccountStatus status)
{
if (subAccountSid == AccountSid)
{
throw new InvalidOperationException("Subaccount status can only be changed when authenticated from the master account.");
}
var request = new RestRequest();
request.Method = Method.POST;
request.Resource = "Accounts/{AccountSid}.json";
request.AddParameter("Status", status.ToString().ToLower());
request.AddUrlSegment("AccountSid", subAccountSid);
var result = await ExecuteAsync(request, typeof(Account));
return (Account)result;
}