|
1 | | -/* |
2 | | -
|
3 | | -{ |
4 | | -"body_html": null, |
5 | | -"created_at": "2013-12-10T03:40:05-05:00", |
6 | | -"handle": "cheese", |
7 | | -"id": 191302485, |
8 | | -"product_type": "General", |
9 | | -"published_at": "2013-12-10T21:29:21-05:00", |
10 | | -"published_scope": "global", |
11 | | -"template_suffix": null, |
12 | | -"title": "Cheese", |
13 | | -"updated_at": "2014-02-11T19:37:59-05:00", |
14 | | -"vendor": "Not specified", |
15 | | -"tags": "", |
16 | | -"variants": [ |
17 | | -{ |
18 | | -"barcode": null, |
19 | | -"compare_at_price": null, |
20 | | -"created_at": "2013-12-10T03:40:05-05:00", |
21 | | -"fulfillment_service": "manual", |
22 | | -"grams": 0, |
23 | | -"id": 437938881, |
24 | | -"inventory_management": "shopify", |
25 | | -"inventory_policy": "deny", |
26 | | -"option1": "Default", |
27 | | -"option2": null, |
28 | | -"option3": null, |
29 | | -"position": 1, |
30 | | -"price": "23.00", |
31 | | -"product_id": 191302485, |
32 | | -"requires_shipping": true, |
33 | | -"sku": "10061", |
34 | | -"taxable": true, |
35 | | -"title": "Default", |
36 | | -"updated_at": "2013-12-10T03:40:05-05:00", |
37 | | -"inventory_quantity": 20, |
38 | | -"old_inventory_quantity": 20 |
39 | | -} |
40 | | -], |
41 | | -"options": [ |
42 | | -{ |
43 | | -"id": 228536785, |
44 | | -"name": "Title", |
45 | | -"position": 1, |
46 | | -"product_id": 191302485 |
47 | | -} |
48 | | -], |
49 | | -"images": [ |
50 | | -{ |
51 | | -"created_at": "2013-12-10T03:40:12-05:00", |
52 | | -"id": 391973353, |
53 | | -"position": 1, |
54 | | -"product_id": 191302505, |
55 | | -"updated_at": "2013-12-10T03:40:12-05:00", |
56 | | -"src": "http://cdn.shopify.com/s/files/1/0199/1250/products/df4331ec645329971ea45cdfb77315fead191d32.jpeg?v=1386664812" |
57 | | -} |
58 | | -], |
59 | | -"image": { |
60 | | -"created_at": "2013-12-10T03:40:12-05:00", |
61 | | -"id": 391973353, |
62 | | -"position": 1, |
63 | | -"product_id": 191302505, |
64 | | -"updated_at": "2013-12-10T03:40:12-05:00", |
65 | | -"src": "http://cdn.shopify.com/s/files/1/0199/1250/products/df4331ec645329971ea45cdfb77315fead191d32.jpeg?v=1386664812" |
66 | | -} |
67 | | -}, |
68 | | -*/ |
69 | | - |
70 | | -package shopify |
71 | | - |
72 | | -type ShopifyProduct struct { |
73 | | - BodyHtml string `json:"body_html,omitempty"` |
74 | | - CreatedAt string `json:"created_at,omitempty"` |
75 | | - Handle string `json:"handle,omitempty"` |
76 | | - Id int `json:"id,omitempty"` |
77 | | - ProductType string `json:"product_type,omitempty"` |
78 | | - PublishedAt string `json:"published_at,omitempty"` |
79 | | - PublishedScope string `json:"published_scope,omitempty"` |
80 | | - TemplateSuffix string `json:"template_suffix,omitempty"` |
81 | | - Title string `json:"title,omitempty"` |
82 | | - UpdatedAt string `json:"updated_at,omitempty"` |
83 | | - Vendor string `json:"vendor,omitempty"` |
84 | | - Tags string `json:"tags,omitempty"` |
85 | | - Variants []ShopifyProductVariant `json:"variants,omitempty"` |
86 | | - Options []ShopifyProductOption `json:"options,omitempty"` |
87 | | - Images []ShopifyProductImage `json:"images,omitempty"` |
88 | | - Image ShopifyProductImage `json:"image,omitempty"` |
89 | | -} |
90 | | - |
91 | | -type ShopifyProductVariant struct { |
92 | | - Barcode string `json:"barcode,omitempty"` |
93 | | - CompareAtPrice string `json:"compare_at_price,omitempty"` |
94 | | - CreatedAt string `json:"created_at,omitempty"` |
95 | | - FulfillmentService string `json:"fulfillment_service,omitempty"` |
96 | | - Grams int `json:"grams,omitempty"` |
97 | | - Id int `json:"id,omitempty"` |
98 | | - InventoryManagement string `json:"inventory_management,omitempty"` |
99 | | - InventoryPolicy string `json:"inventory_policy,omitempty"` |
100 | | - Option1 string `json:"option1,omitempty"` |
101 | | - Option2 string `json:"option2,omitempty"` |
102 | | - Option3 string `json:"option3,omitempty"` |
103 | | - Position int `json:"position,omitempty"` |
104 | | - Price string `json:"price,omitempty"` |
105 | | - ProductId int `json:"product_id,omitempty"` |
106 | | - RequiresShipping bool `json:"requires_shopping,omitempty"` |
107 | | - Sku string `json:"sku,omitempty"` |
108 | | - Taxable bool `json:"taxable,omitempty"` |
109 | | - Title string `json:"title,omitempty"` |
110 | | - UpdatedAt string `json:"updated_at,omitempty"` |
111 | | - InventoryQuantity float64 `json:"inventory_quantity,omitempty"` |
112 | | - OldInventoryQuantity int `json:"old_inventory_quantity,omitempty"` |
113 | | -} |
114 | | - |
115 | | -type ShopifyProductOption struct { |
116 | | - Id int `json:"id,omitempty"` |
117 | | - Name string `json:"name,omitempty"` |
118 | | - Position int `json:"position,omitempty"` |
119 | | - ProductId int `json:"product_id,omitempty"` |
120 | | -} |
121 | | - |
122 | | -type ShopifyProductImage struct { |
123 | | - CreatedAt string `json:"created_at,omitempty"` |
124 | | - Id int `json:"id,omitempty"` |
125 | | - Position int `json:"position,omitempty"` |
126 | | - ProductId int `json:"product_id,omitempty"` |
127 | | - UpdatedAt string `json:"updated_at",omitempty"` |
128 | | - Src string `json:"src,omitempty"` |
129 | | -} |
130 | | - |
131 | | -type ShopifyResponse struct { |
132 | | - Products []ShopifyProduct `json:"products,omitempty"` |
133 | | - Product ShopifyProduct `json:"product,omitempty"` |
134 | | -} |
| 1 | +/* |
| 2 | +
|
| 3 | +{ |
| 4 | +"body_html": null, |
| 5 | +"created_at": "2013-12-10T03:40:05-05:00", |
| 6 | +"handle": "cheese", |
| 7 | +"id": 191302485, |
| 8 | +"product_type": "General", |
| 9 | +"published_at": "2013-12-10T21:29:21-05:00", |
| 10 | +"published_scope": "global", |
| 11 | +"template_suffix": null, |
| 12 | +"title": "Cheese", |
| 13 | +"updated_at": "2014-02-11T19:37:59-05:00", |
| 14 | +"vendor": "Not specified", |
| 15 | +"tags": "", |
| 16 | +"variants": [ |
| 17 | +{ |
| 18 | +"barcode": null, |
| 19 | +"compare_at_price": null, |
| 20 | +"created_at": "2013-12-10T03:40:05-05:00", |
| 21 | +"fulfillment_service": "manual", |
| 22 | +"grams": 0, |
| 23 | +"id": 437938881, |
| 24 | +"inventory_management": "shopify", |
| 25 | +"inventory_policy": "deny", |
| 26 | +"option1": "Default", |
| 27 | +"option2": null, |
| 28 | +"option3": null, |
| 29 | +"position": 1, |
| 30 | +"price": "23.00", |
| 31 | +"product_id": 191302485, |
| 32 | +"requires_shipping": true, |
| 33 | +"sku": "10061", |
| 34 | +"taxable": true, |
| 35 | +"title": "Default", |
| 36 | +"updated_at": "2013-12-10T03:40:05-05:00", |
| 37 | +"inventory_quantity": 20, |
| 38 | +"old_inventory_quantity": 20 |
| 39 | +} |
| 40 | +], |
| 41 | +"options": [ |
| 42 | +{ |
| 43 | +"id": 228536785, |
| 44 | +"name": "Title", |
| 45 | +"position": 1, |
| 46 | +"product_id": 191302485 |
| 47 | +} |
| 48 | +], |
| 49 | +"images": [ |
| 50 | +{ |
| 51 | +"created_at": "2013-12-10T03:40:12-05:00", |
| 52 | +"id": 391973353, |
| 53 | +"position": 1, |
| 54 | +"product_id": 191302505, |
| 55 | +"updated_at": "2013-12-10T03:40:12-05:00", |
| 56 | +"src": "http://cdn.shopify.com/s/files/1/0199/1250/products/df4331ec645329971ea45cdfb77315fead191d32.jpeg?v=1386664812" |
| 57 | +} |
| 58 | +], |
| 59 | +"image": { |
| 60 | +"created_at": "2013-12-10T03:40:12-05:00", |
| 61 | +"id": 391973353, |
| 62 | +"position": 1, |
| 63 | +"product_id": 191302505, |
| 64 | +"updated_at": "2013-12-10T03:40:12-05:00", |
| 65 | +"src": "http://cdn.shopify.com/s/files/1/0199/1250/products/df4331ec645329971ea45cdfb77315fead191d32.jpeg?v=1386664812" |
| 66 | +} |
| 67 | +}, |
| 68 | +*/ |
| 69 | + |
| 70 | +package shopify |
| 71 | + |
| 72 | +// Product models the shopify product model |
| 73 | +type Product struct { |
| 74 | + BodyHTML string `json:"body_html,omitempty"` |
| 75 | + CreatedAt string `json:"created_at,omitempty"` |
| 76 | + Handle string `json:"handle,omitempty"` |
| 77 | + ID int `json:"id,omitempty"` |
| 78 | + ProductType string `json:"product_type,omitempty"` |
| 79 | + PublishedAt string `json:"published_at,omitempty"` |
| 80 | + PublishedScope string `json:"published_scope,omitempty"` |
| 81 | + TemplateSuffix string `json:"template_suffix,omitempty"` |
| 82 | + Title string `json:"title,omitempty"` |
| 83 | + UpdatedAt string `json:"updated_at,omitempty"` |
| 84 | + Vendor string `json:"vendor,omitempty"` |
| 85 | + Tags string `json:"tags,omitempty"` |
| 86 | + Variants []ProductVariant `json:"variants,omitempty"` |
| 87 | + Options []ProductOption `json:"options,omitempty"` |
| 88 | + Images []ProductImage `json:"images,omitempty"` |
| 89 | + Image ProductImage `json:"image,omitempty"` |
| 90 | +} |
| 91 | + |
| 92 | +// ProductVariant models the shopify product variant |
| 93 | +type ProductVariant struct { |
| 94 | + Barcode string `json:"barcode,omitempty"` |
| 95 | + CompareAtPrice string `json:"compare_at_price,omitempty"` |
| 96 | + CreatedAt string `json:"created_at,omitempty"` |
| 97 | + FulfillmentService string `json:"fulfillment_service,omitempty"` |
| 98 | + Grams int `json:"grams,omitempty"` |
| 99 | + ID int `json:"id,omitempty"` |
| 100 | + InventoryManagement string `json:"inventory_management,omitempty"` |
| 101 | + InventoryPolicy string `json:"inventory_policy,omitempty"` |
| 102 | + Option1 string `json:"option1,omitempty"` |
| 103 | + Option2 string `json:"option2,omitempty"` |
| 104 | + Option3 string `json:"option3,omitempty"` |
| 105 | + Position int `json:"position,omitempty"` |
| 106 | + Price string `json:"price,omitempty"` |
| 107 | + ProductID int `json:"product_id,omitempty"` |
| 108 | + RequiresShipping bool `json:"requires_shopping,omitempty"` |
| 109 | + Sku string `json:"sku,omitempty"` |
| 110 | + Taxable bool `json:"taxable,omitempty"` |
| 111 | + Title string `json:"title,omitempty"` |
| 112 | + UpdatedAt string `json:"updated_at,omitempty"` |
| 113 | + InventoryQuantity float64 `json:"inventory_quantity,omitempty"` |
| 114 | + OldInventoryQuantity int `json:"old_inventory_quantity,omitempty"` |
| 115 | +} |
| 116 | + |
| 117 | +// ProductOption models the shopify product option |
| 118 | +type ProductOption struct { |
| 119 | + ID int `json:"id,omitempty"` |
| 120 | + Name string `json:"name,omitempty"` |
| 121 | + Position int `json:"position,omitempty"` |
| 122 | + ProductID int `json:"product_id,omitempty"` |
| 123 | +} |
| 124 | + |
| 125 | +// ProductImage models the shopify product image object |
| 126 | +type ProductImage struct { |
| 127 | + CreatedAt string `json:"created_at,omitempty"` |
| 128 | + ID int `json:"id,omitempty"` |
| 129 | + Position int `json:"position,omitempty"` |
| 130 | + ProductID int `json:"product_id,omitempty"` |
| 131 | + UpdatedAt string `json:"updated_at,omitempty"` |
| 132 | + Src string `json:"src,omitempty"` |
| 133 | +} |
| 134 | + |
| 135 | +// Response models the shopify API response |
| 136 | +type productResponse struct { |
| 137 | + Products []Product `json:"products,omitempty"` |
| 138 | + SingleProduct Product `json:"product,omitempty"` |
| 139 | +} |
0 commit comments