private static Pickup sendCreate(IDictionary <string, object> parameters) { Request request = new Request("pickups", Method.POST); request.addBody(parameters, "pickup"); return(client.Execute <Pickup>(request)); }
/// <summary> /// Create a child user for the account 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. /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.User instance.</returns> public static User Create(Dictionary <string, object> parameters) { Request request = new Request("users", Method.POST); request.addBody(parameters, "user"); return(request.Execute <User>()); }
private static Shipment sendCreate(IDictionary <string, object> parameters) { Request request = new Request("shipments", Method.POST); request.addBody(parameters, "shipment"); return(client.Execute <Shipment>(request)); }
/// <summary> /// Create a CustomsInfo. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the customs info with. Valid pairs: /// * {"customs_certify", bool} /// * {"customs_signer", string} /// * {"contents_type", string} /// * {"contents_explanation", string} /// * {"restriction_type", string} /// * {"eel_pfc", string} /// * {"custom_items", Dictionary<string, object>} -- Can contain the key "id" or all keys required to create a CustomsItem. /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.CustomsInfo instance.</returns> public static CustomsInfo Create(IDictionary <string, object> parameters) { Request request = new Request("customs_infos", Method.POST); request.addBody(parameters, "customs_info"); return(client.Execute <CustomsInfo>(request)); }
private static Address sendCreateAndVerify(IDictionary <string, object> parameters) { Request request = new Request("addresses/create_and_verify", Method.POST); request.addBody(parameters, "address"); return(client.Execute <Address>(request)); }
/// <summary> /// Create a Container. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the container with. Valid pairs: /// * {"name", string} /// * {"type", string} /// * {"reference", string} /// * {"length", double} /// * {"width", double} /// * {"height", double} /// * {"max_weight", double} /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Container instance.</returns> public static Container Create(IDictionary <string, object> parameters) { Request request = new Request("containers", Method.POST); request.addBody(parameters, "container"); return(client.Execute <Container>(request)); }
/// <summary> /// Create a CarrierAccount. /// </summary> /// <param name="parameters"> /// Optional dictionary containing parameters to create the carrier account with. Valid pairs: /// * {"type", string} Required (e.g. EndiciaAccount, UPSAccount, etc.). /// * {"reference", string} External reference for carrier account. /// * {"description", string} Description of carrier account. /// * {"credentials", Dictionary<string, string>} /// * {"test_credentials", Dictionary<string, string>} /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.CarrierAccount instance.</returns> public static CarrierAccount Create(IDictionary <string, object> parameters) { Request request = new Request("carrier_accounts", Method.POST); request.addBody(parameters, "carrier_account"); return(request.Execute <CarrierAccount>()); }
/// <summary> /// Create a CustomsItem. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the customs item with. Valid pairs: /// * {"description", string} /// * {"quantity", int} /// * {"weight", int} /// * {"value", double} /// * {"hs_tariff_number", string} /// * {"origin_country", string} /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.CustomsItem instance.</returns> public static CustomsItem Create(IDictionary <string, object> parameters) { Request request = new Request("customs_items", Method.POST); request.addBody(parameters, "customs_item"); return(request.Execute <CustomsItem>()); }
/// <summary> /// Create a Parcel. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the parcel with. Valid pairs: /// * {"length", int} /// * {"width", int} /// * {"height", int} /// * {"weight", double} /// * {"predefined_package", string} /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Parcel instance.</returns> public static Parcel Create(IDictionary <string, object> parameters) { Request request = new Request("parcels", Method.POST); request.addBody(parameters, "parcel"); return(client.Execute <Parcel>(request)); }
private static Address sendCreate(IDictionary <string, object> parameters) { Request request = new Request("addresses", Method.POST); request.addBody(parameters, "address"); return(request.Execute <Address>()); }
private static Order sendCreate(IDictionary <string, object> parameters) { Request request = new Request("orders", Method.POST); request.addBody(parameters, "order"); return(request.Execute <Order>()); }
/// <summary> /// Create an Item. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the item with. Valid pairs: /// * {"name", string} /// * {"description", string} /// * {"reference", string} /// * {"harmonized_code", string} /// * {"country_of_origin", string} /// * {"warehouse_location", string} /// * {"value", double} /// * {"length", double} /// * {"width", double} /// * {"height", double} /// * {"weight", double} /// ADD ANY CUSTOM REFERENCES HERE /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Item instance.</returns> public static Item Create(IDictionary <string, object> parameters) { Request request = new Request("items", Method.POST); request.addBody(parameters, "item"); return(client.Execute <Item>(request)); }
/// <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>()); }
/// <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>()); }
/// <summary> /// Insure shipment for the given amount. /// </summary> /// <param name="amount">The amount to insure the shipment for. Currency is provided when creating a shipment.</param> public void Insure(double amount) { Request request = new Request("shipments/{id}/insure", Method.POST); request.AddUrlSegment("id", id); request.addBody(new List<Tuple<string, string>>() { new Tuple<string, string>("amount", amount.ToString()) }); this.Merge(request.Execute<Shipment>()); }
/// <summary> /// Create a Batch. /// </summary> /// <param name="parameters"> /// Optional dictionary containing parameters to create the batch with. Valid pairs: /// * {"shipments", List<Dictionary<string, object>>} See Shipment.Create for a list of valid keys. /// * {"reference", string} /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Batch instance.</returns> public static Batch Create(IDictionary <string, object> parameters = null) { parameters = parameters ?? new Dictionary <string, object>(); Request request = new Request("batches", Method.POST); request.addBody(parameters, "batch"); return(client.Execute <Batch>(request)); }
/// <summary> /// Create and verify an Address. /// </summary> /// <param name="parameters"> /// Optional dictionary containing parameters to create the address with. Valid pairs: /// * {"name", string} /// * {"company", string} /// * {"stree1", string} /// * {"street2", string} /// * {"city", string} /// * {"state", string} /// * {"zip", string} /// * {"country", string} /// * {"phone", string} /// * {"email", string} /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Address instance.</returns> public static Address CreateAndVerify(IDictionary <string, object> parameters = null) { parameters = parameters ?? new Dictionary <string, object>(); Request request = new Request("addresses/create_and_verify", Method.POST); request.RootElement = "address"; request.addBody(parameters, "address"); return(request.Execute <Address>()); }
public static Tracker Create(string carrier, string trackingCode) { Request request = new Request("trackers", RestSharp.Method.POST); Dictionary <string, object> parameters = new Dictionary <string, object>() { { "tracking_code", trackingCode }, { "carrier", carrier } }; request.addBody(parameters, "tracker"); return(client.Execute <Tracker>(request)); }
/// <summary> /// Purchase the shipments within this order with a carrier and service. /// </summary> /// <param name="carrier">The carrier to purchase a shipment from.</param> /// <param name="service">The service to purchase.</param> public void Buy(string carrier, string service) { Request request = new Request("orders/{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 <Order>()); }
/// <summary> /// Add shipments to the batch. /// </summary> /// <param name="shipmentIds">List of shipment ids to be added.</param> public void AddShipments(IEnumerable <string> shipmentIds) { Request request = new Request("batches/{id}/add_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(client.Execute <Batch>(request)); }
/// <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; }
/// <summary> /// Asynchronously generate a label containing all of the Shimpent labels belonging to the batch. /// </summary> /// <param name="fileFormat">Format to generate the label in. Valid formats: "pdf", "zpl" and "epl2".</param> /// <param name="orderBy">Optional parameter to order the generated label. Ex: "reference DESC"</param> public void GenerateLabel(string fileFormat, string orderBy = null) { Request request = new Request("batches/{id}/label", Method.POST); request.AddUrlSegment("id", id); List <Tuple <string, string> > body = new List <Tuple <string, string> >() { new Tuple <string, string>("file_format", fileFormat) }; if (orderBy != null) { body.Add(new Tuple <string, string>("order_by", orderBy)); } request.addBody(body); this.Merge(client.Execute <Batch>(request)); }