Skip to content

Commit

Permalink
✨Source Gutendex: Make Connector Compatible with Builder (#39509)
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloescoder committed Jun 16, 2024
1 parent b3839e7 commit 19cfb20
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 258 deletions.
6 changes: 0 additions & 6 deletions airbyte-integrations/connectors/source-gutendex/.dockerignore

This file was deleted.

2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-gutendex/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gutendex source connector


This is the repository for the Gutendex source connector, written in Python.
This is the repository for the Gutendex configuration based source connector.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/gutendex).

## Local development
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#


Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-gutendex/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#

from source_gutendex.run import run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: bff9a277-e01d-420d-81ee-80f28a307318
dockerImageTag: 0.1.2
dockerImageTag: 0.1.3
dockerRepository: airbyte/source-gutendex
githubIssueLabel: source-gutendex
license: MIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.1.2"
version = "0.1.3"
name = "source-gutendex"
description = "Source implementation for Gutendex."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#


Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,236 @@
version: "0.29.0"
version: 0.78.1

type: DeclarativeSource

check:
type: CheckStream
stream_names:
- books

definitions:
selector:
extractor:
field_path:
- results
requester:
url_base: "https://gutendex.com/"
http_method: "GET"
request_parameters:
author_year_start: "{{ config['author_year_start'] }}"
author_year_end: "{{ config['author_year_end'] }}"
copyright: "{{ config['copyright'] }}"
languages: "{{ config['languages'] }}"
search: "{{ config['search'] }}"
sort: "{{ config['sort'] }}"
topic: "{{ config['topic'] }}"
retriever:
record_selector:
$ref: "#/definitions/selector"
paginator:
type: "DefaultPaginator"
pagination_strategy:
type: "PageIncrement"
page_size: 32
page_token_option:
type: RequestOption
inject_into: "request_parameter"
field_name: "page"
page_size_option:
inject_into: "body_data"
field_name: "page_size"
requester:
$ref: "#/definitions/requester"
base_stream:
retriever:
$ref: "#/definitions/retriever"
books_stream:
$ref: "#/definitions/base_stream"
$parameters:
name: "books"
path: "/books"
streams:
books:
type: DeclarativeStream
name: books
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /books
http_method: GET
request_parameters:
author_year_start: "{{ config['author_year_start'] }}"
author_year_end: "{{ config['author_year_end'] }}"
copyright: "{{ config['copyright'] }}"
languages: "{{ config['languages'] }}"
search: "{{ config['search'] }}"
sort: "{{ config['sort'] }}"
topic: "{{ config['topic'] }}"
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- results
paginator:
type: DefaultPaginator
page_token_option:
type: RequestOption
inject_into: request_parameter
field_name: page
page_size_option:
type: RequestOption
inject_into: body_data
field_name: page_size
pagination_strategy:
type: PageIncrement
page_size: 32
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/books"
base_requester:
type: HttpRequester
url_base: https://gutendex.com/

streams:
- "#/definitions/books_stream"
- $ref: "#/definitions/streams/books"

check:
stream_names:
- "books"
spec:
type: Spec
connection_specification:
type: object
$schema: http://json-schema.org/draft-07/schema#
required: []
properties:
author_year_end:
type: string
description: >-
(Optional) Defines the maximum birth year of the authors. Books by
authors born after the end year will not be returned. Supports both
positive (CE) or negative (BCE) integer values
pattern: ^[-]?[0-9]{1,4}$
examples:
- 2002
- 500
- -500
- 2020
order: 0
author_year_start:
type: string
description: >-
(Optional) Defines the minimum birth year of the authors. Books by
authors born prior to the start year will not be returned. Supports
both positive (CE) or negative (BCE) integer values
pattern: ^[-]?[0-9]{1,4}$
examples:
- 2002
- 500
- -500
- 2020
order: 1
copyright:
type: string
description: >-
(Optional) Use this to find books with a certain copyright status -
true for books with existing copyrights, false for books in the public
domain in the USA, or null for books with no available copyright
information.
pattern: ^(true|false|null)$
examples:
- true
- false
- null
order: 2
languages:
type: string
description: >-
(Optional) Use this to find books in any of a list of languages. They
must be comma-separated, two-character language codes.
examples:
- en
- en,fr,fi
order: 3
search:
type: string
description: >-
(Optional) Use this to search author names and book titles with given
words. They must be separated by a space (i.e. %20 in URL-encoded
format) and are case-insensitive.
examples:
- dickens%20great%20expect
- dickens
order: 4
sort:
type: string
description: >-
(Optional) Use this to sort books - ascending for Project Gutenberg ID
numbers from lowest to highest, descending for IDs highest to lowest,
or popular (the default) for most popular to least popular by number
of downloads.
pattern: ^(ascending|descending|popular)$
examples:
- ascending
- descending
- popular
order: 5
topic:
type: string
description: >-
(Optional) Use this to search for a case-insensitive key-phrase in
books' bookshelves or subjects.
examples:
- children
- fantasy
order: 6
additionalProperties: true

metadata:
autoImportSchema:
books: false

schemas:
books:
type: object
$schema: http://json-schema.org/draft-04/schema#
additionalProperties: true
properties:
authors:
type: array
items:
type: object
properties:
birth_year:
type:
- integer
- "null"
death_year:
type:
- integer
- "null"
name:
type: string
required:
- name
- birth_year
- death_year
bookshelves:
type: array
items:
type: string
copyright:
type:
- boolean
- "null"
download_count:
type: integer
formats:
type: object
properties:
application/epub+zip:
type: string
application/octet-stream:
type: string
application/rdf+xml:
type: string
application/x-mobipocket-ebook:
type: string
image/jpeg:
type: string
text/html:
type: string
text/plain; charset=us-ascii:
type: string
id:
type: integer
languages:
type: array
items:
type: string
media_type:
type: string
subjects:
type: array
items:
type: string
title:
type: string
translators:
type: array
items:
type: object
properties:
birth_year:
type:
- integer
- "null"
death_year:
type:
- integer
- "null"
name:
type: string
required:
- name
- birth_year
- death_year
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#


import sys

from airbyte_cdk.entrypoint import launch
from source_gutendex import SourceGutendex

from .source import SourceGutendex


def run():
Expand Down

This file was deleted.

Loading

0 comments on commit 19cfb20

Please sign in to comment.