-
Notifications
You must be signed in to change notification settings - Fork 0
/
___shopify_source.php
1852 lines (1637 loc) · 50.5 KB
/
___shopify_source.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Shopify Datasource 0.1
* Shopify datasource to communicate with the Shopify API.
* API URL: http://api.shopify.com/comment.html
* References(Credits):
*
* http://bakery.cakephp.org/articles/view/twitter-component
* http://debuggable.com/posts/new-google-analytics-api:480f4dd6-c59c-445f-8ce0-4202cbdd56cb
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
*
* @author fokkerOne <[email protected]>
* @copyright (c) 2010 fokkerOne
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link -- more to come
* @see http//api.shopify.com
* @created September 7, 2010
* @version 0.2
*/
App::import('Core', array('Xml', 'HttpSocket'));
class ShopifySource extends DataSource
{
var $username = "";
var $password = "";
var $description = "Shopify API";
var $Http = null;
function __construct($config){
parent::__construct($config);
$this->Http =& new HttpSocket();
$this->username = $this->config['username'];
$this->password = $this->config['password'];
$this->restUrl = $this->config['url'];
$this->private = $this->config['private'];
/* if (isset($params['signature'])){
$timestamp = $params['timestamp'];
$expireTime = time() - (24 * 86400);
if (!$this->validate_signature($params) || $expireTime > $timestamp){
throw new Exception('Invalid signature: Possible malicious login.');
}
}
*/
}
//########################################################### SHOP #########################################################################################
/**
* Shopify API – Shop
*
* top
* Receive a single Shop
* Get the configuration of the shop account
*
* GET: /admin/shop.xml
**/
function getShop(){
//@toDo
}
//######################################################## REDIRECTS/ROUTING ########################################################################################
/**
* Receive a list of all Redirects
* Get a list of all URL redirects for your shop.
*
* Available URL Query parameters:
*
* limit — Amount of results (default: 50) (maximum: 250)
* page — Page to show (default: 1)
* path — Show Redirects with given path
* target — Show Redirects with given target
* GET /admin/redirects.xml
**/
function getRedirects(){
//@toDo
}
/**
* Receive a single Redirect
* Get a single redirect.
*
* GET /admin/redirects/#{id}.xml
* Get a single redirect by its ID.
**/
function getRedirect( $id = false){
//@toDo
}
/**
* Get a count of all URL redirects for your shop.
*
* Available URL Query parameters:
*
* path — Count Redirects with given path
* target — Count Redirects with given target
* GET /admin/redirects/count.xml
*
**/
function countRedirects(){
//@toDo
}
/**
* Create a new Redirect
* Create a new redirect.
*
* POST /admin/redirects.xml
* We expect users might try going to /ipod in order to find about one of our popular products,
* but we want to redirect them to /itunes because that's where we have the information they're looking for.
**/
function createRedirect(){
//@toDo
}
/**
* Modify an existing Redirect
* Update a redirect's path and/or target URIs.
*
* PUT /admin/redirects/#{id}.xml
* Change a redirect so that it activates for a different request path:
**/
function updateRedirect(){
//@toDo
}
/**
* Remove a Redirect from the database
* Delete a redirect
*
* DELETE /admin/redirects/#{id}.xml
* Remove an exisiting redirect from a shop
**/
function deleteRedirect( $id = false ){
//@toDo
}
//############################################################# COUNTRIES ###########################################################################################
/**
* Receive a list of all Countries
* Get a list of all countries
*
* GET /admin/countries.xml
* Get all countries
**/
function getAllCountries(){
$api_call = "/admin/countries.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_call ), false, $this->__getAuthHeader( ) ) );
}
/**
* Receive a single Country
* Show country
*
* GET /admin/countries/#{id}.xml
* Show country
**/
function getCountry(){
// $api_url = "/admin/countries.xml";
// return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Create a new Country
* Create a country
*
* POST /admin/countries.xml
* Create a country using Shopify's tax rate for the country
*
* REQUEST:
* <?xml version="1.0" encoding="UTF-8"?>
* <country>
* <code>FR</code>
* </country>
*
*
* POST /admin/countries.xml
* Create a country using a custom tax rate
*
* REQUEST:
* <?xml version="1.0" encoding="UTF-8"?>
* <country>
* <tax type="float">0.2</tax>
* <code>FR</code>
* </country>
**/
function createCountry( $code ){
// $api_url = "/admin/countries.xml";
// return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Receive a count of all Countries
* Get a count of all countries
*
* GET /admin/countries/count.xml
* Count all countries
**/
function countCountries(){
$api_url = "/admin/countries/count.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Modify an existing Country
* Update a country
*
* PUT /admin/countries/#{id}.xml
* Update the country's tax rate
*
* Request
*
*
* <?xml version="1.0" encoding="UTF-8"?>
* <country>
* <tax type="float">0.1</tax>
* <id type="integer">879921427</id>
* </country>
**/
function updateCountry(){
//@toDo
}
/**
* Remove a Country from the database
* Delete a country
*
* DELETE /admin/countries/#{id}.xml
* Delete a country along with all shipping rates
**/
function deleteCountry(){
//@toDo
}
//########################################################## PROVINCE ##########################################################################################
/**
* Receive a list of all Provinces
* Get all provinces
*
* Available URL Query parameters:
*
* country_id — The id of the country the province belongs to
* GET /admin/countries/#{id}/provinces.xml
* Get all provinces for a country
**/
function getProvinces( $country_id = false ){
//@toDo
}
/**
* Receive a single Province
* Get a single province for a country
*
* Available URL Query parameters:
*
* country_id — The id of the country the province belongs to
* GET /admin/countries/#{id}/provinces/#{id}.xml
* Show province
**/
function getProvince( $country_id = false ){
}
/**
* Count all Provinces
* Get a count of all provinces
*
* Available URL Query parameters:
*
* country_id — The id of the country the province belongs to
* GET /admin/countries/#{id}/provinces/count.xml
* Count all provinces for a country
**/
function countProvinces(){
//@toDo
}
/**
* Modify an existing Province
* PUT /admin/countries/#{id}/provinces/#{id}.xml
* Update a province's tax rate
**/
function updateProvince( ){
//@toDo
}
//########################################################## PRODUCTS ##########################################################################################
function getProducts($params){
return $this->__process($this->Http->get($this->__apicall( $url ), $params, $this->__getAuthHeader( ) ));
}
/**
* Receive a single Product
* Get a single product
*
* GET /admin/products/#{id}.xml
* Get a single product by ID
**/
function getProduct( $id = false, $params = array()){
$url = "/admin/products";
if($id) {
$url .= "/{$id}.xml";
} else {
$url .= ".xml";
}
return $this->__process($this->Http->get($this->__apicall( $url ), $params, $this->__getAuthHeader( ) ));
}
/**
*Modify an existing Product
*Update a product and associated variants and images
*
*PUT /admin/products/#{id}.xml
*Update a product's tags
*
*Request
*
*
*<?xml version="1.0" encoding="UTF-8"?>
*<product>
* <id type="integer">632910392</id>
* <tags>Barnes & Noble, John's Fav</tags>
*</product>
*
*
* for all samples see here: http://api.shopify.com/product.html
*
**/
function updateProduct( $id=false){
if(!$id) exit;
//@toDo here
}
function deleteProduct(){
//@toDo here
}
/**
* DELETE a Product
* /admin/products/#{id}.xml
**/
//######################################################## PRODUCT-IMAGES ########################################################################################
/**
* Receive a list of all Product Images
* Get all product images
*
* GET /admin/products/#{id}/images.xml
* Get all product images for a product
**/
function getProductImages(){
//@toDo
}
/**
* Receive a single Product Image
* Get a single product image by id
*
* GET /admin/products/#{id}/images/#{id}.xml
* Show product image
**/
function getProductImage( $id = false ){
//@toDo
}
/**
* Create a new Product Image
* Create a new product image
*
* POST /admin/products/#{id}/images.xml
* Create a new product image using a source URL that will be downloaded by Shopify
**/
function createProductImage(){
//@toDo
}
/**
* Remove a Product Image from the database
* DELETE /admin/products/#{id}/images/#{id}.xml
* Delete a product image
**/
function deleteProducImage(){
//@toDo
}
//######################################################## PRODUCT-VARIANT ########################################################################################
/**
* Receive a list of all Product Variants
* Get a list of product variants
*
* GET /admin/products/#{id}/variants.xml
* Get all variants for a product
**/
function getProductVariants(){
//@toDo
}
/**
* Receive a single Product Variant
* Get a single product variant by id
*
* GET /admin/products/#{id}/variants/#{id}.xml
* Get a product variant by id
**/
function getProductVariant( $id = false){
//@toDo
}
/**
* Receive a count of all Product Variants
* Get a count of product variants
*
* GET /admin/products/#{id}/variants/count.xml
* Count all variants for a product
**/
function countProductsVariants(){
//@toDo
}
/**
* Create a new Product Variant
* Create a new product variant
*
* POST /admin/products/#{id}/variants.xml
* Create a new product variant
**/
function createProductVariant( $id = false ){
//@toDo
}
/**
* Modify an existing Product Variant
* Update an existing product variant
*
* PUT /admin/products/#{id}/variants/#{id}.xml
* Update the inventory count an existing variant
**/
function updateProductVariant(){
//@toDo
}
/**
* Remove a Product Variant from the database
* DELETE /admin/products/#{id}/variants/#{id}.xml
* Delete a product variant
**/
function deleteProductVariant( $id = false ){
}
//######################################################## COLLECTIONS ########################################################################################
/**
* Receive a list of all Collects
* List all collects or only those for specific products or collections
*
* GET: /admin/collects.xml
* List all collects for your shop
*
* GET /admin/collects.xml?collection_id=841564295
* List only collects for a certain collection
*
* GET /admin/collects.xml?product_id=632910392
* List only collects for a certain product
**/
function getCollections( $collection_id = false ){
$api_url = "/admin/collects.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Receive a count of all Collects
* Get a count of all collects or only those for specific products or collections
*
* GET /admin/collects/count.xml
* Count all collects for your shop
*
* GET /admin/collects/count.xml?collection_id=841564295
* Count only collects for a certain collection
*
* GET /admin/collects/count.xml?product_id=632910392
* Count only collects for a certain product
**/
function countCollections($collection_id = false, $product_id = false){
$api_url = "/admin/collects/count.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Receive a single Collect
* Get the collect with a certain id, or for a given product AND collection
*
* GET /admin/collects/#{id}.xml
* Return a collect with a certain id
**/
function getCollection(){
//@toDo
}
/**
* Create a new Collect
* Add a product to a collection
*
* POST /admin/collects.xml
* Create a new link between an existing product an an existing collection
*
* REQUEST:
* <?xml version="1.0" encoding="UTF-8"?>
* <collect>
* <product-id type="integer">921728736</product-id>
* <collection-id type="integer">841564295</collection-id>
* </collect>
**/
function createCollection(){
//@toDo
}
/**
* Remove a Collect from the database
* Remove a product from a collection
*
* DELETE /admin/collects/#{id}.xml
* Destroy the link between a product an a collection
**/
function deleteCollection( $id = false){
//@toDo
}
//######################################################## CUSTOM COLLECTIONS ########################################################################################
/**
* Receive a list of all CustomCollections
* Get a list of all custom collections that contain a given product
*
* Available URL Query parameters:
*
* limit — Amount of results (default: 50) (maximum: 250)
* page — Page to show (default: 1)
* title — Show custom collections with given title
* product_id — Show custom collections that includes given product
* updated_at_min — Show custom collections last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Show custom collections last updated before date (format: 2008-01-01 03:00)
* GET /admin/custom_collections.xml
* List all collections
**/
function getCustomCollections(){
$api_url = "/admin/custom_collections.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* getCollectionCount
* Available URL Query parameters:
*
* title — Count custom collections with given title
* product_id — Count custom collections that includes given product
* updated_at_min — Count custom collections last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Count custom collections last updated before date (format: 2008-01-01 03:00)
* GET /admin/custom_collections/count.xml
*
* GET /admin/custom_collections/count.xml?product_id=632910392
*Count all custom collections for a certain product_id
*/
function countCustomCollections( $title = false, $product_id = false, $updated_at_min = false, $updated_at_max = false ){
$api_url = "/admin/custom_collections/count.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Receive a single CustomCollection
* Get a single custom collection
*
* GET /admin/custom_collections/#{id}.xml
* Get a specific collection by ID
**/
function getCustomCollection(){
//@toDo
}
/**
* Create a new CustomCollection
* Create a new custom collection
*
* POST /admin/custom_collections.xml
* Create a collection with title Macbooks
*
* Request
*
*
* <?xml version="1.0" encoding="UTF-8"?>
* <custom-collection>
* <title>Macbooks</title>
* </custom-collection>
**/
function createCustomCollection(){
//@toDo
}
/**
* Modify an existing CustomCollection
* Update an existing custom collection
*
* PUT /admin/custom_collections/#{id}.xml
* Change the description of the IPod collection
*
* Request
*
*
* <?xml version="1.0" encoding="UTF-8"?>
* <custom-collection>
* <handle>ipods</handle>
* <body-html><p>5000 songs in your pocket</p></body-html>
* <template-suffix nil="true"></template-suffix>
* <title>IPods</title>
* <updated-at type="datetime">2008-02-02T00:00:00Z</updated-at>
* <sort-order>manual</sort-order>
* <id type="integer">841564295</id>
* <published-at type="datetime">2008-02-02T00:00:00Z</published-at>
* </custom-collection>
**/
/**
* PUT /admin/custom_collections/#{id}.xml
* Show a hidden collection by changing the published attribute to true
*
* Request
*
*
* <?xml version="1.0" encoding="UTF-8"?>
* <custom-collection>
* <published type="boolean">true</published>
* <id type="integer">841564295</id>
* </custom-collection>
**/
function updateCustomCollection(){
//@toDo
}
/**
* Remove a CustomCollection from the database
* DELETE /admin/custom_collections/#{id}.xml
* Remove ipod custom collection
**/
function deleteCustomCollection(){
//@toDo
}
//######################################################## SMART COLLECTION ########################################################################################
/**
* Receive a list of all SmartCollections
* Get a list of all smart collections that contain a given product
*
* Available URL Query parameters:
*
* limit — Amount of results (default: 50) (maximum: 250)
* page — Page to show (default: 1)
* title — Show custom collections with given title
* product_id — Show custom collections that includes given product
* updated_at_min — Show custom collections last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Show custom collections last updated before date (format: 2008-01-01 03:00)
* GET /admin/smart_collections.xml
* List all collections
**/
function getSmartCollections(){
//@toDo
}
/**
* GET /admin/smart_collections.xml?product_id=632910392
* List all smart collections for a certain product_id
*
* Response
**/
function getProductSmartCollections(){
//@toDo
}
/**
* Receive a count of all SmartCollections
* Get a count of all smart collections that contain a given product
*
* Available URL Query parameters:
*
* title — Show custom collections with given title
* product_id — Show custom collections that includes given product
* updated_at_min — Show custom collections last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Show custom collections last updated before date (format: 2008-01-01 03:00)
* GET /admin/smart_collections/count.xml
* Count all collections
**/
function countSmartColletions(){
//@toDo
}
/**
* Receive a single SmartCollection
* Get a single smart collection
*
* GET /admin/smart_collections/#{id}.xml
* Get a specific collection by ID
**/
function getSmartCollection(){
//@toDo
}
/**
* Create a new SmartCollection
* Create a new smart collection.
* Valid values for Rule fields:
*
* column - title, type, vendor, variant_price, variant_compare_at_price, variant_weight, variant_inventory, variant_title
* relation - equals, greater_than, less_than, starts_with, ends_with, contains
* condition - any string
* POST /admin/smart_collections.xml
* Create a collection of all products starting with the term IPod
**/
function createSmartCollection(){
//@toDo
}
/**
* Modify an existing SmartCollection
* Update an existing smart collection
*
* PUT /admin/smart_collections/#{id}.xml
* Change the description of the Smart iPods collection
**/
function updateSmartCollection(){
//@toDo
}
/**
* Remove a SmartCollection from the database
* DELETE /admin/smart_collections/#{id}.xml
* Remove Smart iPods smart collection
**/
function deleteSmartCollection(){
//@toDo
}
//######################################################## ASSETS ########################################################################################
/**
* Receive a list of all Assets
* Listing theme assets does not return their contents. In order to access the contents of assets, you must request them individually.
*
* GET /admin/assets.xml
* Get a list of all theme assets
*
**/
function getAssets(){
$api_url = "/admin/assets.xml";
return $this->__process( $this->Http->get( $this->__apicall( $api_url ), false, $this->__getAuthHeader( ) ) );
}
/**
* Receive a single Asset
* There are different buckets which hold different kinds of assets, each corresponding to one of the folders within a theme's zip file: layout, templates, and assets.
* The full key of an asset always starts with the bucket name, and the path separator is a forward slash, like layout/theme.liquid or assets/bg-body.gif.
*
* GET /admin/assets.xml?asset[key]=templates/index.liquid
**/
function getAsset(){
//@toDo
}
/**
* Creating or Modifying an Asset
* PUT takes care of both creating new assets and updating existing ones
*
* PUT /admin/assets.xml
* Change an existing liquid template's value
*
*
* REQUEST:
* <?xml version="1.0" encoding="UTF-8"?>
* <asset>
* <value><img src='backsoon-postit.png'><p>We are busy updating the store for you and will be back within the hour.</p></value>
* <key>templates/index.liquid</key>
* </asset>
*
* See all samples here: http://api.shopify.com/asset.html
**/
function updateAsset(){
//@toDo
}
/**
* Remove a Asset from the database
* Remove assets from your shop
*
* DELETE /admin/assets.xml?asset[key]=assets/bg-body.gif
* Delete an image from your theme
**/
function deleteAsset(){
//@toDo
}
//######################################################## BLOGS ########################################################################################
/**
* Available URL Query parameters:
*
* limit — Amount of results (default: 50) (maximum: 250)
* page — Page to show (default: 1)
* created_at_min — Show articles created after date (format: 2008-01-01 03:00)
* created_at_max — Show articles created before date (format: 2008-01-01 03:00)
* updated_at_min — Show articles last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Show articles last updated before date (format: 2008-01-01 03:00)
* published_at_min — Show articles published after date (format: 2008-01-01 03:00)
* published_at_max — Show articles published before date (format: 2008-01-01 03:00)
* published_status
* published - Show only published articles
* unpublished - Show only unpublished articles
* any - Show all articles (default)
* GET /admin/blogs/#{id}/articles.xml
*/
/**
* Blog
**/
function getBlogs(){
return $this->__process( $this->Http->get( $this->__apicall('/admin/blogs.xml'), false, $this->__getAuthHeader( ) ) );
}
function countBlogs(){
return $this->__process( $this->Http->get( $this->__apicall('/admin/blogs/count.xml'), false, $this->__getAuthHeader( ) ) );
}
function getSingleBlog($id=false ) {
$url = "/admin/blogs";
if($id != false) {
$url .= "/{$id}.xml";
} else {
$url .= ".xml";
}
return $this->__process( $this->Http->get( $this->__apicall( $url ), false, $this->__getAuthHeader( ) ) );
}
//######################################################## ARTICLE ########################################################################################
/**
* Shopify API – Article
*
* top
* Receive a list of all Articles
* Get a list of all articles from a certain blog
*
* Available URL Query parameters:
*
* limit — Amount of results (default: 50) (maximum: 250)
* page — Page to show (default: 1)
* created_at_min — Show articles created after date (format: 2008-01-01 03:00)
* created_at_max — Show articles created before date (format: 2008-01-01 03:00)
* updated_at_min — Show articles last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Show articles last updated before date (format: 2008-01-01 03:00)
* published_at_min — Show articles published after date (format: 2008-01-01 03:00)
* published_at_max — Show articles published before date (format: 2008-01-01 03:00)
* published_status
* published - Show only published articles
* unpublished - Show only unpublished articles
* any - Show all articles (default)
* GET: /admin/blogs/#{id}/articles.xml
*/
function getArticles( $id=false){
//@toDo
}
/**
* Receive a count of all Articles
* Get a count of all articles from a certain blog
*
* Available URL Query parameters:
*
* created_at_min — Count articles created after date (format: 2008-01-01 03:00)
* created_at_max — Count articles created before date (format: 2008-01-01 03:00)
* updated_at_min — Count articles last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Count articles last updated before date (format: 2008-01-01 03:00)
* published_at_min — Count articles published after date (format: 2008-01-01 03:00)
* published_at_max — Count articles published before date (format: 2008-01-01 03:00)
* published_status
* published - Count only published articles
* unpublished - Count only unpublished articles
* any - Count all articles (default)
* GET /admin/blogs/#{id}/articles/count.xml
*/
function countArticles(){
//@toDo
}
/**
* Receive a single Article
* Get a single article by its ID and the ID of the parent blog
*
* GET /admin/blogs/#{id}/articles/#{id}.xml
* Get a single article
*/
function getArticle( $id=false){
//@toDo
}
/**
* Create a new Article
* Create a new article for a blog
*
* POST /admin/blogs/#{id}/articles.xml
* Create a new article with html markup and upload it to a blog.
**/
function createArticle(){
//@toDo
}
/**
* Create a new Article
* Create a new article for a blog
*
* POST /admin/blogs/#{id}/articles.xml
* Create a new article with html markup and upload it to a blog.
**/
function updateArticle(){
//@toDo
}
/**
* Remove a Article from the database
* Delete an article of a blog
*
* DELETE /admin/blogs/#{id}/articles/#{id}.xml
* Remove an exisiting article from a blog
**/
function deleteArticle(){
//@toDo
}
//######################################################## COMMENTS ########################################################################################
/**
* RECEIVE A LIST OF ALL COMMENTS
* Get a list of all comments for an article
*
* Available URL Query parameters:
*
* limit — Amount of results (default: 50) (maximum: 250)
* page — Page to show (default: 1)
* created_at_min — Show comments created after date (format: 2008-01-01 03:00)
* created_at_max — Show comments created before date (format: 2008-01-01 03:00)
* updated_at_min — Show comments last updated after date (format: 2008-01-01 03:00)
* updated_at_max — Show comments last updated before date (format: 2008-01-01 03:00)
* published_at_min — Show comments published after date (format: 2008-01-01 03:00)
* published_at_max — Show comments published before date (format: 2008-01-01 03:00)