Food Ordering client library

This section provides documentation for the Node.js client library that is part of the lib.zip download.

Constructor

FoodOrderingActions

new FoodOrderingActions()

            <p>Constructor for building a Food Ordering assistant.</p>
            <dl class="dl-compact">
            </dl>
        </section>
      </section>
      <section>
        <h2>Methods</h2>
        <section>
          <div>
            <h3 id="buildCheckoutResponse" class="symbol-name">buildCheckoutResponse</h3>
            <p class="type-signature"> buildCheckoutResponse(order, transactionConfig)&nbsp;returns&nbsp;Object
            </p>
            <p>Builds structured response for action.foodordering.intent.CHECKOUT built-in action intent.</p>
            <section>
              <h4>Parameters</h4>
              <table class="jsdoc-details-table">
                <thead>
                  <tr>
                    <th>Name</th>
                    <th>Description</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td class="details-table-name">
                      <p>order</p>
                    </td>
                    <td>
                      <p class="details-table-types">Object</p>
                      <p>Order response in the form of ProposedOrder proto.</p>
                    </td>
                  </tr>
                  <tr>
                    <td class="details-table-name">
                      <p>transactionConfig</p>
                    </td>
                    <td>
                      <p class="details-table-types">Object</p>
                      <p>Contains payment parameters.</p>
                    </td>
                  </tr>
                </tbody>
              </table>
            </section>
            <dl class="dl-compact">
              <dt>Returns</dt>
              <dd>
                <p><code>Object</code>&nbsp;Checkout structured response.</p>
              </dd>
            </dl>
            <div>
              <h3 id="buildProposedOrder" class="symbol-name">buildProposedOrder</h3>
              <p class="type-signature"> buildProposedOrder(cart, total_price, delivery_fees, tax)&nbsp;returns&nbsp;Object
              </p>
              <p>Build a proposed order using provider created fields such as cart, delivery_fees, tax. Assigns a random order id to every order.</p>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td class="details-table-name">
                        <p>cart</p>
                      </td>
                      <td>
                        <p class="details-table-types">Object</p>
                        <p>Cart object retrieved from the checkout request.</p>
                      </td>
                    </tr>
                    <tr>
                      <td class="details-table-name">
                        <p>total_price</p>
                      </td>
                      <td>
                        <p class="details-table-types">Object</p>
                        <p>Money object containing the total price.</p>
                      </td>
                    </tr>
                    <tr>
                      <td class="details-table-name">
                        <p>delivery_fees</p>
                      </td>
                      <td>
                        <p class="details-table-types">Object</p>
                        <p>LineItem object denoting delivery fees.</p>
                      </td>
                    </tr>
                    <tr>
                      <td class="details-table-name">
                        <p>tax</p>
                      </td>
                      <td>
                        <p class="details-table-types">Object</p>
                        <p>LineItem object denoting tax.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code>Object</code>&nbsp;ProposedOrder object.</p>
                </dd>
              </dl>
              <div>
                <h3 id="buildTransactionResponse" class="symbol-name">buildTransactionResponse</h3>
                <p class="type-signature"> buildTransactionResponse(google_order_id)&nbsp;returns&nbsp;Object
                </p>
                <p>Builds structured response for action.intent.TRANSACTION_DECISION built-in action intent.</p>
                <section>
                  <h4>Parameter</h4>
                  <table class="jsdoc-details-table">
                    <thead>
                      <tr>
                        <th>Name</th>
                        <th>Description</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td class="details-table-name">
                          <p>google_order_id</p>
                        </td>
                        <td>
                          <p class="details-table-types">string</p>
                          <p>String id of the order.</p>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </section>
                <dl class="dl-compact">
                  <dt>Returns</dt>
                  <dd>
                    <p><code>Object</code>&nbsp;OrderUpdate structured response.</p>
                  </dd>
                </dl>
                <div>
                  <h3 id="doDirectActionResponse" class="symbol-name">doDirectActionResponse</h3>
                  <p class="type-signature"> doDirectActionResponse(structuredResponse)&nbsp;returns&nbsp;Object
                  </p>
                  <p>Executes a built-in action response</p>
                  <section>
                    <h4>Parameter</h4>
                    <table class="jsdoc-details-table">
                      <thead>
                        <tr>
                          <th>Name</th>
                          <th>Description</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <td class="details-table-name">
                            <p>structuredResponse</p>
                          </td>
                          <td>
                            <p class="details-table-types">Object</p>
                            <p>A structured response to Assistant server
                            </p>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </section>
                  <dl class="dl-compact">
                    <dt>Returns</dt>
                    <dd>
                      <p><code>Object</code>&nbsp;Final response to Assistant server.</p>
                    </dd>
                  </dl>
                  <div>
                    <h3 id="doErrorResponse" class="symbol-name">doErrorResponse</h3>
                    <p class="type-signature"> doErrorResponse(foodOrderErrors)&nbsp;returns&nbsp;Object
                    </p>
                    <p>Error handling response.</p>
                    <section>
                      <h4>Parameter</h4>
                      <table class="jsdoc-details-table">
                        <thead>
                          <tr>
                            <th>Name</th>
                            <th>Description</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <td class="details-table-name">
                              <p>foodOrderErrors</p>
                            </td>
                            <td>
                              <p class="details-table-types">Object</p>
                              <p>repeated FoodErrorExtension object.</p>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </section>
                    <dl class="dl-compact">
                      <dt>Returns</dt>
                      <dd>
                        <p><code>Object</code>&nbsp;Final response to Assistant server.</p>
                      </dd>
                    </dl>
                    <div>
                    <h3 id="isRequestFromAssistant" class="symbol-name">isRequestFromAssistant</h3>
                    <p class="type-signature">isRequestFromAssistant(projectId)&nbsp;returns&nbsp;Object
                    </p>
                    <p>Validates whether request is from Assistant through signature verification.</p>
                    <section>
                      <h4>Parameter</h4>
                      <table class="jsdoc-details-table">
                        <thead>
                          <tr>
                            <th>Name</th>
                            <th>Description</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <td class="details-table-name">
                              <p>projectId</p>
                            </td>
                            <td>
                              <p class="details-table-types">string</p>
                              <p>Google Cloud Project ID for the Assistant app.</p>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </section>
                    <dl class="dl-compact">
                      <dt>Returns</dt>
                      <dd>
                        <p><code>Object</code>&nbsp;idToken object.</p>
                      </dd>
                    </dl>
                    <div>
                      <h3 id="getCart" class="symbol-name">getCart</h3>
                      <p class="type-signature"> getCart()&nbsp;returns&nbsp;Object
                      </p>
                      <p>Get the value corresponding to CART agument</p>
                      <dl class="dl-compact">
                        <dt>Returns</dt>
                        <dd>
                          <p><code>Object</code>&nbsp;Value of the argument extension in assistant request payload.
                          </p>
                        </dd>
                      </dl>
                      <div>
                        <h3 id="getTransactionDecisionValue" class="symbol-name">getTransactionDecisionValue</h3>
                        <p class="type-signature"> getTransactionDecisionValue()&nbsp;returns&nbsp;Object
                        </p>
                        <p>Get the value corresponding to TRANSACTION_DECISION</p>
                        <dl class="dl-compact">
                          <dt>Returns</dt>
                          <dd>
                            <p><code>Object</code>&nbsp;Value of the argument called transaction_decision_value in request payload.</p>
                          </dd>
                        </dl>
                        <div>
                          <h3 id="sendOrderUpdateRequestAsync" class="symbol-name">sendOrderUpdateRequestAsync</h3>
                          <p class="type-signature"> sendOrderUpdateRequestAsync(google_order_id)&nbsp;returns&nbsp;Promise
                          </p>
                          <p>Builds an authenticated order update request and sends to assistant push message service.</p>
                          <section>
                            <h4>Parameter</h4>
                            <table class="jsdoc-details-table">
                              <thead>
                                <tr>
                                  <th>Name</th>
                                  <th>Description</th>
                                </tr>
                              </thead>
                              <tbody>
                                <tr>
                                  <td class="details-table-name">
                                    <p>google_order_id</p>
                                  </td>
                                  <td>
                                    <p class="details-table-types">string</p>
                                    <p>Google supplied order id of the order to be updated.
                                    </p>
                                  </td>
                                </tr>
                              </tbody>
                            </table>
                          </section>
                          <dl class="dl-compact">
                            <dt>Returns</dt>
                            <dd>
                              <p><code>Promise</code>&nbsp;A promise function which returns the response/error received from Assistant server after posting an orderUpdate request.</p>
                            </dd>
                          </dl>
                          <div>
                            <h3 id="validateCheckoutRequest" class="symbol-name">validateCheckoutRequest</h3>
                            <p class="type-signature"> validateCheckoutRequest(input)&nbsp;returns&nbsp;Object
                            </p>
                            <p>Validates checkout request for all required parameters. Sends a bad request error if basic things like cart are missing. Sends an error response if partner related errors occur such as item not found, delivery issue etc.</p>
                            <section>
                              <h4>Parameter</h4>
                              <table class="jsdoc-details-table">
                                <thead>
                                  <tr>
                                    <th>Name</th>
                                    <th>Description</th>
                                  </tr>
                                </thead>
                                <tbody>
                                  <tr>
                                    <td class="details-table-name">
                                      <p>input</p>
                                    </td>
                                    <td>
                                      <p class="details-table-types">Object</p>
                                      <p>Checkout Request to be validated.</p>
                                    </td>
                                  </tr>
                                </tbody>
                              </table>
                            </section>
                            <dl class="dl-compact">
                              <dt>Returns</dt>
                              <dd>
                                <p><code>Object</code>&nbsp;FoodErrorExtension object.</p>
                              </dd>
                            </dl>
        </section>
      </section>
      </div>
      </div>
      <nav id="jsdoc-toc-nav" role="navigation"></nav>
      </div>
      </div>