adding order redirect entity and action proto samples
diff --git a/.gitignore b/.gitignore
index 0f245e8..edb9f61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,9 @@
target
bazel-*
generated
+target
+dist
+vendor
+build
+go.mod
+go.sum
\ No newline at end of file
diff --git a/order-redirect/go/action/action.go b/order-redirect/go/action/action.go
new file mode 100644
index 0000000..e60cefd
--- /dev/null
+++ b/order-redirect/go/action/action.go
@@ -0,0 +1,76 @@
+/**
+Example Action feed for Google Order Redirect.
+**/
+
+package main
+
+import (
+ pb "feed/app/generated/google/madden/ingestion"
+ "fmt"
+
+ "google.golang.org/protobuf/encoding/protojson"
+)
+
+func main() {
+ feedJSON := createFeed()
+ fmt.Println(feedJSON)
+}
+
+func createFeed() string {
+ // Create ActionDetail
+ // Example using one link for both delivery and takeout
+ merchantNameCombined := "merchant-1"
+ linkIDCombined := "merchant-1-takeout-delivery-action"
+ urlCombined := "http://provider.com/merchant-1"
+ actionCombined := &pb.ActionDetail{
+ EntityId: &merchantNameCombined,
+ LinkId: &linkIDCombined,
+ Url: &urlCombined,
+ Actions: []*pb.Action{{
+ ActionInfo: &pb.Action_FoodOrderingInfo{
+ FoodOrderingInfo: &pb.FoodOrderingInfo{
+ ServiceType: pb.FoodOrderingInfo_DELIVERY,
+ },
+ }}, {
+ ActionInfo: &pb.Action_FoodOrderingInfo{
+ FoodOrderingInfo: &pb.FoodOrderingInfo{
+ ServiceType: pb.FoodOrderingInfo_TAKEOUT,
+ },
+ }},
+ },
+ }
+
+ // Example using a separate link for delivery
+ merchantNameDelivery := "merchant-2"
+ linkIDDelivery := "merchant-2-delivery-action"
+ urlDelivery := "http://provider.com/merchant-2/delivery"
+ actionDelivery := &pb.ActionDetail{
+ EntityId: &merchantNameDelivery,
+ LinkId: &linkIDDelivery,
+ Url: &urlDelivery,
+ Actions: []*pb.Action{{
+ ActionInfo: &pb.Action_FoodOrderingInfo{
+ FoodOrderingInfo: &pb.FoodOrderingInfo{
+ ServiceType: pb.FoodOrderingInfo_DELIVERY,
+ },
+ }},
+ },
+ }
+
+ // Create ActionFeed
+ feed := &pb.ActionFeed{
+ Data: []*pb.ActionDetail{
+ actionCombined,
+ actionDelivery,
+ },
+ }
+
+ // Serialize to JSON string
+ marshalOptions := protojson.MarshalOptions{
+ UseProtoNames: true,
+ }
+ jsonBytes, _ := marshalOptions.Marshal(feed)
+ return string(jsonBytes)
+}
+
+// [END create_feed]
diff --git a/order-redirect/go/entity/entity.go b/order-redirect/go/entity/entity.go
new file mode 100644
index 0000000..035394b
--- /dev/null
+++ b/order-redirect/go/entity/entity.go
@@ -0,0 +1,55 @@
+/**
+Example Entity feed for Google Order Redirect.
+**/
+
+package main
+
+import (
+ pb "feed/app/generated/google/madden/ingestion"
+ "fmt"
+
+ "google.golang.org/protobuf/encoding/protojson"
+)
+
+func main() {
+ feedJSON := createFeed()
+ fmt.Println(feedJSON)
+}
+
+func createFeed() string {
+
+ // Create Entity
+ entity := &pb.Entity{
+ EntityId: "merchant-id",
+ Name: "Mo's Dinner",
+ Telephone: "+14567891234",
+ Url: "http://moesdinner.com",
+ Location: &pb.GeoCoordinates{
+ Latitude: 41.525588,
+ Longitude: -90.507067,
+ Addresses: &pb.GeoCoordinates_Address{
+ Address: &pb.PostalAddress{
+ Country: "US",
+ Locality: "Mountain View",
+ Region: "CA",
+ PostalCode: "94043",
+ StreetAddress: "1600 Amphitheatre Pkwy",
+ },
+ },
+ },
+ }
+
+ // Create EntityFeed
+ feed := &pb.EntityFeed{
+ Data: []*pb.Entity{
+ entity,
+ },
+ }
+
+ // Serialize to JSON string
+ marshalOptions := protojson.MarshalOptions{
+ UseProtoNames: true,
+ }
+ jsonBytes, _ := marshalOptions.Marshal(feed)
+ return string(jsonBytes)
+}
diff --git a/order-redirect/java/pom.xml b/order-redirect/java/pom.xml
new file mode 100644
index 0000000..fdca852
--- /dev/null
+++ b/order-redirect/java/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.example.order_redirect</groupId>
+ <artifactId>feed</artifactId>
+ <version>1.0.0</version>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <java.version>11.0</java.version>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <protobuf.version>3.22.0</protobuf.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.12</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ <version>${protobuf.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id> <!-- this is used for inheritance merges -->
+ <phase>package</phase> <!-- bind to the packaging phase -->
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/order-redirect/java/src/main/java/com/example/order_redirect/ActionFeedExample.java b/order-redirect/java/src/main/java/com/example/order_redirect/ActionFeedExample.java
new file mode 100644
index 0000000..ee1e697
--- /dev/null
+++ b/order-redirect/java/src/main/java/com/example/order_redirect/ActionFeedExample.java
@@ -0,0 +1,74 @@
+/**
+Example Action feed for Google Order Redirect.
+**/
+
+package com.example.order_redirect;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.util.JsonFormat;
+import com.google.madden.ingestion.ActionFeed;
+import com.google.madden.ingestion.Action;
+import com.google.madden.ingestion.ActionDetail;
+import com.google.madden.ingestion.FoodOrderingInfo;
+
+
+public class ActionFeedExample {
+
+ public static void main(String[] args) throws InvalidProtocolBufferException {
+ ActionFeedExample feed = new ActionFeedExample();
+ String feedJSON = feed.createActionFeed();
+ System.out.println(feedJSON);
+ }
+
+ public String createActionFeed() throws InvalidProtocolBufferException {
+
+ // Create ActionFeed
+ ActionFeed.Builder actionFeed = ActionFeed.newBuilder();
+
+ // Create ActionDetail using one link for both takeout and delivery
+ ActionDetail actionDetailDeliveryTakeout = ActionDetail.newBuilder()
+ .setEntityId("merchant-1")
+ .setLinkId("merchant-1-takeout-delivery-action")
+ .setUrl("http://provider.com/merchant-1")
+ .addActions(
+ Action.newBuilder().setFoodOrderingInfo(
+ FoodOrderingInfo.newBuilder().setServiceType(
+ FoodOrderingInfo.ServiceType.DELIVERY
+ )
+ )
+ )
+ .addActions(
+ Action.newBuilder().setFoodOrderingInfo(
+ FoodOrderingInfo.newBuilder().setServiceType(
+ FoodOrderingInfo.ServiceType.TAKEOUT
+ )
+ )
+ ).build();
+
+ // Add to feed data
+ actionFeed.addData(actionDetailDeliveryTakeout);
+
+ // Create ActionDetail using a separate link for delivery
+ ActionDetail actionDetailDelivery = ActionDetail.newBuilder()
+ .setEntityId("merchant-2")
+ .setLinkId("merchant-2-delivery-action")
+ .setUrl("http://provider.com/merchant-2/delivery")
+ .addActions(
+ Action.newBuilder().setFoodOrderingInfo(
+ FoodOrderingInfo.newBuilder().setServiceType(
+ FoodOrderingInfo.ServiceType.DELIVERY
+ )
+ )
+ ).build();
+
+ // Add to feed data
+ actionFeed.addData(actionDetailDelivery);
+
+ // Serialize feed to JSON string
+ return JsonFormat.printer()
+ .omittingInsignificantWhitespace()
+ .preservingProtoFieldNames()
+ .print(actionFeed);
+ }
+
+}
\ No newline at end of file
diff --git a/order-redirect/java/src/main/java/com/example/order_redirect/EntityFeedExample.java b/order-redirect/java/src/main/java/com/example/order_redirect/EntityFeedExample.java
new file mode 100644
index 0000000..085b4b3
--- /dev/null
+++ b/order-redirect/java/src/main/java/com/example/order_redirect/EntityFeedExample.java
@@ -0,0 +1,56 @@
+/**
+Example Entity feed for Google Order Redirect.
+**/
+
+package com.example.order_redirect;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.util.JsonFormat;
+import com.google.madden.ingestion.EntityFeed;
+import com.google.madden.ingestion.Entity;
+import com.google.madden.ingestion.PostalAddress;
+import com.google.madden.ingestion.GeoCoordinates;
+
+public class EntityFeedExample {
+
+ public static void main(String[] args) throws InvalidProtocolBufferException {
+ EntityFeedExample feed = new EntityFeedExample();
+ String feedJSON = feed.createEntityFeed();
+ System.out.println(feedJSON);
+ }
+
+ public String createEntityFeed() throws InvalidProtocolBufferException {
+
+ // Create Entity
+ Entity entity = Entity.newBuilder()
+ .setEntityId("merchant-1")
+ .setName("Mo's Dinner")
+ .setTelephone("+14567891234")
+ .setUrl("http://moesdinner.com")
+ .setLocation(
+ GeoCoordinates.newBuilder()
+ .setLatitude(41.525588)
+ .setLongitude(-90.507067)
+ .setAddress(
+ PostalAddress.newBuilder()
+ .setCountry("US")
+ .setLocality("Mountain View")
+ .setRegion("CA")
+ .setPostalCode("94043")
+ .setStreetAddress("1600 Amphitheatre Pkwy")
+ .build()
+ )
+ ).build();
+
+
+ // Add to feed data
+ EntityFeed entityFeed = EntityFeed.newBuilder().addData(entity).build();
+
+ // Serialize feed to JSON string
+ return JsonFormat.printer()
+ .omittingInsignificantWhitespace()
+ .preservingProtoFieldNames()
+ .print(entityFeed);
+ }
+
+}
\ No newline at end of file
diff --git a/order-redirect/java/src/test/java/com/example/order_redirect/ActionFeedExampleTest.java b/order-redirect/java/src/test/java/com/example/order_redirect/ActionFeedExampleTest.java
new file mode 100644
index 0000000..cbe0574
--- /dev/null
+++ b/order-redirect/java/src/test/java/com/example/order_redirect/ActionFeedExampleTest.java
@@ -0,0 +1,21 @@
+/**
+Example Action feed for Google Order Redirect.
+**/
+
+package com.example.order_redirect;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+import com.example.order_redirect.ActionFeedExample;
+import com.google.protobuf.InvalidProtocolBufferException;
+
+public class ActionFeedExampleTest {
+
+ @Test
+ public void testCreateActionFeed() throws InvalidProtocolBufferException {
+ ActionFeedExample actionFeedExample = new ActionFeedExample();
+ assertEquals(actionFeedExample.createActionFeed(),"{\"data\":[{\"actions\":[{\"food_ordering_info\":{\"service_type\":\"DELIVERY\"}},{\"food_ordering_info\":{\"service_type\":\"TAKEOUT\"}}],\"entity_id\":\"merchant-1\",\"link_id\":\"merchant-1-takeout-delivery-action\",\"url\":\"http://provider.com/merchant-1\"},{\"actions\":[{\"food_ordering_info\":{\"service_type\":\"DELIVERY\"}}],\"entity_id\":\"merchant-2\",\"link_id\":\"merchant-2-delivery-action\",\"url\":\"http://provider.com/merchant-2/delivery\"}]}");
+ }
+
+}
\ No newline at end of file
diff --git a/order-redirect/php/ActionFeedExample.php b/order-redirect/php/ActionFeedExample.php
new file mode 100644
index 0000000..83558d2
--- /dev/null
+++ b/order-redirect/php/ActionFeedExample.php
@@ -0,0 +1,59 @@
+<?php
+/*
+Example Action feed for Google Order Redirect.
+*/
+
+require dirname(__FILE__).'/vendor/autoload.php';
+
+use Madden\Ingestion\ActionFeed;
+use Madden\Ingestion\ActionDetail;
+use Madden\Ingestion\Action;
+use Madden\Ingestion\FoodOrderingInfo;
+use Madden\Ingestion\FoodOrderingInfo\ServiceType;
+
+function createFeed() {
+ // Create ActionDetail by passing the fields to the constructor
+ $actions = array(
+ // Example using one link for both takeout and delivery
+ new ActionDetail([
+ 'entity_id' => 'merchant-1',
+ 'link_id' => 'merchant-1-takeout-delivery-action',
+ 'actions' => array(
+ new Action([
+ 'food_ordering_info' => new FoodOrderingInfo([
+ 'service_type' => ServiceType::DELIVERY
+ ])
+ ]),
+ new Action([
+ 'food_ordering_info' => new FoodOrderingInfo([
+ 'service_type' => ServiceType::TAKEOUT
+ ])
+ ])
+ ),
+ 'url' => 'http://provider.com/merchant-1'
+ ]),
+ // Example using a separate link for delivery
+ new ActionDetail([
+ 'entity_id' => 'merchant-2',
+ 'link_id' => 'merchant-2-delivery-action',
+ 'actions' => array(
+ new Action([
+ 'food_ordering_info' => new FoodOrderingInfo([
+ 'service_type' => ServiceType::DELIVERY
+ ])
+ ])
+ ),
+ 'url' => 'http://provider.com/merchant-2/delivery'
+ ])
+ );
+
+ // Add ActionDetail array to feed data
+ $feed = new ActionFeed();
+ $feed->setData($actions);
+
+ // Serialize to JSON
+ return $feed->serializeToJsonString();
+}
+
+$feedJSON = createFeed();
+echo $feedJSON;
diff --git a/order-redirect/php/EntityFeedExample.php b/order-redirect/php/EntityFeedExample.php
new file mode 100644
index 0000000..f6ac3c8
--- /dev/null
+++ b/order-redirect/php/EntityFeedExample.php
@@ -0,0 +1,43 @@
+<?php
+/*
+Example Entity feed for Google Order Redirect.
+*/
+
+require dirname(__FILE__).'/vendor/autoload.php';
+
+use Madden\Ingestion\EntityFeed;
+use Madden\Ingestion\Entity;
+use Madden\Ingestion\GeoCoordinates;
+use Madden\Ingestion\PostalAddress;
+
+
+function createFeed() {
+ // Create Entity by using setter methods
+ $entity = new Entity();
+ $entity->setEntityId("merchant-1");
+ $entity->setName("Mo's Dinner");
+ $entity->setTelephone("+14567891234");
+ $entity->setUrl("http://moesdinner.com");
+ $entityLocation = new GeoCoordinates();
+ $entityLocation->setLatitude(41.525588);
+ $entityLocation->setLongitude(-90.507067);
+ $entity->setLocation($entityLocation);
+ $entityAddress = new PostalAddress();
+ $entityAddress->setCountry("US");
+ $entityAddress->setLocality("Mountain View");
+ $entityAddress->setRegion("CA");
+ $entityAddress->setPostalCode("94043");
+ $entityAddress->setStreetAddress("1600 Amphitheatre Pkwy");
+ $entityLocation->setAddress($entityAddress);
+
+ # Add Entity to feed data
+ $feed = new EntityFeed();
+ $feed->setData(array($entity));
+
+ # Serialize to JSON
+ return $feed->serializeToJsonString();
+}
+
+$feedJSON = createFeed();
+echo $feedJSON;
+
diff --git a/order-redirect/php/composer.json b/order-redirect/php/composer.json
new file mode 100644
index 0000000..8798557
--- /dev/null
+++ b/order-redirect/php/composer.json
@@ -0,0 +1,15 @@
+{
+ "name": "google-order-redirect/php-demo",
+ "description": "proto example for PHP",
+ "require": {
+ "google/protobuf": "^v3.12.2"
+ },
+ "autoload": {
+ "psr-4": {
+ "Madden\\": "build/gen/Madden",
+ "GPBMetadata\\": "build/gen/GPBMetadata/",
+ "Food\\": "build/gen/Food",
+ "Google\\": "build/gen/Google"
+ }
+ }
+ }
\ No newline at end of file
diff --git a/order-redirect/php/composer.lock b/order-redirect/php/composer.lock
new file mode 100644
index 0000000..0eba1e6
--- /dev/null
+++ b/order-redirect/php/composer.lock
@@ -0,0 +1,63 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "724b35a1604b000b76542b5f31d8cb69",
+ "packages": [
+ {
+ "name": "google/protobuf",
+ "version": "v3.25.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/protocolbuffers/protobuf-php.git",
+ "reference": "1fb247e72df401c863ed239c1660f981644af5db"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/1fb247e72df401c863ed239c1660f981644af5db",
+ "reference": "1fb247e72df401c863ed239c1660f981644af5db",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": ">=5.0.0"
+ },
+ "suggest": {
+ "ext-bcmath": "Need to support JSON deserialization"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Google\\Protobuf\\": "src/Google/Protobuf",
+ "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "proto library for PHP",
+ "homepage": "https://developers.google.com/protocol-buffers/",
+ "keywords": [
+ "proto"
+ ],
+ "support": {
+ "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.25.1"
+ },
+ "time": "2023-11-15T21:36:03+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.6.0"
+}
diff --git a/order-redirect/proto/action.proto b/order-redirect/proto/action.proto
index 3ba4a59..b26cee7 100644
--- a/order-redirect/proto/action.proto
+++ b/order-redirect/proto/action.proto
@@ -4,6 +4,10 @@
package madden.ingestion;
+option java_multiple_files = true;
+option java_package = "com.google.madden.ingestion";
+option go_package = "google/madden/ingestion";
+
message ActionFeed {
repeated ActionDetail data = 1;
}
@@ -11,7 +15,6 @@
message ActionDetail {
// Reference to entity id
optional string entity_id = 2;
- // Link id for action detail
optional string link_id = 3;
// Deep link for action detail
optional string url = 4;
@@ -42,4 +45,3 @@
}
ServiceType service_type = 1;
}
-
diff --git a/order-redirect/proto/entity.proto b/order-redirect/proto/entity.proto
index 6df538f..451c639 100644
--- a/order-redirect/proto/entity.proto
+++ b/order-redirect/proto/entity.proto
@@ -1,9 +1,12 @@
-
// Feeds declaration
syntax = "proto3";
package madden.ingestion;
+option java_multiple_files = true;
+option java_package = "com.google.madden.ingestion";
+option go_package = "google/madden/ingestion";
+
message EntityFeed {
repeated Entity data = 1;
}
@@ -65,5 +68,4 @@
string postal_code = 4;
// The street address, e.g. "1600 Amphitheatre Pkwy". (required)
string street_address = 5;
-}
-
+}
\ No newline at end of file
diff --git a/order-redirect/proto/food-service.proto b/order-redirect/proto/food-service.proto
index 047cea2..e5151c9 100644
--- a/order-redirect/proto/food-service.proto
+++ b/order-redirect/proto/food-service.proto
@@ -6,13 +6,14 @@
option go_package = "google/food/ordering/services/v1";
option java_package = "com.google.food.ordering.services.v1";
+option java_multiple_files = true;
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
-import "timeofday.proto";
-import "latlng.proto";
-import "money.proto";
-import "dayofweek.proto";
+import "google/type/timeofday.proto";
+import "google/type/latlng.proto";
+import "google/type/money.proto";
+import "google/type/dayofweek.proto";
// Food Ordering Team's EPA Service Feeds Spec.
message FoodServiceFeed {
@@ -168,7 +169,7 @@
// When advance ordering services, this is the time windows the orders can be
// placed.
- // Optional. Required when advance_hour is given.
+ // Required when advance_hour is given. Invalid when asap_hour is given.
repeated TimeOfDayWindow orderable_time = 5
;
@@ -310,4 +311,3 @@
repeated string area_ids = 7
;
}
-
diff --git a/order-redirect/proto/dayofweek.proto b/order-redirect/proto/google/type/dayofweek.proto
similarity index 100%
rename from order-redirect/proto/dayofweek.proto
rename to order-redirect/proto/google/type/dayofweek.proto
diff --git a/order-redirect/proto/latlng.proto b/order-redirect/proto/google/type/latlng.proto
similarity index 100%
rename from order-redirect/proto/latlng.proto
rename to order-redirect/proto/google/type/latlng.proto
diff --git a/order-redirect/proto/money.proto b/order-redirect/proto/google/type/money.proto
similarity index 100%
rename from order-redirect/proto/money.proto
rename to order-redirect/proto/google/type/money.proto
diff --git a/order-redirect/proto/timeofday.proto b/order-redirect/proto/google/type/timeofday.proto
similarity index 100%
rename from order-redirect/proto/timeofday.proto
rename to order-redirect/proto/google/type/timeofday.proto
diff --git a/order-redirect/python/action_feed.py b/order-redirect/python/action_feed.py
deleted file mode 100644
index c2f19ea..0000000
--- a/order-redirect/python/action_feed.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import json
-from generated import action_pb2
-from google.protobuf.json_format import MessageToDict
-
-#create feed
-feed = action_pb2.ActionFeed()
-
-#create action
-action = feed.data.add()
-action.entity_id = 'merchant-1'
-action.link_id = 'merchant-1-takeout-delivery-action'
-action.actions.extend([
- action_pb2.Action(
- food_ordering_info=action_pb2.FoodOrderingInfo(
- service_type=action_pb2.FoodOrderingInfo.ServiceType.DELIVERY
- )
- ),
- action_pb2.Action(
- food_ordering_info=action_pb2.FoodOrderingInfo(
- service_type=action_pb2.FoodOrderingInfo.ServiceType.TAKEOUT
- )
- )
-])
-action.url = "http://provider.com/merchant-1"
-
-feedJSON = json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
-print(feedJSON)
-
diff --git a/order-redirect/python/action_feed_example.py b/order-redirect/python/action_feed_example.py
new file mode 100644
index 0000000..8e3027e
--- /dev/null
+++ b/order-redirect/python/action_feed_example.py
@@ -0,0 +1,58 @@
+'''
+Example Action feed for Google Order Redirect.
+'''
+
+import json
+from generated import action_pb2
+from google.protobuf.json_format import MessageToDict
+
+def create_feed() -> str:
+ # Create ActionFeed
+ feed = action_pb2.ActionFeed()
+
+ # Create ActionDetail by passing fields to the constructor
+ # Example using the same link for delivery and takeout
+ action_detail_combined = action_pb2.ActionDetail(
+ entity_id='merchant-1',
+ link_id='merchant-1-takeout-delivery-action',
+ url='http://provider.com/merchant-1',
+ actions=[
+ action_pb2.Action(
+ food_ordering_info=action_pb2.FoodOrderingInfo(
+ service_type=action_pb2.FoodOrderingInfo.ServiceType.DELIVERY
+ )
+ ),
+ action_pb2.Action(
+ food_ordering_info=action_pb2.FoodOrderingInfo(
+ service_type=action_pb2.FoodOrderingInfo.ServiceType.TAKEOUT
+ )
+ )
+ ]
+ )
+
+ # Add ActionDetail to data
+ feed.data.append(action_detail_combined)
+
+ # Example using separate link for delivery
+ action_detail_delivery = action_pb2.ActionDetail(
+ entity_id='merchant-2',
+ link_id='merchant-2-delivery-action',
+ url='http://provider.com/merchant-2/delivery',
+ actions=[
+ action_pb2.Action(
+ food_ordering_info=action_pb2.FoodOrderingInfo(
+ service_type=action_pb2.FoodOrderingInfo.ServiceType.DELIVERY
+ )
+ )
+ ]
+ )
+
+ # Add ActionDetail to feed data
+ feed.data.append(action_detail_delivery)
+
+ # Serialize feed to JSON string
+ return json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
+
+feedJSON = create_feed()
+print(feedJSON)
+
diff --git a/order-redirect/python/entity_feed.py b/order-redirect/python/entity_feed.py
deleted file mode 100644
index 044247a..0000000
--- a/order-redirect/python/entity_feed.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import json
-from generated import entity_pb2
-from google.protobuf.json_format import MessageToDict
-
-#create feed
-feed = entity_pb2.EntityFeed()
-
-#create entity
-entity = feed.data.add()
-entity.entity_id = 'merchant-1'
-entity.name = "Mo's Dinner"
-entity.telephone = '+14567891234'
-entity.url = 'http://moesdinner.com'
-
-#create location
-location = entity.location
-location.latitude = 41.525588
-location.longitude = -90.507067
-
-#create address
-address = location.address
-address.country = 'US'
-address.locality = 'Mountain View'
-address.region = 'CA'
-address.postal_code = '94043'
-address.street_address = '1600 Amphitheatre Pkwy'
-
-feedJSON = json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
-print(feedJSON)
-
diff --git a/order-redirect/python/entity_feed_example.py b/order-redirect/python/entity_feed_example.py
new file mode 100644
index 0000000..a67f775
--- /dev/null
+++ b/order-redirect/python/entity_feed_example.py
@@ -0,0 +1,38 @@
+'''
+Example Action feed for Google Order Redirect.
+'''
+
+import json
+from generated import entity_pb2
+from google.protobuf.json_format import MessageToDict
+
+def create_feed() -> str:
+ # Create feeds
+ feed = entity_pb2.EntityFeed()
+
+ # Create entity and add to feed data
+ entity = feed.data.add()
+ entity.entity_id = 'merchant-1'
+ entity.name = "Mo's Dinner"
+ entity.telephone = '+14567891234'
+ entity.url = 'http://moesdinner.com'
+
+ # Create location
+ location = entity.location
+ location.latitude = 41.525588
+ location.longitude = -90.507067
+
+ # Create address
+ address = location.address
+ address.country = 'US'
+ address.locality = 'Mountain View'
+ address.region = 'CA'
+ address.postal_code = '94043'
+ address.street_address = '1600 Amphitheatre Pkwy'
+
+ # Serialize feed to JSON string
+ return json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
+
+feedJSON = create_feed()
+print(feedJSON)
+
diff --git a/order-redirect/python/service_feed.py b/order-redirect/python/service_feed.py
deleted file mode 100644
index 98aaf1c..0000000
--- a/order-redirect/python/service_feed.py
+++ /dev/null
@@ -1,90 +0,0 @@
-import json
-from generated import food_service_pb2
-from generated import timeofday_pb2
-from google.protobuf.json_format import MessageToDict
-
-#create feed
-feed = food_service_pb2.FoodServiceFeed()
-
-#create food_service
-service_data = feed.data.add()
-service_data.service.service_id = 'merchant-1-service-delivery'
-service_data.service.service_type = food_service_pb2.FoodOrderingService.ServiceType.DELIVERY
-service_data.service.parent_entity_id = 'merchant-1'
-service_data.service.lead_time.min_lead_time_duration.seconds = 1200
-service_data.service.action_link_id = 'merchant-1-takeout-delivery-action'
-
-#create fee
-fee_data = feed.data.add()
-fee_data.fee.fee_id = 'merchant-1-fee-delivery'
-fee_data.fee.fee_type = food_service_pb2.Fee.FeeType.DELIVERY
-fee_data.fee.fixed_amount.currency_code = 'USD'
-fee_data.fee.fixed_amount.units = 2
-fee_data.fee.service_ids.append('merchant-1-service-delivery')
-
-#create asap service hours
-asap_hours_data = feed.data.add()
-asap_hours_data.service_hours.hours_id = 'merchant-1-asap-hours-delivery'
-asap_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
-asap_hours = asap_hours_data.service_hours.asap_hours.add()
-asap_hours.time_windows.MergeFrom(food_service_pb2.TimeOfDayWindow(
- time_windows=food_service_pb2.TimeOfDayRange(
- open_time=timeofday_pb2.TimeOfDay(
- hours=11,
- minutes=00
- ),
- close_time=timeofday_pb2.TimeOfDay(
- hours=22,
- minutes=30
- )
- )
- )
-)
-asap_hours.lead_time.min_lead_time_duration.seconds = 2400
-
-#create advance service hours
-advance_hours_data = feed.data.add()
-advance_hours_data.service_hours.hours_id = 'merchant-1-advance-hours-delivery'
-advance_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
-advance_hours = advance_hours_data.service_hours.advance_hours.add()
-advance_hours.time_windows.MergeFrom(food_service_pb2.TimeOfDayWindow(
- time_windows=food_service_pb2.TimeOfDayRange(
- open_time=timeofday_pb2.TimeOfDay(
- hours=11,
- minutes=00
- ),
- close_time=timeofday_pb2.TimeOfDay(
- hours=22,
- minutes=00
- )
- )
- )
-)
-advance_hours.advance_booking_interval.min_offset.seconds = 60*60
-advance_hours.advance_booking_interval.max_offset.seconds = 60*60*24*3
-
-orderable_time = advance_hours_data.service_hours.orderable_time.append(
- food_service_pb2.TimeOfDayWindow(
- time_windows=food_service_pb2.TimeOfDayRange(
- open_time=timeofday_pb2.TimeOfDay(
- hours=00,
- minutes=00
- ),
- close_time=timeofday_pb2.TimeOfDay(
- hours=23,
- minutes=59
- )
- )
- )
-)
-
-#create service area
-service_area_data = feed.data.add()
-service_area_data.service_area.area_id = 'merchant-1-area-delivery'
-service_area_data.service_area.service_ids.append('merchant-1-service-delivery')
-service_area_data.service_area.circle.center.latitude = 37.4215576
-service_area_data.service_area.circle.center.longitude = -122.0951056
-service_area_data.service_area.circle.radius = 5000
-
-feedJSON = json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
-print(feedJSON)
\ No newline at end of file
diff --git a/order-redirect/python/service_feed_example.py b/order-redirect/python/service_feed_example.py
new file mode 100644
index 0000000..32f92d6
--- /dev/null
+++ b/order-redirect/python/service_feed_example.py
@@ -0,0 +1,99 @@
+'''
+Example Service feed for Google Order Redirect.
+'''
+
+import json
+from generated import food_service_pb2
+from generated.google.type import timeofday_pb2
+from google.protobuf.json_format import MessageToDict
+
+def create_feed() -> str:
+ # Create feed
+ feed = food_service_pb2.FoodServiceFeed()
+
+ # Create delivery service
+ delivery_service_data = feed.data.add()
+ delivery_service_data.service.service_id = 'merchant-1-service-delivery'
+ delivery_service_data.service.service_type = food_service_pb2.FoodOrderingService.ServiceType.DELIVERY
+ delivery_service_data.service.parent_entity_id = 'merchant-1'
+ delivery_service_data.service.lead_time.min_lead_time_duration.seconds = 60*20
+ delivery_service_data.service.lead_time.min_lead_time_duration.seconds = 60*30
+ delivery_service_data.service.action_link_id = 'merchant-1-takeout-delivery-action'
+
+ # Create fee
+ fee_data = feed.data.add()
+ fee_data.fee.fee_id = 'merchant-1-fee-delivery'
+ fee_data.fee.fee_type = food_service_pb2.Fee.FeeType.DELIVERY
+ fee_data.fee.fixed_amount.currency_code = 'USD'
+ fee_data.fee.fixed_amount.units = 2
+ fee_data.fee.service_ids.append('merchant-1-service-delivery')
+
+ # Create asap service hours
+ asap_hours_data = feed.data.add()
+ asap_hours_data.service_hours.hours_id = 'merchant-1-asap-hours-delivery'
+ asap_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
+ asap_hours = asap_hours_data.service_hours.asap_hours.add()
+ asap_hours.time_windows.CopyFrom(food_service_pb2.TimeOfDayWindow(
+ time_windows=food_service_pb2.TimeOfDayRange(
+ open_time=timeofday_pb2.TimeOfDay(
+ hours=11,
+ minutes=0
+ ),
+ close_time=timeofday_pb2.TimeOfDay(
+ hours=22,
+ minutes=30
+ )
+ )
+ )
+ )
+ asap_hours.lead_time.min_lead_time_duration.seconds = 2400
+
+ # Create advance service hours
+ advance_hours_data = feed.data.add()
+ advance_hours_data.service_hours.hours_id = 'merchant-1-advance-hours-delivery'
+ advance_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
+ advance_hours = advance_hours_data.service_hours.advance_hours.add()
+ advance_hours.time_windows.CopyFrom(food_service_pb2.TimeOfDayWindow(
+ time_windows=food_service_pb2.TimeOfDayRange(
+ open_time=timeofday_pb2.TimeOfDay(
+ hours=11,
+ minutes=0
+ ),
+ close_time=timeofday_pb2.TimeOfDay(
+ hours=22,
+ minutes=0
+ )
+ )
+ )
+ )
+ advance_hours.advance_booking_interval.min_offset.seconds = 60*60
+ advance_hours.advance_booking_interval.max_offset.seconds = 60*60*24*3
+ # Create advance hour orderable time
+ orderable_time = advance_hours_data.service_hours.orderable_time.append(
+ food_service_pb2.TimeOfDayWindow(
+ time_windows=food_service_pb2.TimeOfDayRange(
+ open_time=timeofday_pb2.TimeOfDay(
+ hours=0,
+ minutes=0
+ ),
+ close_time=timeofday_pb2.TimeOfDay(
+ hours=23,
+ minutes=59
+ )
+ )
+ )
+ )
+
+ # Create service area
+ service_area_data = feed.data.add()
+ service_area_data.service_area.area_id = 'merchant-1-area-delivery'
+ service_area_data.service_area.service_ids.append('merchant-1-service-delivery')
+ service_area_data.service_area.circle.center.latitude = 37.4215576
+ service_area_data.service_area.circle.center.longitude = -122.0951056
+ service_area_data.service_area.circle.radius = 5000
+
+ # Serialize to JSON string
+ return json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
+
+feedJSON = create_feed()
+print(feedJSON)
\ No newline at end of file
diff --git a/order-redirect/typescript/package-lock.json b/order-redirect/typescript/package-lock.json
new file mode 100644
index 0000000..769773f
--- /dev/null
+++ b/order-redirect/typescript/package-lock.json
@@ -0,0 +1,333 @@
+{
+ "name": "typescript",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "typescript",
+ "version": "1.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "ts-proto": "^1.165.0"
+ },
+ "devDependencies": {
+ "typescript": "^5.3.2"
+ }
+ },
+ "node_modules/@protobufjs/aspromise": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
+ },
+ "node_modules/@protobufjs/base64": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
+ },
+ "node_modules/@protobufjs/codegen": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
+ "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
+ },
+ "node_modules/@protobufjs/eventemitter": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
+ "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
+ },
+ "node_modules/@protobufjs/fetch": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
+ "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.1",
+ "@protobufjs/inquire": "^1.1.0"
+ }
+ },
+ "node_modules/@protobufjs/float": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
+ },
+ "node_modules/@protobufjs/inquire": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
+ "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
+ },
+ "node_modules/@protobufjs/path": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
+ },
+ "node_modules/@protobufjs/pool": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
+ },
+ "node_modules/@protobufjs/utf8": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
+ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
+ },
+ "node_modules/@types/node": {
+ "version": "20.10.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.1.tgz",
+ "integrity": "sha512-T2qwhjWwGH81vUEx4EXmBKsTJRXFXNZTL4v0gi01+zyBmCwzE6TyHszqX01m+QHTEq+EZNo13NeJIdEqf+Myrg==",
+ "dependencies": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "node_modules/case-anything": {
+ "version": "2.1.13",
+ "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz",
+ "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==",
+ "engines": {
+ "node": ">=12.13"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mesqueeb"
+ }
+ },
+ "node_modules/detect-libc": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
+ "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
+ "bin": {
+ "detect-libc": "bin/detect-libc.js"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/dprint-node": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz",
+ "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==",
+ "dependencies": {
+ "detect-libc": "^1.0.3"
+ }
+ },
+ "node_modules/long": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
+ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q=="
+ },
+ "node_modules/protobufjs": {
+ "version": "7.2.5",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+ "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
+ "hasInstallScript": true,
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.2",
+ "@protobufjs/base64": "^1.1.2",
+ "@protobufjs/codegen": "^2.0.4",
+ "@protobufjs/eventemitter": "^1.1.0",
+ "@protobufjs/fetch": "^1.1.0",
+ "@protobufjs/float": "^1.0.2",
+ "@protobufjs/inquire": "^1.1.0",
+ "@protobufjs/path": "^1.1.2",
+ "@protobufjs/pool": "^1.1.0",
+ "@protobufjs/utf8": "^1.1.0",
+ "@types/node": ">=13.7.0",
+ "long": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/ts-poet": {
+ "version": "6.6.0",
+ "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.6.0.tgz",
+ "integrity": "sha512-4vEH/wkhcjRPFOdBwIh9ItO6jOoumVLRF4aABDX5JSNEubSqwOulihxQPqai+OkuygJm3WYMInxXQX4QwVNMuw==",
+ "dependencies": {
+ "dprint-node": "^1.0.7"
+ }
+ },
+ "node_modules/ts-proto": {
+ "version": "1.165.0",
+ "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.165.0.tgz",
+ "integrity": "sha512-s7+RR/hcCXq8E4jDzwsaq0RXyVpu2pQ4XkT7meBA19xRrHWC32gfwMupcQrnpzoaR7n/F69AvK6FUyW7R+jYZQ==",
+ "dependencies": {
+ "case-anything": "^2.1.13",
+ "protobufjs": "^7.2.4",
+ "ts-poet": "^6.5.0",
+ "ts-proto-descriptors": "1.15.0"
+ },
+ "bin": {
+ "protoc-gen-ts_proto": "protoc-gen-ts_proto"
+ }
+ },
+ "node_modules/ts-proto-descriptors": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz",
+ "integrity": "sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg==",
+ "dependencies": {
+ "long": "^5.2.3",
+ "protobufjs": "^7.2.4"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
+ "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
+ "dev": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "5.26.5",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
+ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
+ }
+ },
+ "dependencies": {
+ "@protobufjs/aspromise": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
+ },
+ "@protobufjs/base64": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
+ },
+ "@protobufjs/codegen": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
+ "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
+ },
+ "@protobufjs/eventemitter": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
+ "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
+ },
+ "@protobufjs/fetch": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
+ "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
+ "requires": {
+ "@protobufjs/aspromise": "^1.1.1",
+ "@protobufjs/inquire": "^1.1.0"
+ }
+ },
+ "@protobufjs/float": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
+ },
+ "@protobufjs/inquire": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
+ "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
+ },
+ "@protobufjs/path": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
+ },
+ "@protobufjs/pool": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
+ },
+ "@protobufjs/utf8": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
+ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
+ },
+ "@types/node": {
+ "version": "20.10.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.1.tgz",
+ "integrity": "sha512-T2qwhjWwGH81vUEx4EXmBKsTJRXFXNZTL4v0gi01+zyBmCwzE6TyHszqX01m+QHTEq+EZNo13NeJIdEqf+Myrg==",
+ "requires": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "case-anything": {
+ "version": "2.1.13",
+ "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz",
+ "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng=="
+ },
+ "detect-libc": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
+ "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="
+ },
+ "dprint-node": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz",
+ "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==",
+ "requires": {
+ "detect-libc": "^1.0.3"
+ }
+ },
+ "long": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
+ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q=="
+ },
+ "protobufjs": {
+ "version": "7.2.5",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+ "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
+ "requires": {
+ "@protobufjs/aspromise": "^1.1.2",
+ "@protobufjs/base64": "^1.1.2",
+ "@protobufjs/codegen": "^2.0.4",
+ "@protobufjs/eventemitter": "^1.1.0",
+ "@protobufjs/fetch": "^1.1.0",
+ "@protobufjs/float": "^1.0.2",
+ "@protobufjs/inquire": "^1.1.0",
+ "@protobufjs/path": "^1.1.2",
+ "@protobufjs/pool": "^1.1.0",
+ "@protobufjs/utf8": "^1.1.0",
+ "@types/node": ">=13.7.0",
+ "long": "^5.0.0"
+ }
+ },
+ "ts-poet": {
+ "version": "6.6.0",
+ "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.6.0.tgz",
+ "integrity": "sha512-4vEH/wkhcjRPFOdBwIh9ItO6jOoumVLRF4aABDX5JSNEubSqwOulihxQPqai+OkuygJm3WYMInxXQX4QwVNMuw==",
+ "requires": {
+ "dprint-node": "^1.0.7"
+ }
+ },
+ "ts-proto": {
+ "version": "1.165.0",
+ "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.165.0.tgz",
+ "integrity": "sha512-s7+RR/hcCXq8E4jDzwsaq0RXyVpu2pQ4XkT7meBA19xRrHWC32gfwMupcQrnpzoaR7n/F69AvK6FUyW7R+jYZQ==",
+ "requires": {
+ "case-anything": "^2.1.13",
+ "protobufjs": "^7.2.4",
+ "ts-poet": "^6.5.0",
+ "ts-proto-descriptors": "1.15.0"
+ }
+ },
+ "ts-proto-descriptors": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz",
+ "integrity": "sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg==",
+ "requires": {
+ "long": "^5.2.3",
+ "protobufjs": "^7.2.4"
+ }
+ },
+ "typescript": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
+ "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
+ "dev": true
+ },
+ "undici-types": {
+ "version": "5.26.5",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
+ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
+ }
+ }
+}
diff --git a/order-redirect/typescript/package.json b/order-redirect/typescript/package.json
new file mode 100644
index 0000000..354d635
--- /dev/null
+++ b/order-redirect/typescript/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "google-order-redirect-typescript-demo",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build": "tsc --build",
+ "clean": "tsc --build --clean"
+ },
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "typescript": "^5.3.2"
+ },
+ "dependencies": {
+ "ts-proto": "^1.165.0"
+ }
+}
diff --git a/order-redirect/typescript/src/action_feed_example.ts b/order-redirect/typescript/src/action_feed_example.ts
new file mode 100644
index 0000000..7526eaa
--- /dev/null
+++ b/order-redirect/typescript/src/action_feed_example.ts
@@ -0,0 +1,53 @@
+/*
+Example Action feed for Google Order Redirect.
+*/
+
+import {
+ ActionFeed, ActionDetail, FoodOrderingInfo_ServiceType
+} from './generated/action';
+
+function createFeed() : string {
+ // Create ActionDetail using one link for both delivery and takeout
+ const actionDetailCombined: ActionDetail = {
+ entity_id: 'merchant-1',
+ link_id: 'merchant-1-takeout-delivery-action',
+ actions: [
+ {
+ food_ordering_info: {
+ service_type: FoodOrderingInfo_ServiceType.DELIVERY
+ }
+ },
+ {
+ food_ordering_info: {
+ service_type: FoodOrderingInfo_ServiceType.TAKEOUT
+ }
+ }
+ ],
+ url: 'http://provider.com/merchant-1'
+ };
+
+ // Create ActionDetail using a separate link for delivery
+ const actionDetailDelivery: ActionDetail = {
+ entity_id: 'merchant-2',
+ link_id: 'merchant-2-delivery-action',
+ actions: [
+ {
+ food_ordering_info: {
+ service_type: FoodOrderingInfo_ServiceType.DELIVERY
+ }
+ }
+ ],
+ url: 'http://provider.com/merchant-2/delivery'
+ };
+
+ // Add ActionDetail to feed data array
+ const feed: ActionFeed = {
+ data:[actionDetailCombined, actionDetailDelivery]
+ };
+
+ // Serialize feed to JSON
+ return JSON.stringify(feed);
+}
+
+const feedJSON = createFeed();
+console.log(feedJSON);
diff --git a/order-redirect/typescript/src/entity_feed_example.ts b/order-redirect/typescript/src/entity_feed_example.ts
new file mode 100644
index 0000000..0c043a9
--- /dev/null
+++ b/order-redirect/typescript/src/entity_feed_example.ts
@@ -0,0 +1,39 @@
+/*
+Example Entity feed for Google Order Redirect.
+*/
+
+import {
+ EntityFeed, Entity
+} from './generated/entity';
+
+function createFeed() : string {
+ // Create Entity
+ const entity: Entity = {
+ entity_id: 'merchant-1',
+ name: "Mo's Dinner",
+ telephone: '+14567891234',
+ url: 'http://moesdinner.com',
+ location: {
+ latitude: 41.525588,
+ longitude: -90.507067,
+ address: {
+ country: 'US',
+ locality: 'Mountain View',
+ region: 'CA',
+ postal_code: '94043',
+ street_address: '1600 Amphitheatre Pkwy'
+ }
+ }
+ };
+
+ // Add Entity to feed data array
+ const feed: EntityFeed = {
+ data: [entity]
+ };
+
+ // Serialize feed to JSON
+ return JSON.stringify(feed);
+}
+
+const feedJSON = createFeed();
+console.log(feedJSON);
diff --git a/order-redirect/typescript/tsconfig.json b/order-redirect/typescript/tsconfig.json
new file mode 100644
index 0000000..b9cbb66
--- /dev/null
+++ b/order-redirect/typescript/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "include": ["src/**/*"],
+ "compilerOptions": {
+ "outDir": "dist",
+ "rootDir": "src",
+ "allowJs": true,
+ "target": "ES2020",
+ "module": "commonjs",
+ "declaration": false,
+ "sourceMap": true,
+ "strict": true,
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true
+ }
+}
\ No newline at end of file