Skip to content

Improvements #2

Description

@gnikyt
  1. Will add a setSession shortcut which will allow for passing of shop domain and shop token. Simply a quicker and less verbose method

  2. Will add a withSession which will be similar to setSession however it will accept a closure to do work.

Example:

// Do stuff for shop1
$api->withSession('shop1.myshopify.com', 'abc', function() {
    // $this will reference a new instance of BasicShopifyAPI automatically injected
    $request = $this->request('GET', '/admin/shop.json');
    print $request->body->shop->name; // Shop 1
});

// Do stuff for shop2
$api->withSession('shop2.myshopify.com', 'abc', function() {
    $request = $this->request('GET', '/admin/shop.json');
    print $request->body->shop->name; // Shop 2
});

Each will be isolated instances.

Will try to code this in next week! As well as fix the open issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions