/// <summary> /// Resend the last Event for a specific EasyPost object. /// </summary> /// <param name="id">String representing an EasyPost object.</param> public static void Create(string id) { Request request = new Request("events", Method.POST); request.AddQueryString(new Dictionary <string, object>() { { "result_id", id } }); }
/// <summary> /// List all Insurance objects. /// </summary> /// <param name="parameters"> /// Optional dictionary containing parameters to filter the list with. Valid pairs: /// * {"before_id", string} String representing an Insurance ID. Starts with "ins_". Only retrieve insurances created /// before this id. Takes precedence over after_id. /// * {"after_id", string} String representing an Insurance ID. Starts with "ins_". Only retrieve insurances created after /// this id. /// * {"start_datetime", string} ISO 8601 datetime string. Only retrieve insurances created after this datetime. /// * {"end_datetime", string} ISO 8601 datetime string. Only retrieve insurances created before this datetime. /// * {"page_size", int} Max size of list. Default to 20. /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.InsuranceCollection instance.</returns> public static InsuranceCollection All(Dictionary <string, object> parameters = null) { parameters = parameters ?? new Dictionary <string, object>(); Request request = new Request("insurances"); request.AddQueryString(parameters); return(request.Execute <InsuranceCollection>()); }
/// <summary> /// Create a Report. /// </summary> /// <param name="type"> /// The type of report, e.g. "shipment", "tracker", "payment_log", etc. /// </param> /// <param name="parameters"> /// Optional dictionary containing parameters to create the carrier account with. Valid pairs: /// * {"start_date", string} Date to start the report at. /// * {"end_date", string} Date to end the report at. /// * {"include_children", string} Whether or not to include child objects in the report. /// All invalid keys will be ignored. /// </param> /// <returns>EasyPost.Report instance.</returns> public static Report Create(string type, Dictionary <string, object> parameters = null) { Request request = new Request("v2/reports/{type}", Method.POST); request.AddUrlSegment("type", type); request.AddQueryString(parameters ?? new Dictionary <string, object>()); return(request.Execute <Report>()); }
/// <summary> /// Get a paginated list of scan forms. /// </summary> /// Optional dictionary containing parameters to filter the list with. Valid pairs: /// * {"before_id", string} String representing a ScanForm ID. Starts with "sf_". Only retrieve ScanForms created before this id. Takes precedence over after_id. /// * {"after_id", string} String representing a ScanForm ID. Starts with "sf_". Only retrieve ScanForms created after this id. /// * {"start_datetime", string} ISO 8601 datetime string. Only retrieve ScanForms created after this datetime. /// * {"end_datetime", string} ISO 8601 datetime string. Only retrieve ScanForms created before this datetime. /// * {"page_size", int} Max size of list. Default to 20. /// All invalid keys will be ignored. /// <param name="parameters"> /// </param> /// <returns>Instance of EasyPost.ScanForm</returns> public static ScanFormList List(Dictionary <string, object> parameters = null) { Request request = new Request("scan_forms"); request.AddQueryString(parameters ?? new Dictionary <string, object>()); ScanFormList scanFormList = request.Execute <ScanFormList>(); scanFormList.filters = parameters; return(scanFormList); }
/// <summary> /// Get a paginated list of shipments. /// </summary> /// Optional dictionary containing parameters to filter the list with. Valid pairs: /// * {"before_id", string} String representing a Shipment. Starts with "shp_". Only retrieve shipments created before this id. Takes precedence over after_id. /// * {"after_id", string} String representing a Shipment. Starts with "shp_". Only retrieve shipments created after this id. /// * {"start_datetime", DateTime} Starting time for the search. /// * {"end_datetime", DateTime} Ending time for the search. /// * {"page_size", int} Size of page. Default to 20. /// * {"purchased", bool} If true only display purchased shipments. /// All invalid keys will be ignored. /// <param name="parameters"> /// </param> /// <returns>Instance of EasyPost.ShipmentList</returns> public static ShipmentList List(Dictionary <string, object> parameters = null) { Request request = new Request("shipments"); request.AddQueryString(parameters ?? new Dictionary <string, object>()); ShipmentList shipmentList = request.Execute <ShipmentList>(); shipmentList.filters = parameters; return(shipmentList); }
#pragma warning restore IDE1006 // Naming Styles /// <summary> /// Get a paginated list of trackers. /// </summary> /// Optional dictionary containing parameters to filter the list with. Valid pairs: /// * {"tracking_code", string} Tracking number string. Only retrieve trackers with the given tracking code. /// * {"carrier", string} String representing the tracker's carrier. Only retrieve trackers with the given carrier. /// * {"before_id", string} String representing a Tracker. Starts with "trk_". Only retrieve trackers created before this id. Takes precedence over after_id. /// * {"after_id", string} String representing a Tracker. Starts with "trk_". Only retrieve trackers created after this id. /// * {"start_datetime", datetime} Datetime representing the earliest possible tracker. Only retrieve trackers created at or after this datetime. Defaults to 1 month ago. /// * {"end_datetime", datetime} Datetime representing the latest possible tracker. Only retrieve trackers created before this datetime. Defaults to the end of the current day. /// * {"page_size", int} Size of page. Default to 30. /// All invalid keys will be ignored. /// <param name="parameters"> /// </param> /// <returns>Instance of EasyPost.ShipmentList</returns> public static TrackerList List(Client client, Dictionary <string, object> parameters = null) { Request request = new Request("v2/trackers"); request.AddQueryString(parameters ?? new Dictionary <string, object>()); TrackerList trackerList = request.Execute <TrackerList>(client); trackerList.filters = parameters; return(trackerList); }
public static BatchList List(Dictionary <string, object> parameters = null) { Request request = new Request("v2/batches"); request.AddQueryString(parameters ?? new Dictionary <string, object>()); BatchList batchList = request.Execute <BatchList>(); batchList.filters = parameters; return(batchList); }
/// <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("v2/pickups/{id}/buy", Method.POST); request.AddUrlSegment("id", id); request.AddQueryString(new Dictionary <string, object>() { { "carrier", carrier }, { "service", service } }); Merge(request.Execute <Pickup>()); }
/// <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("v2/shipments/{id}/insure", Method.POST); request.AddUrlSegment("id", id); request.AddQueryString(new Dictionary <string, object>() { { "amount", amount } }); Merge(request.Execute <Shipment>()); }
/// <summary> /// Get a paginated list of reports. /// </summary> /// <param name="parameters"> /// Optional dictionary containing parameters to filter the list with. Valid pairs: /// * {"before_id", string} String representing a Report ID. Only retrieve ScanForms created before this id. Takes precedence over after_id. /// * {"after_id", string} String representing a Report ID. Only retrieve ScanForms created after this id. /// * {"start_datetime", string} ISO 8601 datetime string. Only retrieve ScanForms created after this datetime. /// * {"end_datetime", string} ISO 8601 datetime string. Only retrieve ScanForms created before this datetime. /// * {"page_size", int} Max size of list. Default to 20. /// All invalid keys will be ignored. /// </param> /// <param name="type"> /// The type of report, e.g. "shipment", "tracker", "payment_log", etc. /// </param> /// <returns>Instance of EasyPost.ScanForm</returns> public static ReportList List(string type, Dictionary <string, object> parameters = null) { Request request = new Request("v2/reports/{type}"); request.AddUrlSegment("type", type); request.AddQueryString(parameters ?? new Dictionary <string, object>()); ReportList reportList = request.Execute <ReportList>(); reportList.filters = parameters; reportList.type = type; return(reportList); }
/// <summary> /// Refresh this Insurance. /// </summary> /// <param name="parameters">Optional dictionary of parameters to use when refreshing this insurance.</param> /// <returns>This refreshed EasyPost.Insurance object.</returns> public Insurance Refresh(Dictionary <string, object> parameters = null) { parameters = parameters ?? new Dictionary <string, object>(); Request request = new Request("insurances/{id}"); request.AddUrlSegment("id", id); request.AddQueryString(parameters); Insurance refreshedInsurance = request.Execute <Insurance>(); Merge(refreshedInsurance); return(this); }
/// <summary> /// Asynchronously generate a label containing all of the Shipment labels belonging to this batch. /// </summary> /// <param name="fileFormat">Format to generate the label in. Valid formats: "pdf", "zpl" and "epl2".</param> public void GenerateLabel(string fileFormat) { Request request = new Request("batches/{id}/label", Method.POST); request.AddUrlSegment("id", id); Dictionary <string, object> parameters = new Dictionary <string, object> { { "file_format", fileFormat } }; request.AddQueryString(parameters); Merge(request.Execute <Batch>()); }
/// <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.AddQueryString(new Dictionary <string, object> { { "carrier", carrier }, { "service", service } }); Merge(request.Execute <Order>()); }
/// <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("v2/batches/{id}/label", Method.POST); request.AddUrlSegment("id", id); Dictionary <string, object> parameters = new Dictionary <string, object>() { { "file_format", fileFormat } }; if (orderBy != null) { parameters["order_by"] = orderBy; } request.AddQueryString(parameters); Merge(request.Execute <Batch>()); }