github.com/mysteriumnetwork/node@v0.0.0-20240516044423-365054f76801/tequilapi/contract/ui.go (about)

     1  /*
     2   * Copyright (C) 2021 The "MysteriumNetwork/node" Authors.
     3   *
     4   * This program is free software: you can redistribute it and/or modify
     5   * it under the terms of the GNU General Public License as published by
     6   * the Free Software Foundation, either version 3 of the License, or
     7   * (at your option) any later version.
     8   *
     9   * This program is distributed in the hope that it will be useful,
    10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12   * GNU General Public License for more details.
    13   *
    14   * You should have received a copy of the GNU General Public License
    15   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16   */
    17  
    18  package contract
    19  
    20  import (
    21  	"github.com/mysteriumnetwork/go-rest/apierror"
    22  	"github.com/mysteriumnetwork/node/ui/versionmanager"
    23  )
    24  
    25  // LocalVersionsResponse local version response
    26  // swagger:model LocalVersionsResponse
    27  type LocalVersionsResponse struct {
    28  	Versions []versionmanager.LocalVersion `json:"versions"`
    29  }
    30  
    31  // RemoteVersionsResponse local version response
    32  // swagger:model RemoteVersionsResponse
    33  type RemoteVersionsResponse struct {
    34  	Versions []versionmanager.RemoteVersion `json:"versions"`
    35  }
    36  
    37  // DownloadNodeUIRequest request for downloading NodeUI version
    38  // swagger:model DownloadNodeUIRequest
    39  type DownloadNodeUIRequest struct {
    40  	Version string `json:"version"`
    41  }
    42  
    43  // Valid validate DownloadNodeUIRequest
    44  func (s *DownloadNodeUIRequest) Valid() *apierror.APIError {
    45  	v := apierror.NewValidator()
    46  	if s.Version == "" {
    47  		v.Required("version")
    48  	}
    49  	return v.Err()
    50  }
    51  
    52  // SwitchNodeUIRequest request for switching NodeUI version
    53  // swagger:model SwitchNodeUIRequest
    54  type SwitchNodeUIRequest struct {
    55  	Version string `json:"version"`
    56  }
    57  
    58  // Valid validate SwitchNodeUIRequest
    59  func (s *SwitchNodeUIRequest) Valid() *apierror.APIError {
    60  	v := apierror.NewValidator()
    61  	if s.Version == "" {
    62  		v.Required("version")
    63  	}
    64  	return v.Err()
    65  }
    66  
    67  // UI ui information
    68  // swagger:model UI
    69  type UI struct {
    70  	BundledVersion string `json:"bundled_version"`
    71  	UsedVersion    string `json:"used_version"`
    72  }