Graphql.php 1.1 KB
Newer Older
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
<?php
/**
 * Created by PhpStorm.
 * User: Zero
 * Date: 2021/01/08
 * Time: 09:34:30
 */

namespace Meibuyu\Micro\Shopify\lib;

use Exception;
use Meibuyu\Micro\Shopify\tools\HttpRequestGraphQL;

/**
 * Class Graphql
 * @package Meibuyu\Micro\Shopify\lib
 */
class Graphql extends AbstractShopify
{

    protected $resourceKey = 'graphql';

    protected $pluralizeKey = 'graphql';

    public function post($graphQL, $url = null, $wrapData = false, $variables = null)
    {
        if (!$url) $url = $this->generateUrl();
        $response = HttpRequestGraphQL::post($url, $graphQL, $this->httpHeaders, $variables);
29
        return $this->processResponseOld($response);
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    }

    public function get($urlParams = array(), $url = null, $dataKey = null)
    {
        throw new Exception("GraphQL 只支持 POST 请求!");
    }

    public function put($id, $dataArray, $url = null, $wrapData = true)
    {
        throw new Exception("GraphQL 只支持 POST 请求!");
    }

    public function delete($id = null, $urlParams = [], $url = null)
    {
        throw new Exception("GraphQL 只支持 POST 请求!");
    }

}