atri_docs_upload: Upload files to ATRI standard docs topics

Description Usage Arguments Value See Also Examples

View source: R/atri_docs_upload.R

Description

A wrapper to upload file to ATRI portal standard docs topics

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
atri_docs_upload(
  protocol,
  topic_code = NULL,
  file_code = NULL,
  file = NULL,
  file_label = NULL,
  file_description = NULL,
  reason_for_change = NULL,
  site_code = NULL
)

Arguments

protocol:

The protocol name (e.g. 'a345-test-1').

topic_code:

specify a topic_code to upload file into it.

file_code:

use file_code to overwrite a file in a topic_code. No file_code is needed when upload a new file.

file:

a string text for local file location.

file_label:

a string text for file label.

file_description:

a string text for file description.

reason_for_change:

a string text to indicate reason for change.

site_code:

a string text to indicate the site topic code. Required for site-restricted topics.

Value

atri_api object contains: response- response from http url; url- a string of complete url; protocol- a string of input protocol.

See Also

atri_api

Examples

 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
# upload new file
write.csv('test initial upload',file='test.csv')
new_upload_resp <- atri_docs_upload(protocol = "a345-test-1", 
  topic_code = "report-configuration", 
  file = "test.csv", 
  file_label = "Test upload function file", 
  file_description = "Test upload function")
# upload new file to site topic
new_upload_site_topic <- atri_docs_upload(protocol = "a345-test-1", 
  topic_code = "site-folder-test", 
  file = "test.csv", 
  file_label = "Test upload function file", 
  file_description = "Test upload function",
  site_code="999")
 
# replace a file
write.csv('test re-upload',file='retest.csv')
topicfiles <- atri_api(protocol='a345-test-1', path='/docs/topics/report-configuration/files?format=json')
re_upload_resp <- atri_docs_upload(protocol = "a345-test-1", 
  topic_code = "report-configuration", 
  file_code = topicfiles[topicfiles$label %in% "Test upload function file", "code"],
  file = "retest.csv", 
  reason_for_change = "test re-uploads")
# replace file to site topic
topicfiles <- atri_api(protocol='a345-test-1', path='/docs/topics/site-folder-test/files?format=json&site_code=999')
re_upload_site_topic <- atri_docs_upload(protocol = "a345-test-1", 
  topic_code = "site-folder-test", 
  file_code = topicfiles[topicfiles$label %in% "Test upload function file", "code"],
  file = "retest.csv", 
  reason_for_change = "test re-uploads",
  site_code="999")

rg08705/test documentation built on Feb. 14, 2022, 3:07 a.m.