An open API service indexing awesome lists of open source software.

https://github.com/friendsofshopware/go-shopware-admin-api-sdk

Go SDK for the Shopware 6 Admin API
https://github.com/friendsofshopware/go-shopware-admin-api-sdk

Last synced: over 1 year ago
JSON representation

Go SDK for the Shopware 6 Admin API

Awesome Lists containing this project

README

          

# SDK for the Shopware 6 Admin API

See example folder

## Create a client

### Password

```go
ctx := context.Background()

// Create a using password grant
creds := sdk.NewPasswordCredentials("", "", []string{"write"})
client, err := sdk.NewApiClient(ctx, "", creds, nil)
```

### Integration

```go
ctx := context.Background()

// Create a using password grant
creds := sdk.NewIntegrationCredentials("", "", []string{"write"})
client, err := sdk.NewApiClient(ctx, "", creds, nil)
```

## Usage of a repository

### Search

```go
apiContext := sdk.NewApiContext(ctx)
criteria := sdk.Criteria{}

collection, _, _ := client.Repository.Tax.Search(apiContext, criteria)

for _, tax := range collection.Data {
fmt.Println(tax.Name)
}
```

### Create/Update

```go
apiContext := sdk.NewApiContext(ctx)
client.Repository.Tax.Upsert(apiContext, []sdk.Tax{
{TaxRate: 15, Name: "15%"},
})
```

### Delete

```go
apiContext := sdk.NewApiContext(ctx)
client.Repository.Tax.Delete(apiContext, []string{"someid"})
```