instance.go
author convert-repo
Mon, 01 May 2017 12:29:23 +0000
changeset 167 b2cee3fad4fe
parent 155 0c581e0108da
child 207 301d5b94be3f
permissions -rw-r--r--
update tags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
130
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     1
/*
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     2
Copyright 2017 Mikael Berthe
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     3
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     4
Licensed under the MIT license.  Please see the LICENSE file is this directory.
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     5
*/
c450bb73f59a Update credits
Mikael Berthe <mikael@lilotux.net>
parents: 120
diff changeset
     6
138
23d3a518d0ad Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
     7
package madon
112
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
import (
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
	"github.com/sendgrid/rest"
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
)
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
// GetCurrentInstance returns current instance information
138
23d3a518d0ad Update package name in source files
Mikael Berthe <mikael@lilotux.net>
parents: 130
diff changeset
    14
func (mc *Client) GetCurrentInstance() (*Instance, error) {
112
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
	var i Instance
155
0c581e0108da Use links from headers
Mikael Berthe <mikael@lilotux.net>
parents: 149
diff changeset
    16
	if err := mc.apiCall("instance", rest.Get, nil, nil, nil, &i); err != nil {
120
579912e9d0ef Refactor API calls
Mikael Berthe <mikael@lilotux.net>
parents: 112
diff changeset
    17
		return nil, err
112
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
	}
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
	return &i, nil
467dd91bf1f9 Add GetCurrentInstance()
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
}