-
Notifications
You must be signed in to change notification settings - Fork 57
TSM-11: convert Group A models to TypeScript #568
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
Open
Justin Hammond (Justintime50)
wants to merge
13
commits into
ts-migrate/10-services-group-e
from
ts-migrate/11-models-group-a
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7024196
TSM-07: convert Group B services to TypeScript
Justintime50 9da9644
TSM-07: add permissive create parameter types for Group B services
Justintime50 d9b5fa8
TSM-08: convert Group C services to TypeScript
Justintime50 1f1687b
TSM-08: add permissive create parameter types for Group C services
Justintime50 10092a0
chore: retrigger flaky CodeQL on TSM-08
Justintime50 db0525e
TSM-09: convert Group D services to TypeScript
Justintime50 a0d5000
TSM-09: add permissive create parameter types for Group D services
Justintime50 2b94467
TSM-10: convert Group E services to TypeScript
Justintime50 9622437
TSM-10: add permissive create parameter types for Group E services
Justintime50 76bc2e3
TSM-11 convert models group A to TypeScript
Justintime50 5aaffe0
TSM-11 migrate model field types from declarations
Justintime50 7903531
TSM-11 make model fields nullable for first pass
Justintime50 05ce465
TSM-11 make model fields optional and nullable for first pass
Justintime50 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import EasyPostObject from './easypost_object'; | ||
|
|
||
| /** | ||
| * An {@link https://docs.easypost.com/docs/addresses Address} represents people, places, and organizations in a number of contexts. | ||
| * @public | ||
| * @extends EasyPostObject | ||
| */ | ||
| export default class Address extends EasyPostObject { | ||
| declare street1?: string | null; | ||
| declare street2?: string | null; | ||
| declare city?: string | null; | ||
| declare state?: string | null; | ||
| declare zip?: string | null; | ||
| declare country?: string | null; | ||
| declare residential?: boolean | null; | ||
| declare carrier_facility?: string | null; | ||
| declare name?: string | null; | ||
| declare company?: string | null; | ||
| declare phone?: string | null; | ||
| declare email?: string | null; | ||
| declare federal_tax_id?: string | null; | ||
| declare state_tax_id?: string | null; | ||
| declare verifications?: Record<string, unknown> | null; | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import EasyPostObject from './easypost_object'; | ||
|
|
||
| /** | ||
| * A {@link https://docs.easypost.com/docs/customs-infos CustomsInfo} represents a collection of {@link CustomsItem CustomsItems} and associated information for generating international shipping customs forms. | ||
| * @public | ||
| * @extends EasyPostObject | ||
| */ | ||
| export default class CustomsInfo extends EasyPostObject { | ||
| declare content_explanation?: string | null; | ||
| declare contents_type?: string | null; | ||
| declare customs_certify?: boolean | null; | ||
| declare customs_items?: unknown[] | null; | ||
| declare customs_signer?: string | null; | ||
| declare declaration?: string | null; | ||
| declare eel_pfc?: string | null; | ||
| declare non_delivery_option?: 'abandon' | 'return' | null; | ||
| declare restriction_comments?: string | null; | ||
| declare restriction_type?: | ||
| 'none' | 'other' | 'quarantine' | 'sanitary_phytosanitary_inspection' | null; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import EasyPostObject from './easypost_object'; | ||
|
|
||
| /** | ||
| * A {@link https://docs.easypost.com/docs/customs-items CustomsItem} represents a single item being shipped internationally. | ||
| * @public | ||
| * @extends EasyPostObject | ||
| */ | ||
| export default class CustomsItem extends EasyPostObject { | ||
| declare code?: string | null; | ||
| declare currency?: string | null; | ||
| declare description?: string | null; | ||
| declare hs_tariff_number?: string | null; | ||
| declare origin_country?: string | null; | ||
| declare quantity?: number | null; | ||
| declare value?: number | null; | ||
| declare weight?: number | null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import EasyPostObject from './easypost_object'; | ||
|
|
||
| /** | ||
| * A {@link PostageLabel} represents a physical label to affix to a {@link Parcel parcel} when shipping. | ||
| * @public | ||
| * @extends EasyPostObject | ||
| */ | ||
| export default class PostageLabel extends EasyPostObject { | ||
| declare label_date?: string | null; | ||
| declare label_epl2_url?: string | null; | ||
| declare label_file_type?: string | null; | ||
| declare label_pdf_url?: string | null; | ||
| declare label_resolution?: number | null; | ||
| declare label_size?: string | null; | ||
| declare label_type?: string | null; | ||
| declare label_url?: string | null; | ||
| declare label_zpl_url?: string | null; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import Constants from '../constants'; | ||
| import EasyPostObject from './easypost_object'; | ||
|
|
||
| /** | ||
| * A {@link https://docs.easypost.com/docs/shipments Shipment} represents a physical {@link Parcel}, the origin and destination {@link Address Addresses}, and any associated {@link CustomsInfo}. | ||
| * @public | ||
| * @extends EasyPostObject | ||
| */ | ||
| export default class Shipment extends EasyPostObject { | ||
| declare batch_id?: string | null; | ||
| declare batch_message?: string | null; | ||
| declare batch_status?: string | null; | ||
| declare buyer_address?: Record<string, unknown> | null; | ||
| declare customs_info?: Record<string, unknown> | null; | ||
| declare fees?: Record<string, unknown>[] | null; | ||
| declare forms?: Record<string, unknown>[] | null; | ||
| declare from_address?: Record<string, unknown> | null; | ||
| declare insurance?: Record<string, unknown> | null; | ||
| declare is_return?: boolean | null; | ||
| declare messages?: Record<string, unknown>[] | null; | ||
| declare options?: Record<string, unknown> | null; | ||
| declare parcel?: Record<string, unknown> | null; | ||
| declare postage_label?: Record<string, unknown> | null; | ||
| declare rates?: Parameters<typeof Constants.Utils.getLowestRate>[0] | null; | ||
| declare reference?: string | null; | ||
| declare refund_status?: 'submitted' | 'refunded' | 'rejected' | null; | ||
| declare return_address?: Record<string, unknown> | null; | ||
| declare scan_form?: Record<string, unknown> | null; | ||
| declare selected_rate?: Parameters<typeof Constants.Utils.getLowestRate>[0][number] | null; | ||
| declare status?: string | null; | ||
| declare to_address?: Record<string, unknown> | null; | ||
| declare tracker?: Record<string, unknown> | null; | ||
| declare tracking_code?: string | null; | ||
| declare usps_zone?: string | null; | ||
|
|
||
| /** | ||
| * Get the lowest rate for this {@link Shipment}. | ||
| * @public | ||
| * @param {string[]} [carriers] - List of allowed carriers to filter by | ||
| * @param {string[]} [services] - List of allowed services to filter by | ||
| * @returns {Rate} - The lowest rate | ||
| * @throws {FilteringError} - If no applicable rates are found | ||
| */ | ||
| lowestRate( | ||
| carriers?: string[], | ||
| services?: string[], | ||
| ): ReturnType<typeof Constants.Utils.getLowestRate> { | ||
| const rates = ((this as Shipment & { rates?: unknown[] }).rates || []) as Parameters< | ||
| typeof Constants.Utils.getLowestRate | ||
| >[0]; | ||
|
|
||
| return Constants.Utils.getLowestRate(rates, carriers, services); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
?denotes an optional value why do you need to type these asstring | nullinstead of juststring?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never mind I forgot about
undefined