예제 #1
0
        /// <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();
        }
예제 #2
0
        /// <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>());
        }
예제 #3
0
        /// <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>());
        }
예제 #4
0
        /// <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>());
        }
예제 #5
0
        /// <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>());
        }
예제 #6
0
        /// <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>());
        }
예제 #7
0
        /// <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>());
        }
예제 #8
0
        /// <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>());
        }
예제 #9
0
        /// <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>());
        }
예제 #10
0
        /// <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>());
        }
예제 #11
0
        /// <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);
        }
예제 #12
0
        /// <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>();
        }
예제 #13
0
        /// <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>());
        }
예제 #14
0
#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));
        }
예제 #15
0
        // 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>());
        }
예제 #16
0
        /// <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>());
        }
예제 #17
0
        /// <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>());
        }
예제 #18
0
        /// <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>());
        }
예제 #19
0
        /// <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>());
        }
예제 #20
0
        private static Shipment sendCreate(Dictionary <string, object> parameters)
        {
            Request request = new Request("v2/shipments", Method.POST);

            request.AddBody(parameters, "shipment");

            return(request.Execute <Shipment>());
        }
예제 #21
0
        /// <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>());
        }
예제 #22
0
        /// <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>());
        }
예제 #23
0
        /// <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>());
        }
예제 #24
0
        /// <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>());
        }
예제 #25
0
        /// <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>());
        }
예제 #26
0
        /// <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>());
        }
예제 #27
0
        /// <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>());
        }
예제 #28
0
        /// <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>());
        }
예제 #29
0
#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));
        }
예제 #30
0
        /// <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>());
        }