Skip to content

Commit

Permalink
Merge pull request #2 from 8fold/initial
Browse files Browse the repository at this point in the history
update: Read me
  • Loading branch information
joshbruce authored Apr 30, 2023
2 parents bf45932 + 1dcb11b commit 885f7e8
Showing 1 changed file with 1 addition and 118 deletions.
119 changes: 1 addition & 118 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,124 +10,7 @@

## Usage

### Initialize Client

```php
use Eightfold\Printify\Client;
use Eightfold\Printify\Printify;

$client = Client::connect(
Printify::account({'your Printify access token'})
);
```

### Use Client

The Client is the recommended entry point and leverages a fluent approach.

**Retrieve a list of shops in a Printify account**

```php
// API call
$client->getShops();
```

*Retrieve a single shop (from the list of shops)*

```php
// API call
$client->getShop({shop id});
```

*Retrieve a Shop instance (supports lazy loading)*

```php
// No API call
$shop = $client->shop({shop id});

$shop->id();

// API call
$shop->title();
```

**Retrieve a list of products in a Shop**

```php
// API call
$client->getProducts($shop);
```

*Retrieve a single Product*

```php
// API call
$client->getProduct({product id});
```

*Retrieve a Product instance (supports lazy loading)*

```php
// No API call
$product = $client->getProduct($shop, {product id});

$product->id();

$product->shopId();

// API call
$product->title();

$product->description();

// and other properties
```

*Retrieve a collection of Variants for a Product*

```php
// API call
$variants = $product->variants();
```

*Retrieve a single Variant from a Product*

```php
// API call
$variant = $product->variants()->atIndex(0);

$variant = $product->variants()->variantWithId({variant id});
```

*Retrieve a collection of Images for a Product*

```php
$images = $product->images();
```

*Retrieve array of Images for a Variant*

```php
$images = $variant->images($product);

$images = $product->imagesForVariant($variant);
```

*Retrieve default Image for a Variant*

```php
$image = $variant->defaultImage($product);

$image = $product->defaultForVariant($variant);

$image = $product->imagesForVariant($variant, defaultOnly: true);
```

**Set Product publish status to succeeded**

```php
$client->postPublishingSucceededForProduct($product);
```
Still in progress. See tests for now.

## Details

Expand Down

0 comments on commit 885f7e8

Please sign in to comment.