/// <summary> /// Remove this CarrierAccount from your account. /// </summary> public void Destroy() { Request request = new Request("carrier_accounts/{id}", Method.DELETE); request.AddUrlSegment("id", id); request.Execute(); }
/// <summary> /// Retrieve the current user. /// </summary> /// <returns>EasyPost.User instance.</returns> public static User RetrieveMe() { Request request; request = new Request("users"); return(request.Execute <User>()); }
/// <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("v2/pickups/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Pickup>()); }
/// <summary> /// Retrieve a Order from its id or reference. /// </summary> /// <param name="id">String representing a Order. Starts with "order_" if passing an id.</param> /// <returns>EasyPost.Order instance.</returns> public static Order Retrieve(string id) { Request request = new Request("orders/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Order>()); }
/// <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(Dictionary <string, object> parameters) { Request request = new Request("customs_infos", Method.POST); request.AddBody(parameters, "customs_info"); return(request.Execute <CustomsInfo>()); }
/// <summary> /// Purchase all shipments within a batch. The Batch's state must be "created" before purchasing. /// </summary> public void Buy() { Request request = new Request("batches/{id}/buy", Method.POST); request.AddUrlSegment("id", id); this.Merge(request.Execute <Batch>()); }
/// <summary> /// Retrieve a Batch from its id. /// </summary> /// <param name="id">String representing a Batch. Starts with "batch_".</param> /// <returns>EasyPost.Batch instance.</returns> public static Batch Retrieve(string id) { Request request = new Request("batches/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Batch>()); }
/// <summary> /// Retrieve a Webhook from its id. /// </summary> /// <param name="id">String representing a webhook. Starts with "hook_".</param> /// <returns>EasyPost.User instance.</returns> public static Webhook Retrieve(string id) { Request request = new Request("v2/webhooks/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Webhook>()); }
/// <summary> /// Create a Webhook. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the carrier account with. Valid pairs: /// * { "url", string } Url of the webhook that events will be sent to. /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Webhook instance.</returns> public static Webhook Create(Dictionary <string, object> parameters) { Request request = new Request("v2/webhooks", Method.POST); request.AddBody(parameters, "webhook"); return(request.Execute <Webhook>()); }
/// <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>()); }
/// <summary> /// Get a list of scan forms. /// </summary> /// <returns>List of EasyPost.Webhook insteances.</returns> public static List <Webhook> List(Dictionary <string, object> parameters = null) { Request request = new Request("v2/webhooks"); WebhookList webhookList = request.Execute <WebhookList>(); return(webhookList.webhooks); }
/// <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(Dictionary<string, object> parameters = null) { parameters = parameters ?? new Dictionary<string, object>(); Request request = new Request("batches", Method.POST); request.AddBody(parameters, "batch"); return request.Execute<Batch>(); }
/// <summary> /// Retrieve a ScanForm from its id. /// </summary> /// <param name="id">String representing a scan form, starts with "sf_".</param> /// <returns>EasyPost.ScanForm instance.</returns> public static ScanForm Retrieve(string id) { Request request = new Request("v2/scan_forms/{id}"); request.AddUrlSegment("id", id); return(request.Execute <ScanForm>()); }
#pragma warning restore IDE1006 // Naming Styles /// <summary> /// Retrieve a Order from its id or reference. /// </summary> /// <param name="id">String representing a Order. Starts with "order_" if passing an id.</param> /// <returns>EasyPost.Order instance.</returns> public static Order Retrieve(Client client, string id) { Request request = new Request("v2/orders/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Order>(client)); }
// ADD CUSTOM REFERENCES (e.g. sku, upc) /// <summary> /// Retrieve an Item from its id or reference. /// </summary> /// <param name="id">String representing a Item. Starts with "item_" if passing an id.</param> /// <returns>EasyPost.Item instance.</returns> public static Item Retrieve(string id) { Request request = new Request("v2/items/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Item>()); }
/// <summary> /// Enable a Webhook that has been disabled previously. /// </summary> public void Update() { Request request = new Request("v2/webhooks/{id}", Method.PUT); request.AddUrlSegment("id", id); Merge(request.Execute <Webhook>()); }
/// <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(Dictionary <string, object> parameters) { Request request = new Request("v2/items", Method.POST); request.AddBody(parameters, "item"); return(request.Execute <Item>()); }
/// <summary> /// Retrieve a Shipment from its id. /// </summary> /// <param name="id">String representing a Shipment. Starts with "shp_".</param> /// <returns>EasyPost.Shipment instance.</returns> public static Shipment Retrieve(string id) { Request request = new Request("v2/shipments/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Shipment>()); }
/// <summary> /// Asychronously generate a scan from for the batch. /// </summary> public void GenerateScanForm() { Request request = new Request("batches/{id}/scan_form", Method.POST); request.AddUrlSegment("id", id); this.Merge(request.Execute <Batch>()); }
private static Shipment sendCreate(Dictionary <string, object> parameters) { Request request = new Request("v2/shipments", Method.POST); request.AddBody(parameters, "shipment"); return(request.Execute <Shipment>()); }
/// <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(Dictionary <string, object> parameters) { Request request = new Request("containers", Method.POST); request.AddBody(parameters, "container"); return(request.Execute <Container>()); }
/// <summary> /// Send a refund request to the carrier the shipment was purchased from. /// </summary> public void Refund() { Request request = new Request("v2/shipments/{id}/refund"); request.AddUrlSegment("id", id); Merge(request.Execute <Shipment>()); }
/// <summary> /// Create a Order. /// </summary> /// <param name="parameters"> /// Dictionary containing parameters to create the order with. Valid pairs: /// * {"from_address", Dictionary<string, object>} See Address.Create for a list of valid keys. /// * {"to_address", Dictionary<string, object>} See Address.Create for a list of valid keys. /// * {"buyer_address", Dictionary<string, object>} See Address.Create for a list of valid keys. /// * {"return_address", Dictionary<string, object>} See Address.Create for a list of valid keys. /// * {"customs_info", Dictionary<string, object>} See CustomsInfo.Create for list of valid keys. /// * {"options", Dictionary<string, object>} See https://www.easypost.com/docs/api#shipments for list of options. /// * {"is_return", bool} /// * {"reference", string} /// * {"shipments", IEnumerable<Shipment>} See Shipment.Create for list of valid keys. /// * {"containers", IEnumerable<Container>} See Container.Create for list of valid keys. /// * {"items", IEnumerable<Item>} See Item.Create for list of valid keys. /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Order instance.</returns> public static Order Create(IDictionary <string, object> parameters) { Request request = new Request("orders", Method.POST); request.addBody(parameters, "order"); return(request.Execute <Order>()); }
/// <summary> /// Retrieve a CustomsItem from its id. /// </summary> /// <param name="id">String representing a CustomsItem. Starts with "cstitem_".</param> /// <returns>EasyPost.CustomsItem instance.</returns> public static CustomsItem Retrieve(string id) { Request request = new Request("customs_items/{id}"); request.AddUrlSegment("id", id); return(request.Execute <CustomsItem>()); }
/// <summary> /// Retrieve a CustomsInfo from its id. /// </summary> /// <param name="id">String representing a CustomsInfo. Starts with "cstinfo_".</param> /// <returns>EasyPost.CustomsInfo instance.</returns> public static CustomsInfo Retrieve(string id) { Request request = new Request("v2/customs_infos/{id}"); request.AddUrlSegment("id", id); return(request.Execute <CustomsInfo>()); }
/// <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>()); }
/// <summary> /// Cancel this pickup. /// </summary> public void Cancel() { Request request = new Request("v2/pickups/{id}/cancel", Method.POST); request.AddUrlSegment("id", id); Merge(request.Execute <Pickup>()); }
/// <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(request.Execute <Parcel>()); }
#pragma warning restore IDE1006 // Naming Styles /// <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(Client client, string id) { Request request = new Request("v2/addresses/{id}"); request.AddUrlSegment("id", id); return(request.Execute <Address>(client)); }
/// <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>()); }