当前位置: 首页>>代码示例>>C#>>正文


C# RestRequest.AddUrlSegment方法代码示例

本文整理汇总了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;
		}
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:10,代码来源:IncomingPhoneNumbers.cs

示例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;
        }
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:10,代码来源:Accounts.cs

示例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;
		}
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:10,代码来源:Applications.cs

示例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;

        }
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:11,代码来源:AuthorizedConnectApps.cs

示例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);
        }
开发者ID:kevinmcmahon,项目名称:RestSharp,代码行数:11,代码来源:UrlBuilderTests.cs

示例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;

        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:11,代码来源:Conference.cs

示例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;

		}
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:11,代码来源:Sms.cs

示例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;

        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:12,代码来源:AvailablePhoneNumbers.cs

示例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));
 }
开发者ID:changsunfung,项目名称:RestSharp.Portable,代码行数:13,代码来源:Encodings.cs

示例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);
            }
        }
开发者ID:ReachContact,项目名称:restsharp.portable,代码行数:22,代码来源:AuthenticationTests.cs

示例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;

        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:13,代码来源:Transcriptions.cs

示例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;

        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:14,代码来源:AvailablePhoneNumbers.cs

示例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;

        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:15,代码来源:Conference.cs

示例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;
        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:11,代码来源:Conference.cs

示例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;
		}
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:17,代码来源:Accounts.cs


注:本文中的RestRequest.AddUrlSegment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。