5 New Integrations (#45)

This commit is contained in:
Jim Myers 2023-08-25 18:34:06 -04:00 committed by GitHub
parent db56fe2a31
commit 89c071a3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 314 additions and 2 deletions

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -0,0 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_apilayer_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}

View File

@ -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

View File

@ -0,0 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_deepnftvalue_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_snapshot_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}

View File

@ -0,0 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_solscan_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}

View File

@ -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

View File

@ -0,0 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_zapper_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}