Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added update_shipment_tracking_details and list_shipment_boxes #1615

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

abrihter
Copy link
Contributor

@abrihter abrihter commented Dec 9, 2024

Added two new endpoints (FulfillmentInbound)

updateShipmentTrackingDetails

listShipmentBoxes

Summary by Sourcery

Add two new endpoints to the FulfillmentInbound API: 'list_shipment_boxes' for retrieving shipment box details and 'update_shipment_tracking_details' for updating shipment tracking information.

New Features:

  • Introduce a new endpoint 'list_shipment_boxes' to provide a paginated list of box packages in a shipment, allowing users to retrieve shipment box details with optional pagination parameters.
  • Add a new endpoint 'update_shipment_tracking_details' to update a shipment's tracking details, enabling users to modify tracking information for shipments.

Copy link

sourcery-ai bot commented Dec 9, 2024

Reviewer's Guide by Sourcery

This PR adds two new endpoints to the FulfillmentInbound API class: list_shipment_boxes for retrieving box package information and update_shipment_tracking_details for updating shipment tracking information. Both endpoints are implemented as decorated methods using the sp_endpoint decorator with appropriate HTTP methods and URL patterns.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added new endpoint for listing shipment boxes
  • Implemented GET endpoint with pagination support
  • Added optional parameters for pageSize and paginationToken
  • Included rate limiting documentation (2 requests/sec with 30 burst)
sp_api/api/fulfillment_inbound/fulfillment_inbound.py
Added new endpoint for updating shipment tracking details
  • Implemented PUT endpoint for tracking updates
  • Added support for both LTL and SPD tracking detail formats
  • Included rate limiting documentation (2 requests/sec with 2 burst)
sp_api/api/fulfillment_inbound/fulfillment_inbound.py

Possibly linked issues

  • Create LICENSE #1: The PR implements the listShipmentBoxes endpoint as requested in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@saleweaver saleweaver merged commit 3d6bc14 into saleweaver:master Dec 9, 2024
3 checks passed
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abrihter - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The docstring for list_shipment_boxes has incorrect parameter descriptions - pageSize description is currently copying the shipment description. Please update with correct parameter descriptions.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +1598 to +1600
@sp_endpoint('/inbound/fba/<version>/inboundPlans/{}/shipments/{}/trackingDetails', method='PUT')
def update_shipment_tracking_details(self, inboundPlanId, shipmentId, **kwargs) -> ApiResponse:
"""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider adding validation for the required 'body' parameter

The method should validate that the body parameter is present and contains the required structure before making the request to prevent silent failures.

Suggested change
@sp_endpoint('/inbound/fba/<version>/inboundPlans/{}/shipments/{}/trackingDetails', method='PUT')
def update_shipment_tracking_details(self, inboundPlanId, shipmentId, **kwargs) -> ApiResponse:
"""
@sp_endpoint('/inbound/fba/<version>/inboundPlans/{}/shipments/{}/trackingDetails', method='PUT')
def update_shipment_tracking_details(self, inboundPlanId, shipmentId, **kwargs) -> ApiResponse:
"""Updates the tracking details for a shipment.
Args:
inboundPlanId (str): The identifier for the inbound plan.
shipmentId (str): The identifier for the shipment.
**kwargs: Additional arguments
body (dict): Required. The request body containing tracking details.
Must contain:
- trackingDetails (list): List of tracking information
Returns:
ApiResponse
Raises:
ValueError: If the required body parameter or its required structure is missing
"""
if 'body' not in kwargs:
raise ValueError("The 'body' parameter is required for updating tracking details")
if not isinstance(kwargs['body'].get('trackingDetails'), list):
raise ValueError("The 'body' must contain 'trackingDetails' as a list")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants