-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastroapi.go
More file actions
50 lines (40 loc) · 1.61 KB
/
astroapi.go
File metadata and controls
50 lines (40 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Package astroapi provides the Go client for the Astrology API v3.
//
// # Quick Start
//
// client := astroapi.NewClient(
// option.WithAPIKey("your-api-key"),
// )
//
// // Get current planetary positions
// now, err := client.Data.GetNow(context.Background())
//
// # Environment Variables
//
// - ASTROLOGY_API_KEY: your API key
// - ASTROLOGY_API_BASE_URL: override the base URL (default: https://api.astrology-api.io)
package astroapi
import (
"github.com/astro-api/astroapi-go/categories/data"
"github.com/astro-api/astroapi-go/internal/apijson"
)
// Field is a generic optional/nullable field type. Use F() to set a value
// and Null() to explicitly set null.
type Field[T any] = apijson.Field[T]
// F creates a Field[T] with the given value.
func F[T any](v T) Field[T] { return apijson.F(v) }
// Null creates a Field[T] that marshals to JSON null.
func Null[T any]() Field[T] { return apijson.Null[T]() }
// String returns a Field[string] set to the given value.
func String(v string) Field[string] { return apijson.F(v) }
// Int returns a Field[int] set to the given value.
func Int(v int) Field[int] { return apijson.F(v) }
// Float returns a Field[float64] set to the given value.
func Float(v float64) Field[float64] { return apijson.F(v) }
// Bool returns a Field[bool] set to the given value.
func Bool(v bool) Field[bool] { return apijson.F(v) }
// DataPositionsParams is a convenience alias to avoid needing to import
// the data sub-package in simple usage.
type DataPositionsParams = data.PositionsParams
// DataLunarMetricsParams is a convenience alias.
type DataLunarMetricsParams = data.LunarMetricsParams