Skip to content

Commit f886470

Browse files
committed
rest countries integration
1 parent 6a5eebc commit f886470

18 files changed

Lines changed: 838 additions & 1 deletion

File tree

apps/docs/components/icons.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6849,3 +6849,17 @@ export function HexIcon(props: SVGProps<SVGSVGElement>) {
68496849
</svg>
68506850
)
68516851
}
6852+
6853+
export function RestCountriesIcon(props: SVGProps<SVGSVGElement>) {
6854+
return (
6855+
<svg {...props} viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'>
6856+
<circle cx='12' cy='12' r='9' fill='#000' />
6857+
<path
6858+
d='M3.75 7.25h16.5M3.75 16.75h16.5M2.5 12h19M12 3.5c2.15 2.22 3.25 5.08 3.25 8.5S14.15 18.28 12 20.5C9.85 18.28 8.75 15.42 8.75 12S9.85 5.72 12 3.5Z'
6859+
stroke='white'
6860+
strokeWidth='1.4'
6861+
strokeLinecap='round'
6862+
/>
6863+
</svg>
6864+
)
6865+
}

apps/docs/components/ui/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ import {
151151
RedisIcon,
152152
ReductoIcon,
153153
ResendIcon,
154+
RestCountriesIcon,
154155
RevenueCatIcon,
155156
RipplingIcon,
156157
RootlyIcon,
@@ -370,6 +371,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
370371
reducto: ReductoIcon,
371372
reducto_v2: ReductoIcon,
372373
resend: ResendIcon,
374+
restcountries: RestCountriesIcon,
373375
revenuecat: RevenueCatIcon,
374376
rippling: RipplingIcon,
375377
rootly: RootlyIcon,

apps/docs/content/docs/en/tools/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"redis",
148148
"reducto",
149149
"resend",
150+
"restcountries",
150151
"revenuecat",
151152
"rippling",
152153
"rootly",
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: REST Countries
3+
description: Look up country reference data
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="restcountries"
10+
color="#E8F2FF"
11+
/>
12+
13+
## Usage Instructions
14+
15+
Look up country information using the REST Countries API. Search by name, code, region, currency, or language. Does not require OAuth or an API key.
16+
17+
18+
19+
## Tools
20+
21+
### `restcountries_search_by_name`
22+
23+
Search for countries by common or official country name using the REST Countries API.
24+
25+
#### Input
26+
27+
| Parameter | Type | Required | Description |
28+
| --------- | ---- | -------- | ----------- |
29+
| `name` | string | Yes | Country name to search for, such as "Canada" or "Republic of Korea" |
30+
| `fullText` | boolean | No | Require an exact full-name match when true |
31+
32+
#### Output
33+
34+
| Parameter | Type | Description |
35+
| --------- | ---- | ----------- |
36+
| `countries` | json | Countries matching the name search |
37+
| `count` | number | Number of countries returned |
38+
| `firstCountry` | json | First matching country, or null when there are no matches |
39+
40+
### `restcountries_get_by_code`
41+
42+
Get country information by ISO 3166-1 alpha-2, alpha-3, numeric, or IOC country code.
43+
44+
#### Input
45+
46+
| Parameter | Type | Required | Description |
47+
| --------- | ---- | -------- | ----------- |
48+
| `code` | string | Yes | Country code, such as "US", "USA", "840", or "CAN" |
49+
50+
#### Output
51+
52+
| Parameter | Type | Description |
53+
| --------- | ---- | ----------- |
54+
| `countries` | json | Array containing the country matching the provided code |
55+
| `count` | number | Number of countries returned |
56+
| `firstCountry` | json | The matching country, or null when there is no match |
57+
58+
### `restcountries_list_by_region`
59+
60+
List countries in a world region using the REST Countries API.
61+
62+
#### Input
63+
64+
| Parameter | Type | Required | Description |
65+
| --------- | ---- | -------- | ----------- |
66+
| `region` | string | Yes | Region name, such as "Africa", "Americas", "Asia", "Europe", or "Oceania" |
67+
68+
#### Output
69+
70+
| Parameter | Type | Description |
71+
| --------- | ---- | ----------- |
72+
| `countries` | json | Countries in the requested region |
73+
| `count` | number | Number of countries returned |
74+
| `firstCountry` | json | First country in the returned list, or null when there are no matches |
75+
76+
### `restcountries_list_by_currency`
77+
78+
List countries by currency code or currency name using the REST Countries API.
79+
80+
#### Input
81+
82+
| Parameter | Type | Required | Description |
83+
| --------- | ---- | -------- | ----------- |
84+
| `currency` | string | Yes | Currency code or name, such as "USD", "EUR", or "dollar" |
85+
86+
#### Output
87+
88+
| Parameter | Type | Description |
89+
| --------- | ---- | ----------- |
90+
| `countries` | json | Countries using the requested currency |
91+
| `count` | number | Number of countries returned |
92+
| `firstCountry` | json | First country in the returned list, or null when there are no matches |
93+
94+
### `restcountries_list_by_language`
95+
96+
List countries by official language code or language name using REST Countries.
97+
98+
#### Input
99+
100+
| Parameter | Type | Required | Description |
101+
| --------- | ---- | -------- | ----------- |
102+
| `language` | string | Yes | Language code or name, such as "en", "Spanish", or "French" |
103+
104+
#### Output
105+
106+
| Parameter | Type | Description |
107+
| --------- | ---- | ----------- |
108+
| `countries` | json | Countries using the requested language |
109+
| `count` | number | Number of countries returned |
110+
| `firstCountry` | json | First country in the returned list, or null when there are no matches |
111+
112+

apps/sim/app/(landing)/integrations/data/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ import {
151151
RedisIcon,
152152
ReductoIcon,
153153
ResendIcon,
154+
RestCountriesIcon,
154155
RevenueCatIcon,
155156
RipplingIcon,
156157
RootlyIcon,
@@ -352,6 +353,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
352353
redis: RedisIcon,
353354
reducto_v2: ReductoIcon,
354355
resend: ResendIcon,
356+
restcountries: RestCountriesIcon,
355357
revenuecat: RevenueCatIcon,
356358
rippling: RipplingIcon,
357359
rootly: RootlyIcon,

apps/sim/app/(landing)/integrations/data/integrations.json

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4045,6 +4045,10 @@
40454045
"name": "Read",
40464046
"description": "Parse one or more uploaded files or files from URLs (text, PDF, CSV, images, etc.)"
40474047
},
4048+
{
4049+
"name": "Get",
4050+
"description": "Get a workspace file object from a selected file or canonical workspace file ID."
4051+
},
40484052
{
40494053
"name": "Write",
40504054
"description": "Create a new workspace file. If a file with the same name already exists, a numeric suffix is added (e.g., "
@@ -4054,7 +4058,7 @@
40544058
"description": "Append content to an existing workspace file. The file must already exist. Content is added to the end of the file."
40554059
}
40564060
],
4057-
"operationCount": 3,
4061+
"operationCount": 4,
40584062
"triggers": [],
40594063
"triggerCount": 0,
40604064
"authType": "none",
@@ -10767,6 +10771,45 @@
1076710771
"integrationTypes": ["email", "communication"],
1076810772
"tags": ["email-marketing", "messaging"]
1076910773
},
10774+
{
10775+
"type": "restcountries",
10776+
"slug": "rest-countries",
10777+
"name": "REST Countries",
10778+
"description": "Look up country reference data",
10779+
"longDescription": "Look up country information using the REST Countries API. Search by name, code, region, currency, or language. Does not require OAuth or an API key.",
10780+
"bgColor": "#E8F2FF",
10781+
"iconName": "RestCountriesIcon",
10782+
"docsUrl": "https://docs.sim.ai/tools/restcountries",
10783+
"operations": [
10784+
{
10785+
"name": "Search by Name",
10786+
"description": "Search for countries by common or official country name using the REST Countries API."
10787+
},
10788+
{
10789+
"name": "Get by Code",
10790+
"description": "Get country information by ISO 3166-1 alpha-2, alpha-3, numeric, or IOC country code."
10791+
},
10792+
{
10793+
"name": "List by Region",
10794+
"description": "List countries in a world region using the REST Countries API."
10795+
},
10796+
{
10797+
"name": "List by Currency",
10798+
"description": "List countries by currency code or currency name using the REST Countries API."
10799+
},
10800+
{
10801+
"name": "List by Language",
10802+
"description": "List countries by official language code or language name using REST Countries."
10803+
}
10804+
],
10805+
"operationCount": 5,
10806+
"triggers": [],
10807+
"triggerCount": 0,
10808+
"authType": "none",
10809+
"category": "tools",
10810+
"integrationTypes": ["analytics", "documents", "search"],
10811+
"tags": ["data-analytics", "knowledge-base"]
10812+
},
1077010813
{
1077110814
"type": "revenuecat",
1077210815
"slug": "revenuecat",
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import { RestCountriesIcon } from '@/components/icons'
2+
import { type BlockConfig, IntegrationType } from '@/blocks/types'
3+
import type { RestCountriesResponse } from '@/tools/restcountries/types'
4+
5+
export const RestCountriesBlock: BlockConfig<RestCountriesResponse> = {
6+
type: 'restcountries',
7+
name: 'REST Countries',
8+
description: 'Look up country reference data',
9+
longDescription:
10+
'Look up country information using the REST Countries API. Search by name, code, region, currency, or language. Does not require OAuth or an API key.',
11+
docsLink: 'https://docs.sim.ai/tools/restcountries',
12+
category: 'tools',
13+
integrationType: IntegrationType.Analytics,
14+
tags: ['data-analytics', 'knowledge-base'],
15+
bgColor: '#E8F2FF',
16+
icon: RestCountriesIcon,
17+
subBlocks: [
18+
{
19+
id: 'operation',
20+
title: 'Operation',
21+
type: 'dropdown',
22+
options: [
23+
{ label: 'Search by Name', id: 'restcountries_search_by_name' },
24+
{ label: 'Get by Code', id: 'restcountries_get_by_code' },
25+
{ label: 'List by Region', id: 'restcountries_list_by_region' },
26+
{ label: 'List by Currency', id: 'restcountries_list_by_currency' },
27+
{ label: 'List by Language', id: 'restcountries_list_by_language' },
28+
],
29+
value: () => 'restcountries_search_by_name',
30+
},
31+
{
32+
id: 'name',
33+
title: 'Country Name',
34+
type: 'short-input',
35+
placeholder: 'Canada',
36+
condition: { field: 'operation', value: 'restcountries_search_by_name' },
37+
required: { field: 'operation', value: 'restcountries_search_by_name' },
38+
},
39+
{
40+
id: 'fullText',
41+
title: 'Exact Match',
42+
type: 'switch',
43+
condition: { field: 'operation', value: 'restcountries_search_by_name' },
44+
mode: 'advanced',
45+
},
46+
{
47+
id: 'code',
48+
title: 'Country Code',
49+
type: 'short-input',
50+
placeholder: 'US, USA, 840',
51+
condition: { field: 'operation', value: 'restcountries_get_by_code' },
52+
required: { field: 'operation', value: 'restcountries_get_by_code' },
53+
},
54+
{
55+
id: 'region',
56+
title: 'Region',
57+
type: 'dropdown',
58+
options: [
59+
{ label: 'Africa', id: 'Africa' },
60+
{ label: 'Americas', id: 'Americas' },
61+
{ label: 'Asia', id: 'Asia' },
62+
{ label: 'Europe', id: 'Europe' },
63+
{ label: 'Oceania', id: 'Oceania' },
64+
],
65+
value: () => 'Europe',
66+
condition: { field: 'operation', value: 'restcountries_list_by_region' },
67+
required: { field: 'operation', value: 'restcountries_list_by_region' },
68+
},
69+
{
70+
id: 'currency',
71+
title: 'Currency',
72+
type: 'short-input',
73+
placeholder: 'USD, EUR, dollar',
74+
condition: { field: 'operation', value: 'restcountries_list_by_currency' },
75+
required: { field: 'operation', value: 'restcountries_list_by_currency' },
76+
},
77+
{
78+
id: 'language',
79+
title: 'Language',
80+
type: 'short-input',
81+
placeholder: 'English, Spanish, en',
82+
condition: { field: 'operation', value: 'restcountries_list_by_language' },
83+
required: { field: 'operation', value: 'restcountries_list_by_language' },
84+
},
85+
],
86+
tools: {
87+
access: [
88+
'restcountries_search_by_name',
89+
'restcountries_get_by_code',
90+
'restcountries_list_by_region',
91+
'restcountries_list_by_currency',
92+
'restcountries_list_by_language',
93+
],
94+
config: {
95+
tool: (params) => {
96+
switch (params.operation) {
97+
case 'restcountries_get_by_code':
98+
return 'restcountries_get_by_code'
99+
case 'restcountries_list_by_region':
100+
return 'restcountries_list_by_region'
101+
case 'restcountries_list_by_currency':
102+
return 'restcountries_list_by_currency'
103+
case 'restcountries_list_by_language':
104+
return 'restcountries_list_by_language'
105+
default:
106+
return 'restcountries_search_by_name'
107+
}
108+
},
109+
},
110+
},
111+
inputs: {
112+
operation: { type: 'string', description: 'Country lookup operation to perform' },
113+
name: { type: 'string', description: 'Country name to search for' },
114+
fullText: { type: 'boolean', description: 'Require an exact country-name match' },
115+
code: { type: 'string', description: 'Country code to look up' },
116+
region: { type: 'string', description: 'World region to list countries from' },
117+
currency: { type: 'string', description: 'Currency code or name to search for' },
118+
language: { type: 'string', description: 'Language code or name to search for' },
119+
},
120+
outputs: {
121+
countries: { type: 'json', description: 'Countries returned by REST Countries' },
122+
count: { type: 'number', description: 'Number of countries returned' },
123+
firstCountry: { type: 'json', description: 'First country in the returned list' },
124+
},
125+
}

apps/sim/blocks/registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ import { RedisBlock } from '@/blocks/blocks/redis'
165165
import { ReductoBlock, ReductoV2Block } from '@/blocks/blocks/reducto'
166166
import { ResendBlock } from '@/blocks/blocks/resend'
167167
import { ResponseBlock } from '@/blocks/blocks/response'
168+
import { RestCountriesBlock } from '@/blocks/blocks/restcountries'
168169
import { RevenueCatBlock } from '@/blocks/blocks/revenuecat'
169170
import { RipplingBlock } from '@/blocks/blocks/rippling'
170171
import { RootlyBlock } from '@/blocks/blocks/rootly'
@@ -419,6 +420,7 @@ export const registry: Record<string, BlockConfig> = {
419420
reducto_v2: ReductoV2Block,
420421
resend: ResendBlock,
421422
response: ResponseBlock,
423+
restcountries: RestCountriesBlock,
422424
revenuecat: RevenueCatBlock,
423425
rippling: RipplingBlock,
424426
rootly: RootlyBlock,

0 commit comments

Comments
 (0)