Skip to content

Commit

Permalink
Export and define classes separately so jsdoc finds them
Browse files Browse the repository at this point in the history
  • Loading branch information
Mina Smart committed Nov 30, 2017
1 parent 4bead37 commit ba22521
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 163 deletions.
321 changes: 168 additions & 153 deletions docs/API_REFERENCE.md

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/checkout-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import checkoutLineItemsAddMutation from './graphql/checkoutLineItemsAddMutation
import checkoutLineItemsRemoveMutation from './graphql/checkoutLineItemsRemoveMutation.graphql';
import checkoutLineItemsUpdateMutation from './graphql/checkoutLineItemsUpdateMutation.graphql';

export default class CheckoutResource extends Resource {
/**
* The JS Buy SDK checkout resource
* @class
*/
class CheckoutResource extends Resource {

/**
* Fetches a checkout by ID.
Expand Down Expand Up @@ -132,3 +136,5 @@ export default class CheckoutResource extends Resource {
.then(handleCheckoutMutation('checkoutLineItemsUpdate', this.graphQLClient));
}
}

export default CheckoutResource;
10 changes: 5 additions & 5 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import types from '../schema.json';
* The JS Buy SDK Client.
* @class
*
* @property {Object} product The property under which product fetching methods live.
* @property {Object} collection The property under which collection fetching methods live.
* @property {Object} shop The property under which shop fetching methods live.
* @property {Object} checkout The property under which shop fetching and mutating methods live.
* @property {Object} image The property under which image helper methods live.
* @property {ProductResource} product The property under which product fetching methods live.
* @property {CollectionResource} collection The property under which collection fetching methods live.
* @property {ShopResource} shop The property under which shop fetching methods live.
* @property {CheckoutResource} checkout The property under which shop fetching and mutating methods live.
* @property {ImageResource} image The property under which image helper methods live.
*/
class Client {

Expand Down
7 changes: 6 additions & 1 deletion src/collection-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import collectionConnectionQuery from './graphql/collectionConnectionQuery.graph
import collectionConnectionWithProductsQuery from './graphql/collectionConnectionWithProductsQuery.graphql';
import collectionByHandleQuery from './graphql/collectionByHandleQuery.graphql';

export default class CollectionResource extends Resource {
/**
* The JS Buy SDK collection resource
* @class
*/
class CollectionResource extends Resource {

/**
* Fetches all collections on the shop, not including products.
Expand Down Expand Up @@ -123,3 +127,4 @@ export default class CollectionResource extends Resource {
}).then(defaultResolver('shop.collections'));
}
}
export default CollectionResource;
8 changes: 7 additions & 1 deletion src/image-resource.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import Resource from './resource';
import imageHelpers from './image-helpers';

export default class ImageResource extends Resource {
/**
* The JS Buy SDK image resource
* @class
*/
class ImageResource extends Resource {
get helpers() {
return imageHelpers;
}
}

export default ImageResource;
8 changes: 7 additions & 1 deletion src/product-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import productNodeQuery from './graphql/productNodeQuery.graphql';
import productConnectionQuery from './graphql/productConnectionQuery.graphql';
import productByHandleQuery from './graphql/productByHandleQuery.graphql';

export default class ProductResource extends Resource {
/**
* The JS Buy SDK product resource
* @class
*/
class ProductResource extends Resource {
get helpers() {
return productHelpers;
}
Expand Down Expand Up @@ -95,3 +99,5 @@ export default class ProductResource extends Resource {
.then(paginateProductConnectionsAndResolve(this.graphQLClient));
}
}

export default ProductResource;
8 changes: 7 additions & 1 deletion src/shop-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import defaultResolver from './default-resolver';
import shopQuery from './graphql/shopQuery.graphql';
import shopPolicyQuery from './graphql/shopPolicyQuery.graphql';

export default class ShopResource extends Resource {
/**
* The JS Buy SDK shop resource
* @class
*/
class ShopResource extends Resource {

/**
* Fetches shop information (`currencyCode`, `description`, `moneyFormat`, `name`, and `primaryDomain`).
Expand Down Expand Up @@ -40,3 +44,5 @@ export default class ShopResource extends Resource {
.then(defaultResolver('shop'));
}
}

export default ShopResource;

0 comments on commit ba22521

Please sign in to comment.