@@ -57,7 +57,7 @@ type Client struct {
5757
5858// NewClient creates a new Synkronus API client
5959func NewClient () * Client {
60- baseURL := strings . TrimRight ( utils .EnsureScheme (viper .GetString ("api.url" )), "/" )
60+ baseURL := utils .APIBaseURL (viper .GetString ("api.url" ))
6161 return & Client {
6262 BaseURL : baseURL ,
6363 APIVersion : viper .GetString ("api.version" ),
@@ -70,7 +70,7 @@ func NewClient() *Client {
7070// doRequest performs an HTTP request with authentication
7171// GetVersion retrieves version information from the Synkronus server
7272func (c * Client ) GetVersion () (* SystemVersionInfo , error ) {
73- req , err := http .NewRequest ("GET" , fmt .Sprintf ("%s/api/ version" , c .BaseURL ), nil )
73+ req , err := http .NewRequest ("GET" , fmt .Sprintf ("%s/version" , c .BaseURL ), nil )
7474 if err != nil {
7575 return nil , fmt .Errorf ("error creating version request: %w" , err )
7676 }
@@ -145,7 +145,7 @@ func (c *Client) GetAppBundleManifest() (map[string]interface{}, error) {
145145
146146// GetAppBundleVersions retrieves available app bundle versions
147147func (c * Client ) GetAppBundleVersions () (map [string ]interface {}, error ) {
148- url := fmt .Sprintf ("%s/api/ app-bundle/versions" , c .BaseURL )
148+ url := fmt .Sprintf ("%s/app-bundle/versions" , c .BaseURL )
149149 req , err := http .NewRequest ("GET" , url , nil )
150150 if err != nil {
151151 return nil , err
@@ -216,7 +216,7 @@ func (c *Client) DownloadAppBundleFile(path, destPath string, preview bool) erro
216216 return nil
217217}
218218
219- // downloadBinaryToFile performs an authenticated GET on path (must start with /, e.g. /api/ dataexport/parquet)
219+ // downloadBinaryToFile performs an authenticated GET on path (must start with /, e.g. /dataexport/parquet)
220220// and streams the body to destPath. Uses no overall HTTP timeout so large ZIP exports can complete.
221221func (c * Client ) downloadBinaryToFile (path string , destPath string ) error {
222222 url := fmt .Sprintf ("%s%s" , c .BaseURL , path )
@@ -271,17 +271,17 @@ func (c *Client) downloadBinaryToFile(path string, destPath string) error {
271271
272272// DownloadParquetExport downloads the Parquet export ZIP archive to the specified destination path
273273func (c * Client ) DownloadParquetExport (destPath string ) error {
274- return c .downloadBinaryToFile ("/api/ dataexport/parquet" , destPath )
274+ return c .downloadBinaryToFile ("/dataexport/parquet" , destPath )
275275}
276276
277277// DownloadRawJSONExport downloads the per-observation JSON ZIP export to the specified destination path
278278func (c * Client ) DownloadRawJSONExport (destPath string ) error {
279- return c .downloadBinaryToFile ("/api/ dataexport/raw-json" , destPath )
279+ return c .downloadBinaryToFile ("/dataexport/raw-json" , destPath )
280280}
281281
282282// DownloadAttachmentsExport downloads a ZIP of all current attachments to the specified destination path
283283func (c * Client ) DownloadAttachmentsExport (destPath string ) error {
284- return c .downloadBinaryToFile ("/api/ attachments/export-zip" , destPath )
284+ return c .downloadBinaryToFile ("/attachments/export-zip" , destPath )
285285}
286286
287287// UploadAppBundle uploads a new app bundle
@@ -348,7 +348,7 @@ func (c *Client) UploadAppBundle(bundlePath string) (map[string]interface{}, err
348348
349349// SwitchAppBundleVersion switches to a specific app bundle version
350350func (c * Client ) SwitchAppBundleVersion (version string ) (map [string ]interface {}, error ) {
351- url := fmt .Sprintf ("%s/api/ app-bundle/switch/%s" , c .BaseURL , version )
351+ url := fmt .Sprintf ("%s/app-bundle/switch/%s" , c .BaseURL , version )
352352
353353 req , err := http .NewRequest ("POST" , url , nil )
354354 if err != nil {
@@ -376,7 +376,7 @@ func (c *Client) SwitchAppBundleVersion(version string) (map[string]interface{},
376376
377377// SyncPull pulls updated records from the server
378378func (c * Client ) SyncPull (clientID string , currentVersion int64 , schemaTypes []string , limit int , pageToken string ) (map [string ]interface {}, error ) {
379- requestURL := fmt .Sprintf ("%s/api/ sync/pull" , c .BaseURL )
379+ requestURL := fmt .Sprintf ("%s/sync/pull" , c .BaseURL )
380380
381381 // Build query parameters
382382 var queryParams []string
@@ -455,7 +455,7 @@ func (c *Client) SyncPull(clientID string, currentVersion int64, schemaTypes []s
455455
456456// SyncPush pushes records to the server
457457func (c * Client ) SyncPush (clientID string , transmissionID string , records []map [string ]interface {}) (map [string ]interface {}, error ) {
458- url := fmt .Sprintf ("%s/api/ sync/push" , c .BaseURL )
458+ url := fmt .Sprintf ("%s/sync/push" , c .BaseURL )
459459
460460 // Prepare request body
461461 reqBody := map [string ]interface {}{
0 commit comments