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

Feature: Allow to pass custom data to the dialogflow query #1987

Merged
merged 3 commits into from
Oct 26, 2021
Merged

Feature: Allow to pass custom data to the dialogflow query #1987

merged 3 commits into from
Oct 26, 2021

Conversation

herrlegno
Copy link

Description

This pull request makes possible to inject data into dialogflow query.

Context

This PR tries to add a way to inject data into the dialogflow query, an example is adding custom data to the payload object inside queryParams (dialogflow query reference).

Approach taken / Explain the design

Right know, the options object assumes that the only options that it could receive is credentials. So in order to add more options I isolate this credentials inside its own object, and add a new queryData entry to the options object.

Note: this aproach breaks backwards compatibility.

To document / Usage example

Plugin definition:

{
  id: 'dialogflow',
  resolve: require('@botonic/plugin-dialogflow'),
  options: {
    credentials: {
      type: '',
      project_id: '',
      private_key_id: '',
      private_key: '',
      client_email: '',
      client_id: '',
      auth_uri: '',
      token_uri: '',
      auth_provider_x509_cert_url: '',
      client_x509_cert_url: '',
    },
    queryData: {
      queryParams: {
        payload: {
          source: "botonic"
        }
      }
    },
  },
}

Testing

The pull request modifies current tests to adapt to this new structure.

Copy link

@marcpdw marcpdw left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Comment on lines +13 to +14
defaultQueryData: Options['queryData']
constructor(options: Options) {
Copy link

Choose a reason for hiding this comment

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

The ESLint should be forcing en empty line here IMO. Something to be reviewed in the project

@vanbasten17 vanbasten17 merged commit 5551083 into hubtype:master Oct 26, 2021
@github-actions
Copy link

Unit Test Results

1 files  ±0  1 suites  ±0   3s ⏱️ ±0s
1 tests ±0  1 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 5551083. ± Comparison against base commit 5551083.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants