Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0adc3c6
initial commit
afernandes85 Oct 2, 2020
64ad601
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
3f256e3
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
4a0f98b
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
ac681b0
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
3e549ee
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
1e36c91
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
c5df38c
updating R section in pull-request.yml
afernandes85 Oct 5, 2020
1e7edd7
Merge branch 'master' into feat/r/init
afernandes85 Oct 5, 2020
3ac821b
updates to readme
afernandes85 Oct 5, 2020
0202f8b
updates to readme
afernandes85 Oct 5, 2020
0dd437d
updates to readme
afernandes85 Oct 5, 2020
8b64c84
updates to readme
afernandes85 Oct 5, 2020
be4b23c
updates to readme
afernandes85 Oct 6, 2020
bc25103
updates to readme
afernandes85 Oct 6, 2020
0e58b1b
updates to readme
afernandes85 Oct 6, 2020
063c6be
updates to readme
afernandes85 Oct 6, 2020
10014b9
testing
afernandes85 Oct 6, 2020
8ea04d3
testing
afernandes85 Oct 6, 2020
b40a62c
testing
afernandes85 Oct 6, 2020
ae07b86
testing
afernandes85 Oct 6, 2020
b8ad3d9
testing
afernandes85 Oct 6, 2020
0a993fc
testing
afernandes85 Oct 6, 2020
bd42847
testing
afernandes85 Oct 6, 2020
7b6844f
testing
afernandes85 Oct 6, 2020
b7ec447
testing
afernandes85 Oct 6, 2020
98baa0a
testing
afernandes85 Oct 6, 2020
4136d92
testing
afernandes85 Oct 6, 2020
f734a5c
testing
afernandes85 Oct 6, 2020
2fce133
testing
afernandes85 Oct 6, 2020
e8108f3
testing
afernandes85 Oct 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
GITHUB_DOTNET_SDK_REPO: afernandes85/analyticsapi-engines-dotnet-sdk
GITHUB_PYTHON_SDK_REPO: afernandes85/analyticsapi-engines-python-sdk
GITHUB_JAVA_SDK_REPO: afernandes85/analyticsapi-engines-java-sdk
GITHUB_R_SDK_REPO: afernandes85/analyticsapi-engines-r-sdk

on:
pull_request:
Expand Down Expand Up @@ -94,3 +95,52 @@ jobs:
- name: Raise pull request on SDK repository
if: env.GITHUB_JAVA_SDK_REPO
run: generator/.github/scripts/raise-pull-request.sh java

r:
runs-on: ubuntu-latest

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"

steps:
- name: Check out SDK repository
if: env.GITHUB_R_SDK_REPO
uses: actions/checkout@v2
with:
repository: ${{ env.GITHUB_R_SDK_REPO }}
path: sdk
fetch-depth: 0
token: ${{ env.USER_API_KEY }}

- name: Check out Generator repository
if: env.GITHUB_R_SDK_REPO
uses: actions/checkout@v2
with:
path: generator

- name: Generate SDK
if: env.GITHUB_R_SDK_REPO
run: generator/.github/scripts/generate-sdk.sh $OPENAPI_GENERATOR_VERSION r CustomRClientCodegen

- name: Set up R
if: env.GITHUB_R_SDK_REPO
uses: r-lib/actions/setup-r@v1
with:
r-version: '3.5.3'

- name: Generate docs
if: env.GITHUB_R_SDK_REPO
run: |
sudo apt-get install libcurl4-openssl-dev libssl-dev
sudo apt-get install libprotoc-dev
sudo Rscript -e "install.packages('jsonlite', repos = 'http://cran.us.r-project.org')"
sudo Rscript -e "install.packages('httr', repos = 'http://cran.us.r-project.org')"
sudo Rscript -e "install.packages('base64enc', repos = 'http://cran.us.r-project.org')"
sudo Rscript -e "install.packages('factset.protobuf.stach', repos = 'http://cran.us.r-project.org')"
sudo Rscript -e "install.packages('roxygen2', repos = 'http://cran.us.r-project.org')"
sudo Rscript -e "roxygen2::roxygenize(roclets = c('rd', 'namespace'), package.dir = '${GITHUB_WORKSPACE}/generator/languages/r/sdk')"

