Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
taxi-lang
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
taxi-lang
taxi-lang
Commits
d8a85cff
Commit
d8a85cff
authored
10 months ago
by
Marty Pitt
Browse files
Options
Downloads
Patches
Plain Diff
feat(http): added WebsocketOperation for saved websocket queries
parent
44e1eae3
No related branches found
No related tags found
No related merge requests found
Pipeline
#1262632062
passed
10 months ago
Stage: build
Stage: build-plugin
Stage: trigger-release
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
taxi-stdlib-annotations/src/main/java/lang/taxi/annotations/Http.kt
+28
-0
28 additions, 0 deletions
...b-annotations/src/main/java/lang/taxi/annotations/Http.kt
with
28 additions
and
0 deletions
taxi-stdlib-annotations/src/main/java/lang/taxi/annotations/Http.kt
+
28
−
0
View file @
d8a85cff
...
...
@@ -28,6 +28,11 @@ data class HttpService(val baseUrl: String) : AnnotationProvider {
url : String
}
annotation WebsocketOperation {
path : String
}
annotation HttpHeader {
name : String
[[ Pass a value when using as an annotation on an operation.
...
...
@@ -105,6 +110,29 @@ data class HttpOperation(val method: String, val url: String) : AnnotationProvid
override
fun
toAnnotation
():
Annotation
=
Annotation
(
NAME
,
mapOf
(
"method"
to
method
,
"url"
to
url
))
}
data class
WebsocketOperation
(
val
path
:
String
)
:
AnnotationProvider
{
companion
object
{
const
val
NAME
=
"taxi.http.WebsocketOperation"
fun
fromAnnotation
(
annotation
:
Annotation
):
WebsocketOperation
{
// TODO : We should just define the bloody annotation in taxi. Then this would be handled
// at the compiler level!!!
val
parameters
=
annotation
.
parameters
require
(
parameters
.
containsKey
(
"path"
))
{
"@WebsocketOperation requires a path parameter"
}
return
WebsocketOperation
(
parameters
[
"path"
]
!!
.
toString
())
}
fun
fromQuery
(
query
:
TaxiQlQuery
):
WebsocketOperation
?
{
val
httpAnnotation
=
query
.
annotations
.
singleOrNull
{
annotation
->
annotation
.
name
==
WebsocketOperation
.
NAME
}
return
if
(
httpAnnotation
!=
null
)
{
fromAnnotation
(
httpAnnotation
)
}
else
null
}
}
override
fun
toAnnotation
():
Annotation
=
Annotation
(
NAME
,
mapOf
(
"path"
to
path
))
}
object
HttpRequestBody
:
AnnotationProvider
{
override
fun
toAnnotation
():
Annotation
{
return
Annotation
(
NAME
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment