asset_client.go raw

   1  package asset
   2  
   3  import (
   4  	"github.com/liquidweb/liquidweb-cli/types/api"
   5  	liquidweb "github.com/liquidweb/liquidweb-go"
   6  )
   7  
   8  // AssetBackend is the interface for assets.
   9  type AssetBackend interface {
  10  	Details(string) (*apiTypes.Subaccnt, error)
  11  }
  12  
  13  // AssetClient is the API client for storm servers.
  14  type AssetClient struct {
  15  	Backend liquidweb.Backend
  16  }
  17  
  18  // Details fetches the details of an asset.
  19  func (c *AssetClient) Details(id string) (*apiTypes.Subaccnt, error) {
  20  	var result apiTypes.Subaccnt
  21  	args := map[string]interface{}{
  22  		"uniq_id": id,
  23  	}
  24  
  25  	err := c.Backend.CallIntoInterface("bleed/asset/details", args, &result)
  26  	if err != nil {
  27  		return nil, err
  28  	}
  29  
  30  	return &result, nil
  31  }
  32