- name: Raise pull request on SDK repository
if: env.GITHUB_R_SDK_REPO
run: generator/.github/scripts/raise-pull-request.sh r
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Follow the below links for generated language specific SDK repositories.
* [Python](https://github.com/afernandes85/analyticsapi-engines-python-sdk)
* [Dotnet](https://github.com/afernandes85/analyticsapi-engines-dotnet-sdk)
* [Java](https://github.com/afernandes85/analyticsapi-engines-java-sdk)
* [R](https://github.com/afernandes85/analyticsapi-engines-r-sdk)

## Contents

Expand Down
11 changes: 11 additions & 0 deletions languages/r/openapi-generator-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"packageName": "factset.analyticsapi.engines",
"packageVersion": "4.0.0",
"hideGenerationTimestamp": "true",
"returnExceptionOnFailure": "true",
"exceptionPackage": "rlang",
"gitHost": "github.com",
"gitUserId": "factset",
"gitRepoId": "analyticsapi-engines-r-sdk",
"httpUserAgent": "engines-api/4.0.0/r"
}
33 changes: 33 additions & 0 deletions languages/r/templates/NAMESPACE.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{! This file is picked from the v4.3.1 release of openapi-generator(https://github.com/OpenAPITools/openapi-generator/blob/v4.3.1/modules/openapi-generator/src/main/resources/r/NAMESPACE.mustache) }}
{{! Changes made: 1) Exporting UtilityApi and StachExtensions. }}
# Generated by openapi-generator: https://openapi-generator.tech
# Do not edit by hand

# Core
export(ApiClient)
export(ApiResponse)
{{#useRlangExceptionHandling}}
export(ApiException)
{{/useRlangExceptionHandling}}

# Models
{{#models}}
{{#model}}
export({{{classname}}})
{{/model}}
{{/models}}

# APIs
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#-first}}
export({{{classname}}})
{{/-first}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
export(UtilityApi)
export(StachExtensions)
104 changes: 104 additions & 0 deletions languages/r/templates/README.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{{! This file is picked from the v4.3.1 release of openapi-generator(https://github.com/OpenAPITools/openapi-generator/blob/v4.3.1/modules/openapi-generator/src/main/resources/r/README.mustache) }}
{{! Changes made: 1) Added link to UtilityApi's documentation. 2) Added dependency for factset.protobuf.stach. }}
# R API client for {{packageName}}

{{#appDescriptionWithNewLines}}
{{{appDescriptionWithNewLines}}}
{{/appDescriptionWithNewLines}}

## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI spec](https://openapis.org) from a remote server, you can easily generate an API client.

- API version: {{appVersion}}
- Package version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}

## Installation

### Prerequisites

Install the dependencies

```R
install.packages("jsonlite")
install.packages("httr")
install.packages("base64enc")
install.packages("factset.protobuf.stach")
```

### Build the package

```sh
git clone https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}
cd {{{gitRepoId}}}
R CMD build .
R CMD check {{{packageName}}}_{{{packageVersion}}}.tar.gz
R CMD INSTALL {{{packageName}}}_{{{packageVersion}}}.tar.gz
```

### Install the package

```R
install.packages("{{{packageName}}}")
```

To install directly from Github, use `devtools`:
```R
install.packages("devtools")
library(devtools)
install_github("{{{gitUserId}}}/{{{gitRepoId}}}")
```

### Usage

```R
library({{{packageName}}})
```

## Documentation for API Endpoints

All URIs are relative to *{{basePath}}*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}*UtilityApi* | [**getByUrl**]({{apiDocPath}}UtilityApi.md#getByUrl) | **GET** {url} | Get by url

## Documentation for Models

{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}

## Documentation for Authorization

{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}### {{name}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}


## Author

{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
{{/hasMore}}{{/apis}}{{/apiInfo}}
9 changes: 9 additions & 0 deletions languages/r/templates/Rbuildignore.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.openapi-generator-ignore$
^\.travis\.yml$
^\.openapi-generator$
^docs$
^git_push\.sh$
^README\.md$
^cran-comments\.md$
95 changes: 95 additions & 0 deletions languages/r/templates/UtilityApi_doc.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# UtilityApi{{#description}}
{{description}}{{/description}}

All URIs are relative to *{{basePath}}*

Method | HTTP request | Description
------------- | ------------- | -------------
[**GetByUrl**](UtilityApi.md#GetByUrl) | **GET** {url} | Get by url

# **GetByUrl**
> raw GetByUrl(url)

Get by url

This method fetches data from any GET endpoint.

### Example
```R
library({{{packageName}}})

var.url <- `url_example` # character | Url of the GET endpoint

#This function can be used to fetch data from any Get endpoint.
api.instance <- UtilityApi$new()
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
# Configure HTTP basic authorization: {{{name}}}
api.instance$apiClient$username <- 'TODO_YOUR_USERNAME';
api.instance$apiClient$password <- 'TODO_YOUR_PASSWORD';
{{/isBasic}}
{{#isApiKey}}
# Configure API key authorization: {{{name}}}
api.instance$apiClient$apiKeys['{{{keyParamName}}}'] <- 'TODO_YOUR_API_KEY';
{{/isApiKey}}
{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
{{#returnExceptionOnFailure}}
{{#useRlangExceptionHandling}}
result <- tryCatch(
api.instance$GetByUrl(var.url),
ApiException = function(ex) ex
)
# In case of error, print the error object
if(!is.null(result$ApiException)) {
cat(result$ApiException$toString())
} else {
# deserialized response object
response.object <- result$content
# response headers
response.headers <- result$response$headers
# response status code
response.status.code <- result$response$status_code
}
{{/useRlangExceptionHandling}}
{{/returnExceptionOnFailure}}
{{^useRlangExceptionHandling}}
result <- api.instance$GetByUrl(var.url)
dput(result)
{{/useRlangExceptionHandling}}
```

### Parameters
This endpoint does not need any parameter.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**url** | **character**| Get by url |

### Return type

**raw**

### Authorization

{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/x-protobuf, text/plain, application/json, text/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Expected response once the request is successful. Response body will contain the data. | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * Age - Standard HTTP header. Header will specify the age of columns list cached response. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
| **400** | Invalid identifier provided. | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
| **401** | Missing or invalid authentication. | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
| **403** | User is forbidden with current credentials | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
| **406** | Unsupported Accept header. Header needs to be set to application/json. | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
| **500** | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
| **503** | Request timed out. Retry the request in sometime. | * X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication. <br> * X-DataDirect-Request-Key - FactSet's request key header. <br> |
Loading