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
- Host: GitHub
- URL: https://github.com/friendsofshopware/go-shopware-admin-api-sdk
- Owner: FriendsOfShopware
- License: mit
- Created: 2022-03-09T17:21:42.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-08T07:51:18.000Z (about 2 years ago)
- Last Synced: 2024-06-22T15:43:28.879Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 446 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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"})
```