You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support to query occurrences through the Mandae V1 API, enabling the retrieval of a list of occurrences related to a specific tracking number or OS (service order). This feature is crucial for tracking the shipment status and understanding any issues or delays.
Feature Objective
Implement a method to query the Mandae V1 API for occurrences related to a given tracking number or service order (OS).
The method should return a list of occurrences associated with the specified tracking number or OS, providing detailed information about each occurrence.
Tasks:
API Integration:
Use the Mandae V1 API endpoint to fetch occurrences based on a tracking number or OS.
Handle API request and response, including error handling for scenarios such as invalid tracking numbers, no occurrences found, and server errors.
Query Parameters:
Accept either a tracking number or service order (OS) as input.
Validate the input format to ensure correctness before querying the API.
Response Handling:
Parse the API response to extract and return relevant occurrence data such as status, timestamps, location, and description of each occurrence.
Ensure the response is formatted in a way that can be easily consumed by other services or UI components.
Error Handling:
Implement proper error handling to manage cases where the API request fails (e.g., network issues, invalid inputs, unauthorized requests).
Return meaningful error messages to the caller in the event of failure.
Example API Call:
publicasyncTask<List<Occurrence>>GetOccurrencesAsync(stringtrackingNumber){varapiUrl=$"https://api.mandae.com/v1/occurrences/{trackingNumber}";varresponse=await _httpClient.GetAsync(apiUrl);if(!response.IsSuccessStatusCode){// Handle error responsethrownew HttpRequestException("Failed to fetch occurrences");}varoccurrences=await response.Content.ReadAsAsync<List<Occurrence>>();returnoccurrences;}
Expected Outcome:
Success: A list of occurrences is returned, containing details such as status updates, locations, and timestamps related to the specified tracking number or OS.
Failure: Clear error messages indicating the cause of failure (e.g., invalid tracking number, no occurrences found, server issues).
Tech Notes:
Ensure the method is asynchronous to handle large responses efficiently.
API credentials and authentication should be handled securely.
Unit tests and integration tests should be written to cover both successful and error scenarios.
@guibranco Pull request completed! Check it out here #192 🚀
Note: I automatically create a pull request for an unassigned and open issue in order from oldest to newest once a day at 00:00 UTC, as long as you have remaining automation usage. Should you have any questions or wish to change settings or limits, please feel free to contact info@gitauto.ai or invite us to Slack Connect.
Description
Add support to query occurrences through the Mandae V1 API, enabling the retrieval of a list of occurrences related to a specific tracking number or OS (service order). This feature is crucial for tracking the shipment status and understanding any issues or delays.
Feature Objective
Tasks:
API Integration:
Query Parameters:
Response Handling:
Error Handling:
Example API Call:
Expected Outcome:
Tech Notes:
Resources:
The text was updated successfully, but these errors were encountered: