github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/clients/client_configurations/client__generated.go (about)

     1  package client_configurations
     2  
     3  import (
     4  	"fmt"
     5  
     6  	github_com_johnnyeven_libtools_courier "github.com/johnnyeven/libtools/courier"
     7  	github_com_johnnyeven_libtools_courier_client "github.com/johnnyeven/libtools/courier/client"
     8  	github_com_johnnyeven_libtools_courier_status_error "github.com/johnnyeven/libtools/courier/status_error"
     9  )
    10  
    11  type ClientConfigurationsInterface interface {
    12  	BatchCreateConfig(req BatchCreateConfigRequest, metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *BatchCreateConfigResponse, err error)
    13  	CreateConfig(req CreateConfigRequest, metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *CreateConfigResponse, err error)
    14  	GetConfigurations(req GetConfigurationsRequest, metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *GetConfigurationsResponse, err error)
    15  }
    16  
    17  type ClientConfigurations struct {
    18  	github_com_johnnyeven_libtools_courier_client.Client
    19  }
    20  
    21  func (ClientConfigurations) MarshalDefaults(v interface{}) {
    22  	if cl, ok := v.(*ClientConfigurations); ok {
    23  		cl.Name = "configurations"
    24  		cl.Client.MarshalDefaults(&cl.Client)
    25  	}
    26  }
    27  
    28  func (c ClientConfigurations) CheckService() {
    29  	err := c.Request(c.Name+".Check", "HEAD", "/", nil).
    30  		Do().
    31  		Into(nil)
    32  	statusErr := github_com_johnnyeven_libtools_courier_status_error.FromError(err)
    33  	if statusErr.Code == int64(github_com_johnnyeven_libtools_courier_status_error.RequestTimeout) {
    34  		panic(fmt.Errorf("service %s have some error %s", c.Name, statusErr))
    35  	}
    36  }
    37  
    38  type BatchCreateConfigRequest struct {
    39  	//
    40  	Body []CreateConfigurationBody `fmt:"json" in:"body"`
    41  }
    42  
    43  func (c ClientConfigurations) BatchCreateConfig(req BatchCreateConfigRequest, metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *BatchCreateConfigResponse, err error) {
    44  	resp = &BatchCreateConfigResponse{}
    45  	resp.Meta = github_com_johnnyeven_libtools_courier.Metadata{}
    46  
    47  	err = c.Request(c.Name+".BatchCreateConfig", "POST", "/configurations/v0/configurations/0/batch", req, metas...).
    48  		Do().
    49  		BindMeta(resp.Meta).
    50  		Into(&resp.Body)
    51  
    52  	return
    53  }
    54  
    55  type BatchCreateConfigResponse struct {
    56  	Meta github_com_johnnyeven_libtools_courier.Metadata
    57  	Body []byte
    58  }
    59  
    60  type CreateConfigRequest struct {
    61  	//
    62  	Body CreateConfigurationBody `fmt:"json" in:"body"`
    63  }
    64  
    65  func (c ClientConfigurations) CreateConfig(req CreateConfigRequest, metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *CreateConfigResponse, err error) {
    66  	resp = &CreateConfigResponse{}
    67  	resp.Meta = github_com_johnnyeven_libtools_courier.Metadata{}
    68  
    69  	err = c.Request(c.Name+".CreateConfig", "POST", "/configurations/v0/configurations", req, metas...).
    70  		Do().
    71  		BindMeta(resp.Meta).
    72  		Into(&resp.Body)
    73  
    74  	return
    75  }
    76  
    77  type CreateConfigResponse struct {
    78  	Meta github_com_johnnyeven_libtools_courier.Metadata
    79  	Body []byte
    80  }
    81  
    82  type GetConfigurationsRequest struct {
    83  	// 分页偏移
    84  	// 默认为 0
    85  	Offset int32 `in:"query" name:"offset,omitempty"`
    86  	// StackID
    87  	StackID uint64 `in:"query" name:"stackID"`
    88  	// 分页大小
    89  	// 默认为 10,-1 为查询所有
    90  	Size int32 `default:"10" in:"query" name:"size,omitempty"`
    91  }
    92  
    93  func (c ClientConfigurations) GetConfigurations(req GetConfigurationsRequest, metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *GetConfigurationsResponse, err error) {
    94  	resp = &GetConfigurationsResponse{}
    95  	resp.Meta = github_com_johnnyeven_libtools_courier.Metadata{}
    96  
    97  	err = c.Request(c.Name+".GetConfigurations", "GET", "/configurations/v0/configurations", req, metas...).
    98  		Do().
    99  		BindMeta(resp.Meta).
   100  		Into(&resp.Body)
   101  
   102  	return
   103  }
   104  
   105  type GetConfigurationsResponse struct {
   106  	Meta github_com_johnnyeven_libtools_courier.Metadata
   107  	Body GetConfigurationResult
   108  }
   109  
   110  func (c ClientConfigurations) Swagger(metas ...github_com_johnnyeven_libtools_courier.Metadata) (resp *SwaggerResponse, err error) {
   111  	resp = &SwaggerResponse{}
   112  	resp.Meta = github_com_johnnyeven_libtools_courier.Metadata{}
   113  
   114  	err = c.Request(c.Name+".Swagger", "GET", "/configurations", nil, metas...).
   115  		Do().
   116  		BindMeta(resp.Meta).
   117  		Into(&resp.Body)
   118  
   119  	return
   120  }
   121  
   122  type SwaggerResponse struct {
   123  	Meta github_com_johnnyeven_libtools_courier.Metadata
   124  	Body JSONBytes
   125  }