Skip to content

Instantly share code, notes, and snippets.

@willm
Last active March 19, 2016 08:47
Show Gist options
  • Save willm/9ca2835daa7767d5436a to your computer and use it in GitHub Desktop.
Save willm/9ca2835daa7767d5436a to your computer and use it in GitHub Desktop.
7digital api typescript defs
declare module '7digital-api' {
namespace Responses {
interface ApiResponse {
status: string;
version: string;
}
interface BasketResponse extends ApiResponse {
basket: Basket;
}
interface AmountDue {
amount: string;
formattedAmount: string;
}
interface Package {
id: string;
}
interface BasketItem {
id: string;
type: string;
itemName: string;
artistName: string;
trackId: string;
releaseId: string;
price: Price;
amountDue: AmountDue;
package: Package;
}
interface Basket {
id: string;
basketItems: Array<BasketItem>;
amountDue: AmountDue;
}
interface Currency {
_: string;
code: string;
}
interface Price {
value: string;
fomattedPrice: string;
currency: Currency;
}
}
interface BasketParams {
basketId: string;
country: string;
}
interface AddItemParams extends BasketParams {
releaseId: string;
trackId: string;
packageId: string;
affiliatePartner: string;
}
export class Basket {
get: (
params:BasketParams,
callback: (
err:Error, basket:Responses.BasketResponse
) => void
) => void;
create: (any, callback: (
err:Error, basket:Responses.BasketResponse
) => void
) => void;
addItem: (AddItemParams, callback: (
err:Error, basket:Responses.BasketResponse
) => void
) => void;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment