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


C# Request.AddUrlSegment方法代码示例

本文整理汇总了C#中Request.AddUrlSegment方法的典型用法代码示例。如果您正苦于以下问题:C# Request.AddUrlSegment方法的具体用法?C# Request.AddUrlSegment怎么用?C# Request.AddUrlSegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request.AddUrlSegment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RetrieveReference

        /// <summary>
        /// Retrieve a Item from a custom reference.
        /// </summary>
        /// <param name="name">String containing the name of the custom reference to search for.</param>
        /// <param name="value">String containing the value of the custom reference to search for.</param>
        /// <returns>EasyPost.Item instance.</returns>
        public static Item RetrieveReference(string name, string value) {
            Request request = new Request("items/retrieve_reference/?{name}={value}");
            request.AddUrlSegment("name", name);
            request.AddUrlSegment("value", value);

            return request.Execute<Item>();
        }
开发者ID:andyfengc,项目名称:Demo_.Net,代码行数:13,代码来源:Item.cs

示例2: RemoveShipments

        /// <summary>
        /// Remove shipments from the batch.
        /// </summary>
        /// <param name="shipmentIds">List of shipment ids to be removed.</param>
        public void RemoveShipments(IEnumerable<string> shipmentIds) {
            Request request = new Request("batches/{id}/remove_shipments", Method.POST);
            request.AddUrlSegment("id", id);

            List<Dictionary<string, object>> body = shipmentIds.Select(shipmentId => new Dictionary<string, object>() { { "id", shipmentId } }).ToList();
            request.AddBody(body, "shipments");

            this.Merge(request.Execute<Batch>());
        }
开发者ID:andyfengc,项目名称:Demo_.Net,代码行数:13,代码来源:Batch.cs

示例3: Buy

        /// <summary>
        /// Purchase this pickup.
        /// </summary>
        /// <param name="carrier">The name of the carrier to purchase with.</param>
        /// <param name="service">The name of the service to purchase.</param>
        public void Buy(string carrier, string service) {
            Request request = new Request("pickups/{id}/buy", Method.POST);
            request.AddUrlSegment("id", id);
            request.AddBody(new List<Tuple<string, string>>() {
                new Tuple<string, string>("carrier", carrier),
                new Tuple<string, string>("service", service)
            });

            this.Merge(request.Execute<Pickup>());
        }
开发者ID:andyfengc,项目名称:Demo_.Net,代码行数:15,代码来源:Pickup.cs

示例4: Update

        /// <summary>
        /// Update the User associated with the api_key specified.
        /// </summary>
        /// <param name="parameters">
        /// Optional dictionary containing parameters to create the carrier account with. Valid pairs:
        ///   * {"name", string} Name on the account.
        ///   * {"email", string} Email on the account. Can only be updated on the parent account.
        ///   * {"phone_number", string} Phone number on the account. Can only be updated on the parent account.
        ///   * {"recharge_amount", int} Recharge amount for the account in cents. Can only be updated on the parent account.
        ///   * {"secondary_recharge_amount", int} Secondary recharge amount for the account in cents. Can only be updated on the parent account.
        ///   * {"recharge_threshold", int} Recharge threshold for the account in cents. Can only be updated on the parent account.
        /// All invalid keys will be ignored.
        /// </param>
        public void Update(IDictionary<string, object> parameters)
        {
            Request request = new Request("users/{id}", Method.PUT);
            request.AddUrlSegment("id", id);
            request.addBody(parameters, "user");

            this.Merge(request.Execute<User>());
        }
开发者ID:swrhim,项目名称:EasyPostPoC,代码行数:21,代码来源:User.cs

示例5: Retrieve

        /// <summary>
        /// Retrieve a Parcel from its id.
        /// </summary>
        /// <param name="id">String representing a Parcel. Starts with "prcl_".</param>
        /// <returns>EasyPost.Parcel instance.</returns>
        public static Parcel Retrieve(string id)
        {
            Request request = new Request("parcels/{id}");
            request.AddUrlSegment("id", id);

            return request.Execute<Parcel>();
        }
开发者ID:dmmatson,项目名称:easypost-csharp,代码行数:12,代码来源:Parcel.cs

示例6: Refund

        /// <summary>
        /// Send a refund request to the carrier the shipment was purchased from.
        /// </summary>
        public void Refund()
        {
            Request request = new Request("shipments/{id}/refund");
            request.AddUrlSegment("id", id);

            ResourceExtension.Merge(this, request.Execute<Shipment>());
        }
开发者ID:swrhim,项目名称:EasyPostPoC,代码行数:10,代码来源:Shipment.cs

示例7: Retrieve

        /// <summary>
        /// Retrieve a User from its id. If no id is specified, it returns the user for the api_key specified.
        /// </summary>
        /// <param name="id">String representing a user. Starts with "user_".</param>
        /// <returns>EasyPost.User instance.</returns>
        public static User Retrieve(string id = null)
        {
            Request request;

            if (id == null) {
                request = new Request("users");
            } else {
                request = new Request("users/{id}");
                request.AddUrlSegment("id", id);
            }

            return request.Execute<User>();
        }
