Created
October 20, 2016 09:19
-
-
Save wmathes/215c5cb17793867c24a24d538876a897 to your computer and use it in GitHub Desktop.
This file contains 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
// Imports from the http-client package | |
import {ServiceClient} from "@crazy-factory/service-client"; | |
import {ServiceRequestOptions} from "@crazy-factory/service-client"; | |
import {ServiceResponse} from "@crazy-factory/service-client"; | |
// shop-api-client | |
import {IProductData} from "@crazy-factory/shop-service-data"; | |
// Nodes | |
class ProductsNode extends ServiceNode { | |
get(id: number, options?: ServiceRequestOptions): Promise<ServiceResponse<IProductData>> { | |
let url = `products/${id}`; | |
return this.client.get(url, options); | |
} | |
} | |
// Service | |
export class ShopService extends Service { | |
get products() { | |
return new ProductsNode(this.client); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment