func New(codebase string) *Client { if strings.HasSuffix(codebase, "/") { codebase = codebase[0 : len(codebase)-1] } return &Client{ codebase: codebase, api: httpctx.NewClient(), Download: downloadFunc(nil), log: noOpLog, } }
func (d *Device) FetchDeviceInfo(ctx context.Context) (*DeviceInfo, error) { var data []byte uri := fmt.Sprintf("http://%s/setup.xml", d.Host) err := httpctx.NewClient().Get(ctx, uri, nil, &data) if err != nil { return nil, err } deviceInfo, err := unmarshalDeviceInfo(data) if err != nil { return nil, err } deviceInfo.Device = d return deviceInfo, nil }