Skip to content

Commit

Permalink
Use "import type" where possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimm committed Jun 21, 2023
1 parent 7f9ba2a commit 4900d6e
Show file tree
Hide file tree
Showing 122 changed files with 534 additions and 503 deletions.
4 changes: 2 additions & 2 deletions src/Options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AxiosRequestConfig } from 'axios';
import { type AxiosRequestConfig } from 'axios';

import Xor from './types/Xor';
import type Xor from './types/Xor';

type Options = Xor<
{
Expand Down
4 changes: 2 additions & 2 deletions src/binders/Binder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import breakUrl from '../communication/breakUrl';
import Page from '../data/page/Page';
import Maybe from '../types/Maybe';
import type Page from '../data/page/Page';
import type Maybe from '../types/Maybe';

/**
* A binder is the interface for a certain type of information. There is a binder for orders, and one for customers, et
Expand Down
8 changes: 4 additions & 4 deletions src/binders/applePay/ApplePayBinder.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import NetworkClient from '../../communication/NetworkClient';
import ApplePaySession from '../../data/applePaySession/ApplePaySession';
import type NetworkClient from '../../communication/NetworkClient';
import type ApplePaySession from '../../data/applePaySession/ApplePaySession';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import { RequestPaymentSessionParameters } from './parameters';
import type Callback from '../../types/Callback';
import { type RequestPaymentSessionParameters } from './parameters';

const pathSegments = 'wallets/applepay/sessions';

Expand Down
2 changes: 1 addition & 1 deletion src/binders/applePay/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IdempotencyParameter } from '../../types/parameters';
import { type IdempotencyParameter } from '../../types/parameters';

export interface RequestPaymentSessionParameters extends IdempotencyParameter {
/**
Expand Down
11 changes: 6 additions & 5 deletions src/binders/chargebacks/ChargebacksBinder.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Chargeback, { ChargebackData } from '../../data/chargebacks/Chargeback';
import Page from '../../data/page/Page';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import type Chargeback from '../../data/chargebacks/Chargeback';
import { type ChargebackData } from '../../data/chargebacks/Chargeback';
import type Page from '../../data/page/Page';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';
import { IterateParameters, PageParameters } from './parameters';
import { type IterateParameters, type PageParameters } from './parameters';

const pathSegment = 'chargebacks';

Expand Down
4 changes: 2 additions & 2 deletions src/binders/chargebacks/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChargebackEmbed } from '../../data/chargebacks/Chargeback';
import { PaginationParameters, ThrottlingParameter } from '../../types/parameters';
import { type ChargebackEmbed } from '../../data/chargebacks/Chargeback';
import { type PaginationParameters, type ThrottlingParameter } from '../../types/parameters';

export type PageParameters = PaginationParameters & {
profileId?: string;
Expand Down
11 changes: 6 additions & 5 deletions src/binders/customers/CustomersBinder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Customer, { CustomerData } from '../../data/customers/Customer';
import Page from '../../data/page/Page';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import type Customer from '../../data/customers/Customer';
import { type CustomerData } from '../../data/customers/Customer';
import type Page from '../../data/page/Page';
import ApiError from '../../errors/ApiError';
import checkId from '../../plumbing/checkId';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';
import { CreateParameters, DeleteParameters, GetParameters, IterateParameters, PageParameters, UpdateParameters } from './parameters';
import { type CreateParameters, type DeleteParameters, type GetParameters, type IterateParameters, type PageParameters, type UpdateParameters } from './parameters';

const pathSegment = 'customers';

Expand Down
12 changes: 6 additions & 6 deletions src/binders/customers/mandates/CustomerMandatesBinder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import { MandateData } from '../../../data/customers/mandates/data';
import Mandate from '../../../data/customers/mandates/Mandate';
import Page from '../../../data/page/Page';
import type TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import { type MandateData } from '../../../data/customers/mandates/data';
import type Mandate from '../../../data/customers/mandates/Mandate';
import type Page from '../../../data/page/Page';
import ApiError from '../../../errors/ApiError';
import checkId from '../../../plumbing/checkId';
import renege from '../../../plumbing/renege';
import Callback from '../../../types/Callback';
import type Callback from '../../../types/Callback';
import Binder from '../../Binder';
import { CreateParameters, GetParameters, IterateParameters, PageParameters, RevokeParameters } from './parameters';
import { type CreateParameters, type GetParameters, type IterateParameters, type PageParameters, type RevokeParameters } from './parameters';

function getPathSegments(customerId: string) {
return `customers/${customerId}/mandates`;
Expand Down
4 changes: 2 additions & 2 deletions src/binders/customers/mandates/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MandateData } from '../../../data/customers/mandates/data';
import { IdempotencyParameter, PaginationParameters, ThrottlingParameter } from '../../../types/parameters';
import { type MandateData } from '../../../data/customers/mandates/data';
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../../types/parameters';

interface ContextParameters {
customerId: string;
Expand Down
6 changes: 3 additions & 3 deletions src/binders/customers/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CustomerData } from '../../data/customers/Customer';
import { IdempotencyParameter, PaginationParameters, ThrottlingParameter } from '../../types/parameters';
import PickOptional from '../../types/PickOptional';
import { type CustomerData } from '../../data/customers/Customer';
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../types/parameters';
import type PickOptional from '../../types/PickOptional';

interface ContextParameter {
testmode?: boolean;
Expand Down
12 changes: 6 additions & 6 deletions src/binders/customers/payments/CustomerPaymentsBinder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import Page from '../../../data/page/Page';
import { PaymentData } from '../../../data/payments/data';
import Payment from '../../../data/payments/Payment';
import type TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import type Page from '../../../data/page/Page';
import { type PaymentData } from '../../../data/payments/data';
import type Payment from '../../../data/payments/Payment';
import ApiError from '../../../errors/ApiError';
import checkId from '../../../plumbing/checkId';
import renege from '../../../plumbing/renege';
import Callback from '../../../types/Callback';
import type Callback from '../../../types/Callback';
import Binder from '../../Binder';
import { CreateParameters, IterateParameters, PageParameters } from './parameters';
import { type CreateParameters, type IterateParameters, type PageParameters } from './parameters';

function getPathSegments(customerId: string) {
return `customers/${customerId}/payments`;
Expand Down
8 changes: 4 additions & 4 deletions src/binders/customers/payments/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PaymentMethod } from '../../../data/global';
import { PaymentData } from '../../../data/payments/data';
import { IdempotencyParameter, PaginationParameters, ThrottlingParameter } from '../../../types/parameters';
import PickOptional from '../../../types/PickOptional';
import { type PaymentMethod } from '../../../data/global';
import { type PaymentData } from '../../../data/payments/data';
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../../types/parameters';
import type PickOptional from '../../../types/PickOptional';

interface ContextParameters {
customerId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import Page from '../../../data/page/Page';
import { SubscriptionData } from '../../../data/subscriptions/data';
import Subscription from '../../../data/subscriptions/Subscription';
import type TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import type Page from '../../../data/page/Page';
import { type SubscriptionData } from '../../../data/subscriptions/data';
import type Subscription from '../../../data/subscriptions/Subscription';
import ApiError from '../../../errors/ApiError';
import checkId from '../../../plumbing/checkId';
import renege from '../../../plumbing/renege';
import Callback from '../../../types/Callback';
import type Callback from '../../../types/Callback';
import Binder from '../../Binder';
import { CancelParameters, CreateParameters, GetParameters, IterateParameters, PageParameters, UpdateParameters } from './parameters';
import { type CancelParameters, type CreateParameters, type GetParameters, type IterateParameters, type PageParameters, type UpdateParameters } from './parameters';

function getPathSegments(customerId: string) {
return `customers/${customerId}/subscriptions`;
Expand Down
6 changes: 3 additions & 3 deletions src/binders/customers/subscriptions/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SubscriptionData } from '../../../data/subscriptions/data';
import { IdempotencyParameter, PaginationParameters, ThrottlingParameter } from '../../../types/parameters';
import PickOptional from '../../../types/PickOptional';
import { type SubscriptionData } from '../../../data/subscriptions/data';
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../../types/parameters';
import type PickOptional from '../../../types/PickOptional';

interface ContextParameters {
customerId: string;
Expand Down
10 changes: 5 additions & 5 deletions src/binders/methods/MethodsBinder.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Method from '../../data/methods/Method';
import { MethodData } from '../../data/methods/data';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import type Method from '../../data/methods/Method';
import { type MethodData } from '../../data/methods/data';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';
import { GetParameters, ListParameters } from './parameters';
import { type GetParameters, type ListParameters } from './parameters';

const pathSegment = 'methods';

Expand Down
4 changes: 2 additions & 2 deletions src/binders/methods/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Amount, Locale, SequenceType } from '../../data/global';
import { MethodInclude } from '../../data/methods/data';
import { type Amount, type Locale, type SequenceType } from '../../data/global';
import { type MethodInclude } from '../../data/methods/data';

export interface GetParameters {
/**
Expand Down
10 changes: 5 additions & 5 deletions src/binders/onboarding/OnboardingBinder.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import { OnboardingData } from '../../data/onboarding/data';
import Onboarding from '../../data/onboarding/Onboarding';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import { type OnboardingData } from '../../data/onboarding/data';
import type Onboarding from '../../data/onboarding/Onboarding';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';
import { SubmitParameters } from './parameters';
import { type SubmitParameters } from './parameters';

const pathSegments = 'onboarding/me';

Expand Down
4 changes: 2 additions & 2 deletions src/binders/onboarding/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from '../../data/global';
import { IdempotencyParameter } from '../../types/parameters';
import { type Address } from '../../data/global';
import { type IdempotencyParameter } from '../../types/parameters';

export interface SubmitParameters extends IdempotencyParameter {
/**
Expand Down
12 changes: 6 additions & 6 deletions src/binders/orders/OrdersBinder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Page from '../../data/page/Page';
import { OrderData } from '../../data/orders/data';
import Order from '../../data/orders/Order';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import type Page from '../../data/page/Page';
import { type OrderData } from '../../data/orders/data';
import type Order from '../../data/orders/Order';
import ApiError from '../../errors/ApiError';
import checkId from '../../plumbing/checkId';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';
import { CancelParameters, CreateParameters, GetParameters, IterateParameters, PageParameters, UpdateParameters } from './parameters';
import { type CancelParameters, type CreateParameters, type GetParameters, type IterateParameters, type PageParameters, type UpdateParameters } from './parameters';

export const pathSegment = 'orders';

Expand Down
10 changes: 5 additions & 5 deletions src/binders/orders/orderlines/OrderLinesBinder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import { OrderData } from '../../../data/orders/data';
import Order from '../../../data/orders/Order';
import type TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import { type OrderData } from '../../../data/orders/data';
import type Order from '../../../data/orders/Order';
import ApiError from '../../../errors/ApiError';
import checkId from '../../../plumbing/checkId';
import renege from '../../../plumbing/renege';
import Callback from '../../../types/Callback';
import type Callback from '../../../types/Callback';
import Binder from '../../Binder';
import { CancelParameters, UpdateParameters } from './parameters';
import { type CancelParameters, type UpdateParameters } from './parameters';

function getPathSegments(orderId: string) {
return `orders/${orderId}/lines`;
Expand Down
8 changes: 4 additions & 4 deletions src/binders/orders/orderlines/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Amount } from '../../../data/global';
import { OrderLineData } from '../../../data/orders/orderlines/OrderLine';
import { IdempotencyParameter } from '../../../types/parameters';
import PickOptional from '../../../types/PickOptional';
import { type Amount } from '../../../data/global';
import { type OrderLineData } from '../../../data/orders/orderlines/OrderLine';
import { type IdempotencyParameter } from '../../../types/parameters';
import type PickOptional from '../../../types/PickOptional';

interface ContextParameters {
orderId: string;
Expand Down
12 changes: 6 additions & 6 deletions src/binders/orders/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PaymentMethod } from '../../data/global';
import { OrderData, OrderEmbed } from '../../data/orders/data';
import { OrderLineData } from '../../data/orders/orderlines/OrderLine';
import { IdempotencyParameter, PaginationParameters, ThrottlingParameter } from '../../types/parameters';
import { CreateParameters as PaymentCreateParameters } from '../payments/parameters';
import PickOptional from '../../types/PickOptional';
import { type PaymentMethod } from '../../data/global';
import { type OrderData, type OrderEmbed } from '../../data/orders/data';
import { type OrderLineData } from '../../data/orders/orderlines/OrderLine';
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../types/parameters';
import { type CreateParameters as PaymentCreateParameters } from '../payments/parameters';
import type PickOptional from '../../types/PickOptional';

export type CreateParameters = Pick<OrderData, 'amount' | 'orderNumber' | 'consumerDateOfBirth' | 'webhookUrl' | 'locale' | 'metadata' | 'expiresAt'> &
PickOptional<OrderData, 'billingAddress' | 'shippingAddress' | 'redirectUrl'> & {
Expand Down
9 changes: 5 additions & 4 deletions src/binders/orders/shipments/OrderShipmentsBinder.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import Shipment, { ShipmentData } from '../../../data/orders/shipments/Shipment';
import type TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import type Shipment from '../../../data/orders/shipments/Shipment';
import { type ShipmentData } from '../../../data/orders/shipments/Shipment';
import ApiError from '../../../errors/ApiError';
import checkId from '../../../plumbing/checkId';
import renege from '../../../plumbing/renege';
import Callback from '../../../types/Callback';
import type Callback from '../../../types/Callback';
import Binder from '../../Binder';
import { CreateParameters, GetParameters, ListParameters, UpdateParameters } from './parameters';
import { type CreateParameters, type GetParameters, type ListParameters, type UpdateParameters } from './parameters';

export function getPathSegments(orderId: string) {
return `orders/${orderId}/shipments`;
Expand Down
8 changes: 4 additions & 4 deletions src/binders/orders/shipments/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Amount } from '../../../data/global';
import { ShipmentData } from '../../../data/orders/shipments/Shipment';
import { IdempotencyParameter } from '../../../types/parameters';
import PickRequired from '../../../types/PickRequired';
import { type Amount } from '../../../data/global';
import { type ShipmentData } from '../../../data/orders/shipments/Shipment';
import { type IdempotencyParameter } from '../../../types/parameters';
import type PickRequired from '../../../types/PickRequired';

interface ContextParameters {
orderId: string;
Expand Down
7 changes: 4 additions & 3 deletions src/binders/organizations/OrganizationsBinder.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Organization, { OrganizationData } from '../../data/organizations/Organizations';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import type Organization from '../../data/organizations/Organizations';
import { type OrganizationData } from '../../data/organizations/Organizations';
import ApiError from '../../errors/ApiError';
import checkId from '../../plumbing/checkId';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';

const pathSegment = 'organizations';
Expand Down
12 changes: 6 additions & 6 deletions src/binders/paymentLinks/PaymentLinksBinder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Page from '../../data/page/Page';
import { PaymentLinkData } from '../../data/paymentLinks/data';
import PaymentLink from '../../data/paymentLinks/PaymentLink';
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import type Page from '../../data/page/Page';
import { type PaymentLinkData } from '../../data/paymentLinks/data';
import type PaymentLink from '../../data/paymentLinks/PaymentLink';
import ApiError from '../../errors/ApiError';
import checkId from '../../plumbing/checkId';
import renege from '../../plumbing/renege';
import Callback from '../../types/Callback';
import type Callback from '../../types/Callback';
import Binder from '../Binder';
import { CreateParameters, GetParameters, IterateParameters, PageParameters } from './parameters';
import { type CreateParameters, type GetParameters, type IterateParameters, type PageParameters } from './parameters';

const pathSegment = 'payment-links';

Expand Down
4 changes: 2 additions & 2 deletions src/binders/paymentLinks/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PaymentLinkData } from '../../data/paymentLinks/data';
import { IdempotencyParameter, PaginationParameters, ThrottlingParameter } from '../../types/parameters';
import { type PaymentLinkData } from '../../data/paymentLinks/data';
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../types/parameters';

export type CreateParameters = Pick<PaymentLinkData, 'description' | 'amount' | 'redirectUrl' | 'webhookUrl' | 'expiresAt'> & {
profileId?: string;
Expand Down
Loading

0 comments on commit 4900d6e

Please sign in to comment.