Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip api call #1586

Merged
merged 11 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
9 changes: 9 additions & 0 deletions .changeset/wicked-socks-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@api3/airnode-adapter': minor
'@api3/airnode-deployer': minor
'@api3/airnode-examples': minor
'@api3/airnode-node': minor
'@api3/airnode-validator': minor
---

Added API call skip feature.
2 changes: 1 addition & 1 deletion packages/airnode-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:watch": "yarn test:ts --watch"
},
"dependencies": {
"@api3/ois": "1.2.0",
"@api3/ois": "1.3.0",
"@api3/promise-utils": "^0.3.0",
"axios": "1.1.3",
"bignumber.js": "^9.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function cacheRequestOptions(options: BuildRequestOptions): CachedBuildRequestOp
throw new Error(`Endpoint: '${options.endpointName}' not found in the OIS.`);
}

const { method, path } = endpoint.operation;
const { method, path } = endpoint.operation!;
const operation = ois.apiSpecifications.paths[path][method]!;
return { ...options, endpoint, operation };
}
Expand All @@ -25,12 +25,12 @@ export function buildRequest(options: BuildRequestOptions): Request {
// Different base URLs are not supported at the operation level
const baseUrl = ois.apiSpecifications.servers[0].url;
const parameters = buildParameters(cachedOptions);
const path = parsePathWithParameters(endpoint.operation.path, parameters.paths);
const path = parsePathWithParameters(endpoint.operation!.path, parameters.paths);

return {
baseUrl,
path,
method: endpoint.operation.method,
method: endpoint.operation!.method,
headers: parameters.headers,
data: parameters.query,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-adapter/test/fixtures/ois.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OIS } from '@api3/ois';

export function buildOIS(overrides?: Partial<OIS>): OIS {
return {
oisFormat: '1.2.0',
oisFormat: '1.3.0',
version: '1.2.3',
title: 'Currency Converter API',
apiSpecifications: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-adapter/test/fixtures/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function buildRequestOptions(overrides?: Partial<BuildRequestOptions>): B
export function buildCacheRequestOptions(overrides?: Partial<CachedBuildRequestOptions>): CachedBuildRequestOptions {
const options = buildRequestOptions();
const endpoint = options.ois.endpoints[0];
const { method, path } = endpoint.operation;
const { method, path } = endpoint.operation!;
const operation = options.ois.apiSpecifications.paths[path][method]!;
return {
...options,
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinMarketCap Basic Authenticated Request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinMarketCap Basic Authenticated Request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko coins markets request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko coins markets request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko history data request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko history data request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "Failure Example",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'Failure Example',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "Relay Security Schemes via httpbin",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'Relay Security Schemes via httpbin',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"title": "OpenWeather Multiple Encoded Values",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.2.0',
oisFormat: '1.3.0',
title: 'OpenWeather Multiple Encoded Values',
version: '1.0.0',
apiSpecifications: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.2.0",
"oisFormat": "1.3.0",
"version": "1.2.3",
"title": "Currency Converter API",
"apiSpecifications": {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@api3/airnode-protocol": "^0.9.0",
"@api3/airnode-utilities": "^0.9.0",
"@api3/airnode-validator": "^0.9.0",
"@api3/ois": "1.2.0",
"@api3/ois": "1.3.0",
"@api3/promise-utils": "^0.3.0",
"aws-sdk": "^2.1243.0",
"dotenv": "^16.0.3",
Expand Down
Loading