diff --git a/.github/workflows/dbt_test.yml b/.github/workflows/dbt_test.yml index 068cac6..0906ab5 100644 --- a/.github/workflows/dbt_test.yml +++ b/.github/workflows/dbt_test.yml @@ -41,6 +41,6 @@ jobs: if: github.event_name == 'workflow_dispatch' secrets: inherit with: - warehouse: ${{ inputs.warehouse }} - environment: workflow_${{ inputs.environment }} + warehouse: DBT_CLOUD + environment: workflow_prod command: test --selector test_udfs \ No newline at end of file diff --git a/macros/marketplace/apilayer/udfs.yaml.sql b/macros/marketplace/apilayer/udfs.yaml.sql new file mode 100644 index 0000000..b8a7c04 --- /dev/null +++ b/macros/marketplace/apilayer/udfs.yaml.sql @@ -0,0 +1,42 @@ +{% macro config_apilayer_udfs(schema_name = "apilayer", utils_schema_name="apilayer_utils") -%} +{# + This macro is used to generate the ApiLayer Base endpoints + #} + +- name: {{ schema_name -}}.get + signature: + - [PATH, STRING, The path starting with '/'] + - [QUERY_ARGS, OBJECT, The query arguments] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'GET' request to the ApiLayer API. [ApiLayer docs here](https://apilayer.com/docs/article/getting-started).$$ + sql: | + SELECT + live.udf_api( + 'GET', + concat('https://api.apilayer.com', PATH, '?', utils.udf_object_to_url_query_string(QUERY_ARGS)), + {'apikey': '{API_KEY}'}, + {}, + '_FSC_SYS/APILAYER' + ) as response + +- name: {{ schema_name -}}.post + signature: + - [PATH, STRING, The path starting with '/'] + - [BODY, OBJECT, The request body] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'POST' request to the ApiLayer API. [ApiLayer docs here](https://apilayer.com/docs/article/getting-started).$$ + sql: | + SELECT + live.udf_api( + 'POST', + CONCAT('https://api.apilayer.com', PATH), + {'apikey': '{API_KEY}'}, + BODY, + '_FSC_SYS/APILAYER' + ) as response + +{% endmacro %} \ No newline at end of file diff --git a/macros/marketplace/deepnftvalue/udfs.yaml.sql b/macros/marketplace/deepnftvalue/udfs.yaml.sql new file mode 100644 index 0000000..ccfd483 --- /dev/null +++ b/macros/marketplace/deepnftvalue/udfs.yaml.sql @@ -0,0 +1,42 @@ +{% macro config_deepnftvalue_udfs(schema_name = "deepnftvalue", utils_schema_name="deepnftvalue_utils") -%} +{# + This macro is used to generate the DeepNftValue Base endpoints + #} + +- name: {{ schema_name -}}.get + signature: + - [PATH, STRING, The path starting with '/'] + - [QUERY_ARGS, OBJECT, The query arguments] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'GET' request to the DeepNftValue API. [DeepNftValue docs here](https://deepnftvalue.readme.io/reference/getting-started-with-deepnftvalue-api).$$ + sql: | + SELECT + live.udf_api( + 'GET', + concat('https://api.deepnftvalue.com', PATH, '?', utils.udf_object_to_url_query_string(QUERY_ARGS)), + {'Authorization': 'Token {API_KEY}'}, + {}, + '_FSC_SYS/DEEPNFTVALUE' + ) as response + +- name: {{ schema_name -}}.post + signature: + - [PATH, STRING, The path starting with '/'] + - [BODY, OBJECT, The request body] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'POST' request to the DeepNftValue API. [DeepNftValue docs here](https://deepnftvalue.readme.io/reference/getting-started-with-deepnftvalue-api).$$ + sql: | + SELECT + live.udf_api( + 'POST', + CONCAT('https://api.deepnftvalue.com', PATH), + {'Authorization': 'Token {API_KEY}'}, + BODY, + '_FSC_SYS/DEEPNFTVALUE' + ) as response + +{% endmacro %} \ No newline at end of file diff --git a/macros/marketplace/snapshot/udfs.yaml.sql b/macros/marketplace/snapshot/udfs.yaml.sql new file mode 100644 index 0000000..8ad2405 --- /dev/null +++ b/macros/marketplace/snapshot/udfs.yaml.sql @@ -0,0 +1,22 @@ +{% macro config_snapshot_udfs(schema_name = "snapshot", utils_schema_name="snapshot_utils") -%} +{# + This macro is used to generate the Snapshot Base endpoints + #} + +- name: {{ schema_name -}}.query + signature: + - [QUERY, OBJECT, The GraphQL query] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a Graphql Query to the Snapshot API. [Snapshot docs here](https://docs.snapshot.org/tools/api).$$ + sql: | + SELECT + live.udf_api( + 'POST', + 'https://hub.snapshot.org/graphql', + {}, + QUERY + ) as response + +{% endmacro %} \ No newline at end of file diff --git a/macros/marketplace/solscan/udfs.yaml.sql b/macros/marketplace/solscan/udfs.yaml.sql new file mode 100644 index 0000000..7c27f62 --- /dev/null +++ b/macros/marketplace/solscan/udfs.yaml.sql @@ -0,0 +1,79 @@ +{% macro config_solscan_udfs(schema_name = "solscan", utils_schema_name="solscan_utils") -%} +{# + This macro is used to generate the Solscan Base endpoints + #} + +- name: {{ schema_name -}}.pro_api_get + signature: + - [PATH, STRING, The path starting with '/'] + - [QUERY_ARGS, OBJECT, The query arguments] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'GET' request to the Private Solscan API. [Solscan docs here](https://pro-api.solscan.io/pro-api-docs/v1.0).$$ + sql: | + SELECT + live.udf_api( + 'GET', + concat('https://pro-api.solscan.io', PATH, '?', utils.udf_object_to_url_query_string(QUERY_ARGS)), + {'token': '{API_KEY}'}, + {}, + '_FSC_SYS/SOLSCAN' + ) as response + +- name: {{ schema_name -}}.pro_api_post + signature: + - [PATH, STRING, The path starting with '/'] + - [BODY, OBJECT, The request body] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'POST' request to the Private Solscan API. [Solscan docs here](https://pro-api.solscan.io/pro-api-docs/v1.0).$$ + sql: | + SELECT + live.udf_api( + 'POST', + CONCAT('https://pro-api.solscan.io', PATH), + {'token': '{API_KEY}'}, + BODY, + '_FSC_SYS/SOLSCAN' + ) as response + +- name: {{ schema_name -}}.public_api_get + signature: + - [PATH, STRING, The path starting with '/'] + - [QUERY_ARGS, OBJECT, The query arguments] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'GET' request to the Public Solscan API. [Solscan docs here](https://public-api.solscan.io/docs/#/).$$ + sql: | + SELECT + live.udf_api( + 'GET', + concat('https://public-api.solscan.io', PATH, '?', utils.udf_object_to_url_query_string(QUERY_ARGS)), + {'token': '{API_KEY}'}, + {}, + '_FSC_SYS/SOLSCAN' + ) as response + +- name: {{ schema_name -}}.public_api_post + signature: + - [PATH, STRING, The path starting with '/'] + - [BODY, OBJECT, The request body] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'POST' request to the Public Solscan API. [Solscan docs here](https://public-api.solscan.io/docs/#/).$$ + sql: | + SELECT + live.udf_api( + 'POST', + CONCAT('https://public-api.solscan.io', PATH), + {'token': '{API_KEY}'}, + BODY, + '_FSC_SYS/SOLSCAN' + ) as response + + +{% endmacro %} \ No newline at end of file diff --git a/macros/marketplace/zapper/udfs.yaml.sql b/macros/marketplace/zapper/udfs.yaml.sql new file mode 100644 index 0000000..191c72e --- /dev/null +++ b/macros/marketplace/zapper/udfs.yaml.sql @@ -0,0 +1,42 @@ +{% macro config_zapper_udfs(schema_name = "zapper", utils_schema_name="zapper_utils") -%} +{# + This macro is used to generate the Zapper Base endpoints + #} + +- name: {{ schema_name -}}.get + signature: + - [PATH, STRING, The path starting with '/'] + - [QUERY_ARGS, OBJECT, The query arguments] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'GET' request to the Zapper API. [Zapper docs here](https://studio.zapper.xyz/docs/apis/getting-started).$$ + sql: | + SELECT + live.udf_api( + 'GET', + concat('https://api.zapper.xyz', PATH, '?', utils.udf_object_to_url_query_string(QUERY_ARGS)), + {'Authorization': 'Basic {API_KEY}'}, + {}, + '_FSC_SYS/ZAPPER' + ) as response + +- name: {{ schema_name -}}.post + signature: + - [PATH, STRING, The path starting with '/'] + - [BODY, OBJECT, The request body] + return_type: + - "VARIANT" + options: | + COMMENT = $$Used to issue a 'POST' request to the Zapper API. [Zapper docs here](https://studio.zapper.xyz/docs/apis/getting-started).$$ + sql: | + SELECT + live.udf_api( + 'POST', + CONCAT('https://api.zapper.xyz', PATH), + {'Authorization': 'Basic {API_KEY}'}, + BODY, + '_FSC_SYS/ZAPPER' + ) as response + +{% endmacro %} \ No newline at end of file diff --git a/models/deploy/marketplace/apilayer/apilayer__.sql b/models/deploy/marketplace/apilayer/apilayer__.sql new file mode 100644 index 0000000..9564b4f --- /dev/null +++ b/models/deploy/marketplace/apilayer/apilayer__.sql @@ -0,0 +1,5 @@ +-- depends_on: {{ ref('live') }} +{%- set configs = [ + config_apilayer_udfs, + ] -%} +{{- ephemeral_deploy_marketplace(configs) -}} \ No newline at end of file diff --git a/models/deploy/marketplace/apilayer/apilayer__.yml b/models/deploy/marketplace/apilayer/apilayer__.yml new file mode 100644 index 0000000..c19179f --- /dev/null +++ b/models/deploy/marketplace/apilayer/apilayer__.yml @@ -0,0 +1,13 @@ +version: 2 +models: + - name: apilayer__ + columns: + - name: get + tests: + - test_udf: + name: test_apilayer__get_status_200 + args: > + '/odds/sports' + , {} + assertions: + - result:status_code = 200 diff --git a/models/deploy/marketplace/deepnftvalue/deepnftvalue__.sql b/models/deploy/marketplace/deepnftvalue/deepnftvalue__.sql new file mode 100644 index 0000000..9263509 --- /dev/null +++ b/models/deploy/marketplace/deepnftvalue/deepnftvalue__.sql @@ -0,0 +1,5 @@ +-- depends_on: {{ ref('live') }} +{%- set configs = [ + config_deepnftvalue_udfs, + ] -%} +{{- ephemeral_deploy_marketplace(configs) -}} \ No newline at end of file diff --git a/models/deploy/marketplace/deepnftvalue/deepnftvalue__.yml b/models/deploy/marketplace/deepnftvalue/deepnftvalue__.yml new file mode 100644 index 0000000..30ceaa8 --- /dev/null +++ b/models/deploy/marketplace/deepnftvalue/deepnftvalue__.yml @@ -0,0 +1,13 @@ +version: 2 +models: + - name: deepnftvalue__ + columns: + - name: get + tests: + - test_udf: + name: test_deepnftvalue__get_status_200 + args: > + '/v1/collections' + , {'limit': 5} + assertions: + - result:status_code = 200 diff --git a/models/deploy/marketplace/snapshot/snapshot__ .yml b/models/deploy/marketplace/snapshot/snapshot__ .yml new file mode 100644 index 0000000..9fece1a --- /dev/null +++ b/models/deploy/marketplace/snapshot/snapshot__ .yml @@ -0,0 +1,21 @@ +version: 2 +models: + - name: snapshot__ + columns: + - name: query + tests: + - test_udf: + name: test_snapshot__query_status_200 + args: > + { + 'query': '{ + space(id: "snapshot.dcl.eth") { + id + name + members + } + }', + 'variables': {} + } + assertions: + - result:status_code = 200 diff --git a/models/deploy/marketplace/snapshot/snapshot__.sql b/models/deploy/marketplace/snapshot/snapshot__.sql new file mode 100644 index 0000000..ca790b5 --- /dev/null +++ b/models/deploy/marketplace/snapshot/snapshot__.sql @@ -0,0 +1,5 @@ +-- depends_on: {{ ref('live') }} +{%- set configs = [ + config_snapshot_udfs, + ] -%} +{{- ephemeral_deploy_marketplace(configs) -}} \ No newline at end of file diff --git a/models/deploy/marketplace/solscan/solscan__.sql b/models/deploy/marketplace/solscan/solscan__.sql new file mode 100644 index 0000000..d85d0aa --- /dev/null +++ b/models/deploy/marketplace/solscan/solscan__.sql @@ -0,0 +1,5 @@ +-- depends_on: {{ ref('live') }} +{%- set configs = [ + config_solscan_udfs, + ] -%} +{{- ephemeral_deploy_marketplace(configs) -}} \ No newline at end of file diff --git a/models/deploy/marketplace/solscan/solscan__.yml b/models/deploy/marketplace/solscan/solscan__.yml new file mode 100644 index 0000000..8602105 --- /dev/null +++ b/models/deploy/marketplace/solscan/solscan__.yml @@ -0,0 +1,13 @@ +version: 2 +models: + - name: solscan__ + columns: + - name: public_api_get + tests: + - test_udf: + name: test_solscan_public_api_get__get_status_200 + args: > + '/block/last' + , {'limit': 10} + assertions: + - result:status_code = 200 diff --git a/models/deploy/marketplace/zapper/zapper__.sql b/models/deploy/marketplace/zapper/zapper__.sql new file mode 100644 index 0000000..a81d10f --- /dev/null +++ b/models/deploy/marketplace/zapper/zapper__.sql @@ -0,0 +1,5 @@ +-- depends_on: {{ ref('live') }} +{%- set configs = [ + config_zapper_udfs, + ] -%} +{{- ephemeral_deploy_marketplace(configs) -}} \ No newline at end of file