Skip to content

Commit

Permalink
Wordle API (#417)
Browse files Browse the repository at this point in the history
* add wordle api

* update wordle readme
  • Loading branch information
asim committed May 10, 2022
1 parent 4f77149 commit 9ae89b5
Show file tree
Hide file tree
Showing 20 changed files with 17,300 additions and 21 deletions.
106 changes: 89 additions & 17 deletions go.mod
@@ -1,6 +1,6 @@
module github.com/micro/services

go 1.15
go 1.17

require (
cloud.google.com/go/translate v1.0.0
Expand All @@ -10,7 +10,6 @@ require (
github.com/asim/mq v0.1.0
github.com/aws/aws-sdk-go v1.42.17
github.com/bitly/go-simplejson v0.5.0
github.com/cdipaolo/goml v0.0.0-20190412180403-e1f51f713598 // indirect
github.com/cdipaolo/sentiment v0.0.0-20200617002423-c697f64e7f10
github.com/crufter/lexer v0.0.0-20120907053443-23fe8c7add01
github.com/dghubble/go-twitter v0.0.0-20210609183100-2fdbf421508e
Expand All @@ -27,17 +26,11 @@ require (
github.com/hashicorp/golang-lru v0.5.3
github.com/iverly/go-mcping v1.0.1-0.20200818104507-3d8fc23750ae
github.com/jackc/pgx/v4 v4.10.1
github.com/kevinburke/go-types v0.0.0-20201208005256-aee49f568a20 // indirect
github.com/kevinburke/go.uuid v1.2.0 // indirect
github.com/kevinburke/rest v0.0.0-20210506044642-5611499aa33c // indirect
github.com/kevinburke/twilio-go v0.0.0-20210327194925-1623146bcf73
github.com/lib/pq v1.9.0 // indirect
github.com/likexian/doh-go v0.6.4
github.com/m3o/goduckgo v0.0.0-20210630141545-c760fe67b945
github.com/mattheath/base62 v0.0.0-20150408093626-b80cdc656a7a // indirect
github.com/mattheath/kala v0.0.0-20171219141654-d6276794bf0e
github.com/micro/micro/v3 v3.9.1-0.20220227222118-3d0aa50678fe
github.com/miekg/dns v1.1.31 // indirect
github.com/minio/minio-go/v7 v7.0.16
github.com/o1egl/govatar v0.3.0
github.com/onsi/gomega v1.10.5
Expand All @@ -49,30 +42,109 @@ require (
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.3.0
github.com/robfig/cron/v3 v3.0.1
github.com/sendgrid/rest v2.6.4+incompatible // indirect
github.com/sendgrid/sendgrid-go v3.10.0+incompatible
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/stretchr/testify v1.7.0
github.com/teamwork/test v0.0.0-20200108114543-02621bae84ad // indirect
github.com/teamwork/utils v0.0.0-20211103135549-f7e7a68ba696 // indirect
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tkuchiki/go-timezone v0.2.2
github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
github.com/ttacon/libphonenumber v1.2.1 // indirect
github.com/xanzy/go-gitlab v0.35.1
go.mongodb.org/mongo-driver v1.7.2
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
golang.org/x/text v0.3.6
google.golang.org/api v0.59.0
google.golang.org/grpc/examples v0.0.0-20211103202053-3b94303f3754 // indirect
google.golang.org/protobuf v1.27.1
googlemaps.github.io/maps v1.3.1
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
gorm.io/datatypes v1.0.1
gorm.io/driver/postgres v1.0.8
gorm.io/gorm v1.21.10
)

require (
cloud.google.com/go v0.97.0 // indirect
github.com/andybalholm/cascadia v1.1.0 // indirect
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/cdipaolo/goml v0.0.0-20190412180403-e1f51f713598 // indirect
github.com/cenkalti/backoff v2.1.1+incompatible // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dghubble/sling v1.3.0 // indirect
github.com/evanphx/json-patch/v5 v5.0.0 // indirect
github.com/go-acme/lego/v3 v3.4.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hablullah/go-juliandays v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-retryablehttp v0.6.4 // indirect
github.com/hashicorp/go-version v1.2.1 // indirect
github.com/hpcloud/tail v1.0.0 // indirect
github.com/improbable-eng/grpc-web v0.13.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.8.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.0.6 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.6.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmoiron/jsonq v0.0.0-20150511023944-e874b168d07e // indirect
github.com/kevinburke/go-types v0.0.0-20201208005256-aee49f568a20 // indirect
github.com/kevinburke/go.uuid v1.2.0 // indirect
github.com/kevinburke/rest v0.0.0-20210506044642-5611499aa33c // indirect
github.com/klauspost/compress v1.13.5 // indirect
github.com/lib/pq v1.9.0 // indirect
github.com/likexian/gokit v0.21.11 // indirect
github.com/mattheath/base62 v0.0.0-20150408093626-b80cdc656a7a // indirect
github.com/miekg/dns v1.1.31 // indirect
github.com/nightlyone/lockfile v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/oschwald/maxminddb-golang v1.8.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/paulmach/go.geojson v1.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/sendgrid/rest v2.6.4+incompatible // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/teamwork/test v0.0.0-20200108114543-02621bae84ad // indirect
github.com/teamwork/utils v0.0.0-20211103135549-f7e7a68ba696 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
github.com/ttacon/libphonenumber v1.2.1 // indirect
github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/urfave/cli/v2 v2.3.0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.etcd.io/bbolt v1.3.5 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211008145708-270636b82663 // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/grpc/examples v0.0.0-20211103202053-3b94303f3754 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
)
4 changes: 0 additions & 4 deletions go.sum
Expand Up @@ -761,7 +761,6 @@ golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
Expand Down Expand Up @@ -791,7 +790,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1040,9 +1038,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM=
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
Expand Down
2 changes: 2 additions & 0 deletions wordle/.gitignore
@@ -0,0 +1,2 @@

wordle
3 changes: 3 additions & 0 deletions wordle/Dockerfile
@@ -0,0 +1,3 @@
FROM alpine
ADD wordle /wordle
ENTRYPOINT [ "/wordle" ]
27 changes: 27 additions & 0 deletions wordle/Makefile
@@ -0,0 +1,27 @@

GOPATH:=$(shell go env GOPATH)
.PHONY: init
init:
go install github.com/golang/protobuf/protoc-gen-go@latest
go install github.com/micro/micro/v3/cmd/protoc-gen-micro@latest
go install github.com/micro/micro/v3/cmd/protoc-gen-openapi@latest

.PHONY: api
api:
protoc --openapi_out=. --proto_path=. proto/wordle.proto

.PHONY: proto
proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/wordle.proto

.PHONY: build
build:
go build -o wordle *.go

.PHONY: test
test:
go test -v ./... -cover

.PHONY: docker
docker:
docker build . -t wordle:latest
8 changes: 8 additions & 0 deletions wordle/README.md
@@ -0,0 +1,8 @@
Multiplayer wordle

# Wordle Service

Guess the WORDLE in six tries. Each guess must be a valid five-letter word.

The highlight will show how close you are using [] square brackets for correct positions and {} parenthesis for
letters in the word but in the wrong position, anything not highlighted is incorrect.
66 changes: 66 additions & 0 deletions wordle/examples.json
@@ -0,0 +1,66 @@
{
"guess": [
{
"title": "Make a guess",
"description": "Make a guess",
"request": {
"word": "noise"
},
"response": {
"correct": false,
"tries_left": 0,
"guesses": [
{
"word": "noise",
"highlight": "no{i}[s]e",
"chars": [
{
"letter": "n",
"position": 0,
"correct": false,
"in_word": false
},
{
"letter": "o",
"position": 1,
"correct": false,
"in_word": false
},
{
"letter": "i",
"position": 2,
"correct": false,
"in_word": true
},
{
"letter": "s",
"position": 3,
"correct": true,
"in_word": true
},
{
"letter": "e",
"position": 4,
"correct": false,
"in_word": false
}
]
}
],
"answer": "tipsy",
"status": "Reached guess limit"
}
}
],
"next": [
{
"title": "Next game",
"description": "When is the next game",
"request": {},
"response": {
"seconds": 36944,
"duration": "10h15m44.854216477s"
}
}
]
}
3 changes: 3 additions & 0 deletions wordle/generate.go
@@ -0,0 +1,3 @@
package main

//go:generate make proto

0 comments on commit 9ae89b5

Please sign in to comment.