@@ -24,11 +24,7 @@ labkey.domain.get <- function(baseUrl=NULL, folderPath, schemaName, queryName)
2424 if (missing(baseUrl ) || is.null(baseUrl ) || missing(folderPath ) || missing(schemaName ) || missing(queryName ))
2525 stop (paste(" A value must be specified for each of baseUrl, folderPath, schemaName and queryName." ))
2626
27- # # normalize the folder path
28- folderPath <- encodeFolderPath(folderPath )
29-
30- url <- paste(baseUrl , " property" , folderPath , " getDomain.api" , sep = " " )
31-
27+ url <- labkey.buildURL(baseUrl , " property" , " getDomain.api" , folderPath )
3228 params <- list (schemaName = schemaName , queryName = queryName )
3329 response <- labkey.post(url , toJSON(params , auto_unbox = TRUE ))
3430
@@ -63,11 +59,9 @@ labkey.domain.save <- function(baseUrl=NULL, folderPath, schemaName, queryName,
6359 if (! is.list(domainDesign ))
6460 stop (paste(" domainDesign must be a list data structure." ))
6561
66- # # normalize the folder path
67- folderPath <- encodeFolderPath(folderPath )
6862 params <- list (schemaName = schemaName , queryName = queryName , domainDesign = domainDesign )
63+ url <- labkey.buildURL(baseUrl , " property" , " saveDomain.api" , folderPath )
6964
70- url <- paste(baseUrl , " property" , folderPath , " saveDomain.api" , sep = " " )
7165 response <- labkey.post(url , toJSON(params , auto_unbox = TRUE ))
7266
7367 return (fromJSON(response ))
@@ -157,10 +151,7 @@ labkey.domain.create <- function(baseUrl=NULL, folderPath, domainKind=NULL, doma
157151 createDomain = createDomain , importData = importData )
158152 }
159153
160- # # normalize the folder path
161- folderPath <- encodeFolderPath(folderPath )
162-
163- url <- paste(baseUrl , " property" , folderPath , " createDomain.api" , sep = " " )
154+ url <- labkey.buildURL(baseUrl , " property" , " createDomain.api" , folderPath )
164155 response <- labkey.post(url , toJSON(params , auto_unbox = TRUE ))
165156
166157 return (fromJSON(response ))
@@ -175,11 +166,7 @@ labkey.domain.drop <- function(baseUrl=NULL, folderPath, schemaName, queryName)
175166 if (missing(schemaName )) stop (paste(" A value must be specified for schemaName." ))
176167 if (missing(queryName )) stop (paste(" A value must be specified for queryName." ))
177168
178- # # normalize the folder path
179- folderPath <- encodeFolderPath(folderPath )
180-
181- url <- paste(baseUrl , " property" , folderPath , " deleteDomain.api" , sep = " " )
182-
169+ url <- labkey.buildURL(baseUrl , " property" , " deleteDomain.api" , folderPath )
183170 params <- list (schemaName = schemaName , queryName = queryName )
184171 response <- labkey.post(url , toJSON(params , auto_unbox = TRUE ))
185172
@@ -194,17 +181,14 @@ labkey.domain.inferFields <- function(baseUrl=NULL, folderPath, df)
194181 if (missing(baseUrl ) || is.null(baseUrl ) || missing(folderPath ) || missing(df ))
195182 stop (paste(" A value must be specified for each of baseUrl, folderPath and df." ))
196183
197- # # normalize the folder path
198- folderPath <- encodeFolderPath(folderPath )
199-
200184 # # write the dataframe to a tempfile to post to the server
201185 tf <- tempfile(fileext = " .tsv" )
202186 write.table(df , file = tf , sep = " \t " , quote = FALSE , row.names = FALSE )
203187
204188 # # Execute via our standard POST function
205- url <- paste(baseUrl , " property" , folderPath , " inferDomain.api" , sep = " " )
206-
189+ url <- labkey.buildURL(baseUrl , " property" , " inferDomain.api" , folderPath )
207190 rawdata <- labkey.post(url , list (file = upload_file(tf )), encoding = " multipart" )
191+
208192 # # delete the temp file
209193 file.remove(tf )
210194 response <- fromJSON(rawdata )
0 commit comments