开发者ID:swrhim,项目名称:EasyPostPoC,代码行数:18,代码来源:User.cs

示例8: Verify

        /// <summary>
        /// Verify an address.
        /// </summary>
        /// <returns>EasyPost.Address instance. Check message for verification failures.</returns>
        public void Verify(string carrier = null)
        {
            if (id == null)
                Create();

            Request request = new Request("addresses/{id}/verify");
            request.RootElement = "address";
            request.AddUrlSegment("id", id);

            if (carrier != null)
                request.AddParameter("carrier", carrier, ParameterType.QueryString);

            this.Merge(request.Execute<Address>());
        }
开发者ID:dmmatson,项目名称:easypost-csharp,代码行数:18,代码来源:Address.cs

示例9: Update

        /// <summary>
        /// Update this CarrierAccount.
        /// </summary>
        /// <param name="parameters">See CarrierAccount.Create for more details.</param>
        public void Update(IDictionary<string, object> parameters)
        {
            Request request = new Request("carrier_accounts/{id}", Method.PUT);
            request.AddUrlSegment("id", id);
            request.addBody(parameters, "carrier_account");

            this.Merge(request.Execute<CarrierAccount>());
        }
开发者ID:dmmatson,项目名称:easypost-csharp,代码行数:12,代码来源:CarrierAccount.cs

示例10: Cancel

        /// <summary>
        /// Cancel this pickup.
        /// </summary>
        public void Cancel() {
            Request request = new Request("pickups/{id}/cancel", Method.POST);
            request.AddUrlSegment("id", id);

            this.Merge(request.Execute<Pickup>());
        }
开发者ID:andyfengc,项目名称:Demo_.Net,代码行数:9,代码来源:Pickup.cs

示例11: Retrieve

        /// <summary>
        /// Retrieve a Pickup from its id.
        /// </summary>
        /// <param name="id">String representing a Pickup. Starts with "pickup_".</param>
        /// <returns>EasyPost.Pickup instance.</returns>
        public static Pickup Retrieve(string id) {
            Request request = new Request("pickups/{id}");
            request.AddUrlSegment("id", id);

            return request.Execute<Pickup>();
        }
开发者ID:andyfengc,项目名称:Demo_.Net,代码行数:11,代码来源:Pickup.cs

示例12: Buy

        /// <summary>
        /// Purchase a label for this shipment with the given rate.
        /// </summary>
        /// <param name="rateId">The id of the rate to purchase the shipment with.</param>
        public void Buy(string rateId)
        {
            Request request = new Request("shipments/{id}/buy", Method.POST);
            request.AddUrlSegment("id", id);
            request.addBody(new Dictionary<string, object>() { { "id", rateId } }, "rate");

            Shipment result = request.Execute<Shipment>();

            insurance = result.insurance;
            postage_label = result.postage_label;
            tracking_code = result.tracking_code;
            tracker = result.tracker;
            selected_rate = result.selected_rate;
            forms = result.forms;
            messages = result.messages;
            fees = result.fees;
        }
开发者ID:swrhim,项目名称:EasyPostPoC,代码行数:21,代码来源:Shipment.cs

示例13: GenerateBarcode

        /// <summary>
        /// Generate a barcode for this shipment.
        /// </summary>
        public void GenerateBarcode()
        {
            Request request = new Request("shipments/{id}/barcode");
            request.AddUrlSegment("id", id);

            Shipment result = request.Execute<Shipment>();
            barcode_url = result.barcode_url;
        }
开发者ID:swrhim,项目名称:EasyPostPoC,代码行数:11,代码来源:Shipment.cs

示例14: Retrieve

        /// <summary>
        /// Retrieve a Rate from its id.
        /// </summary>
        /// <param name="id">String representing a Rate. Starts with "rate_".</param>
        /// <returns>EasyPost.Rate instance.</returns>
        public static Rate Retrieve(string id) {
            Request request = new Request("rates/{id}");
            request.AddUrlSegment("id", id);

            return request.Execute<Rate>();
        }
开发者ID:dmmatson,项目名称:easypost-csharp,代码行数:11,代码来源:Rate.cs

示例15: Retrieve

        /// <summary>
        /// Retrieve an Address from its id.
        /// </summary>
        /// <param name="id">String representing an Address. Starts with "adr_".</param>
        /// <returns>EasyPost.Address instance.</returns>
        public static Address Retrieve(string id)
        {
            Request request = new Request("addresses/{id}");
            request.AddUrlSegment("id", id);

            return request.Execute<Address>();
        }
开发者ID:dmmatson,项目名称:easypost-csharp,代码行数:12,代码来源:Address.cs


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