github.com/apptainer/singularity@v3.1.1+incompatible/pkg/client/library/response.go (about)

     1  // Copyright (c) 2018, Sylabs Inc. All rights reserved.
     2  // This software is licensed under a 3-clause BSD license. Please consult the
     3  // LICENSE.md file distributed with the sources of this project regarding your
     4  // rights to use or distribute this software.
     5  
     6  package client
     7  
     8  // JSONError - Struct for standard error returns over REST API
     9  type JSONError struct {
    10  	Code    int    `json:"code,omitempty"`
    11  	Status  string `json:"status,omitempty"`
    12  	Message string `json:"message,omitempty"`
    13  }
    14  
    15  // JSONResponse - Top level container of a REST API response
    16  type JSONResponse struct {
    17  	Data  interface{} `json:"data"`
    18  	Error JSONError   `json:"error,omitempty"`
    19  }
    20  
    21  // EntityResponse - Response from the API for an Entity request
    22  type EntityResponse struct {
    23  	Data  Entity    `json:"data"`
    24  	Error JSONError `json:"error,omitempty"`
    25  }
    26  
    27  // CollectionResponse - Response from the API for an Collection request
    28  type CollectionResponse struct {
    29  	Data  Collection `json:"data"`
    30  	Error JSONError  `json:"error,omitempty"`
    31  }
    32  
    33  // ContainerResponse - Response from the API for an Container request
    34  type ContainerResponse struct {
    35  	Data  Container `json:"data"`
    36  	Error JSONError `json:"error,omitempty"`
    37  }
    38  
    39  // ImageResponse - Response from the API for an Image request
    40  type ImageResponse struct {
    41  	Data  Image     `json:"data"`
    42  	Error JSONError `json:"error,omitempty"`
    43  }
    44  
    45  // TagsResponse - Response from the API for a tags request
    46  type TagsResponse struct {
    47  	Data  TagMap    `json:"data"`
    48  	Error JSONError `json:"error,omitempty"`
    49  }
    50  
    51  // SearchResults - Results structure for searches
    52  type SearchResults struct {
    53  	Entities    []Entity     `json:"entity"`
    54  	Collections []Collection `json:"collection"`
    55  	Containers  []Container  `json:"container"`
    56  }
    57  
    58  // SearchResponse - Response from the API for a search request
    59  type SearchResponse struct {
    60  	Data  SearchResults `json:"data"`
    61  	Error JSONError     `json:"error,omitempty"`
    62  }