func (c *LocationClient) Get(ctx context.Context, idOrName string) (*Location, *Response, error) {
	if id, err := strconv.Atoi(idOrName); err == nil {
		return c.GetByID(ctx, int(id))
	}
	return c.GetByName(ctx, idOrName)
}
Get retrieves a location by its ID if the input can be parsed as an integer, otherwise it retrieves a location by its name.
package hcloud
import (
	"context"
	"fmt"
	"net/url"
	"strconv"
	"github.com/hetznercloud/hcloud-go/hcloud/schema"
)
type Location struct {
	ID          int
	Name        string
	Description string
	Country     string
	City        string
	Latitude    float64
	Longitude   float64
}
type LocationClient struct {
	client *Client
}
func (c *LocationClient) GetByID(ctx context.Context, id int) (*Location, *Response, error) {
	req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("/locations/%d", id), nil)
	if err != nil {
		return nil, nil, err
	}
	var body schema.LocationGetResponse
	resp, err := c.client.Do(req, &body)
	if err != nil {
		if IsError(err, ErrorCodeNotFound) {
			return nil, resp, nil
		}
		return nil, resp, err
	}
	return LocationFromSchema(body.Location), resp, nil
}
func (c *LocationClient) GetByName(ctx context.Context, name string) (*Location, *Response, error) {
	path := "/locations?name=" + url.QueryEscape(name)
	req, err := c.client.NewRequest(ctx, "GET", path, nil)
	if err != nil {
		return nil, nil, err
	}
	var body schema.LocationListResponse
	resp, err := c.client.Do(req, &body)
	if err != nil {
		return nil, nil, err
	}
	if len(body.Locations) == 0 {
		return nil, resp, nil
	}
	return LocationFromSchema(body.Locations[0]), resp, nil
}