From c4584dde943423b851b972d911942e4e48a30ad3 Mon Sep 17 00:00:00 2001 From: michealroberts Date: Mon, 25 Nov 2024 14:31:17 +0000 Subject: [PATCH] feat: add NewSIMBADServiceClient to catalog module in @observerly/skysolve feat: add NewSIMBADServiceClient to catalog module in @observerly/skysolve --- pkg/catalog/simbad.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pkg/catalog/simbad.go b/pkg/catalog/simbad.go index e85d22f..ce308b9 100644 --- a/pkg/catalog/simbad.go +++ b/pkg/catalog/simbad.go @@ -11,6 +11,9 @@ package catalog /*****************************************************************************************************************/ import ( + "net/url" + "time" + "github.com/observerly/skysolve/pkg/adql" ) @@ -32,3 +35,28 @@ type SIMBADServiceClient struct { } /*****************************************************************************************************************/ + +func NewSIMBADServiceClient() *SIMBADServiceClient { + // https://simbad.unistra.fr/simbad/sim-tap/sync + url := url.URL{ + Scheme: "https", + Host: "simbad.unistra.fr", + Path: "/simbad/sim-tap/sync", + } + + headers := map[string]string{ + // Default content type for TAP services + "Content-Type": "application/x-www-form-urlencoded", + // Ensure we are good citizens and identify ourselves: + "X-Requested-By": "@observerly/skysolve", + } + + client := adql.NewTapClient(url, 60*time.Second, headers) + + return &SIMBADServiceClient{ + TapClient: client, + Query: SIMBADQuery{}, + } +} + +/*****************************************************************************************************************/