1// Code generated by go-swagger; DO NOT EDIT.
2
3// Copyright Prometheus Team
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package receiver
18
19// This file was generated by the swagger tool.
20// Editing this file might prove futile when you re-run the swagger generate command
21
22import (
23	"fmt"
24
25	"github.com/go-openapi/runtime"
26	"github.com/go-openapi/strfmt"
27)
28
29// New creates a new receiver API client.
30func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
31	return &Client{transport: transport, formats: formats}
32}
33
34/*
35Client for receiver API
36*/
37type Client struct {
38	transport runtime.ClientTransport
39	formats   strfmt.Registry
40}
41
42// ClientService is the interface for Client methods
43type ClientService interface {
44	GetReceivers(params *GetReceiversParams) (*GetReceiversOK, error)
45
46	SetTransport(transport runtime.ClientTransport)
47}
48
49/*
50  GetReceivers Get list of all receivers (name of notification integrations)
51*/
52func (a *Client) GetReceivers(params *GetReceiversParams) (*GetReceiversOK, error) {
53	// TODO: Validate the params before sending
54	if params == nil {
55		params = NewGetReceiversParams()
56	}
57
58	result, err := a.transport.Submit(&runtime.ClientOperation{
59		ID:                 "getReceivers",
60		Method:             "GET",
61		PathPattern:        "/receivers",
62		ProducesMediaTypes: []string{"application/json"},
63		ConsumesMediaTypes: []string{"application/json"},
64		Schemes:            []string{"http"},
65		Params:             params,
66		Reader:             &GetReceiversReader{formats: a.formats},
67		Context:            params.Context,
68		Client:             params.HTTPClient,
69	})
70	if err != nil {
71		return nil, err
72	}
73	success, ok := result.(*GetReceiversOK)
74	if ok {
75		return success, nil
76	}
77	// unexpected success response
78	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
79	msg := fmt.Sprintf("unexpected success response for getReceivers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
80	panic(msg)
81}
82
83// SetTransport changes the transport on the client
84func (a *Client) SetTransport(transport runtime.ClientTransport) {
85	a.transport = transport
86}
87