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

Airtable Integration: Extract AirtableDatasource & leverage it for built-in & dynamic datasources #17

Merged
merged 11 commits into from
Sep 13, 2024

Conversation

jblz
Copy link
Member

@jblz jblz commented Aug 26, 2024

Much of this came in via #39, so I've limited it to abstracting the Airtable config.

The examples pull in a AirtableDatasource and provide a table "variation" (for lack of a better name -- any ideas to improve the API?) instead of hard-coding the endpoint.

This lets us use a similar approach to dynamically register blocks for Airtable sources saved in the db, etc.

use RemoteDataBlocks\Logging\Logger;
use RemoteDataBlocks\Logging\LoggerManager;
use RemoteDataBlocks\REST\DatasourceCRUD;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class should probably get moved out of the REST namespace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

Base automatically changed from update/settings-page to trunk August 26, 2024 18:20
@jblz jblz force-pushed the add/dynamic-block-registration branch from 8769930 to b06aba5 Compare August 26, 2024 20:13
@jblz jblz force-pushed the add/dynamic-block-registration branch from 735af4e to 3206064 Compare September 2, 2024 21:33
Comment on lines 9 to 15
public function set_slug( string $slug ): void {
$this->slug = $slug;
}

public function get_slug(): string {
return $this->slug;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the slug?

cc @shekharnwagh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was meant to be the predictable unique identifier, so that we can reference the credentials in example code using this, and then users could tag the data source in the Settings Page with this slug. So the slug would act as a link between those 2 systems. Earlier we had uuid as unique identifier, but that is not predictable until user adds the data source from Setting Page. Open to other ideas if they seem easier, this was just the first thought that popped into my mind.

@jblz jblz changed the title WIP: Dynamic block registration based on Saved Config Airtable Integration: Extract AirtableDatasource & leverage it for built-in & dynamic datasources Sep 13, 2024
@jblz jblz marked this pull request as ready for review September 13, 2024 15:23
Comment on lines +20 to +26
// Transform data to our experimental format, which is all array based
$config = array_map(
function ( $value ) {
return is_object( $value ) ? (array) $value : $value;
},
(array) $config
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a hack when i was bumbling about in that unmerged try, but, at this point (hopefully) unnecessary.

(though I still think we should array everywhere personally!)

Copy link
Contributor

@mhsdef mhsdef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests out for me. 👍

@jblz jblz merged commit 4d592df into trunk Sep 13, 2024
7 checks passed
@jblz jblz deleted the add/dynamic-block-registration branch September 13, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants