-
Notifications
You must be signed in to change notification settings - Fork 219
/
alias.go
150 lines (110 loc) · 4.33 KB
/
alias.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package cloudevents
// Package cloudevents alias' common functions and types to improve discoverability and reduce
// the number of imports for simple HTTP clients.
import (
"github.com/cloudevents/sdk-go/pkg/cloudevents"
"github.com/cloudevents/sdk-go/pkg/cloudevents/client"
"github.com/cloudevents/sdk-go/pkg/cloudevents/context"
"github.com/cloudevents/sdk-go/pkg/cloudevents/observability"
"github.com/cloudevents/sdk-go/pkg/cloudevents/transport/http"
"github.com/cloudevents/sdk-go/pkg/cloudevents/types"
)
// Client
type ClientOption client.Option
type Client = client.Client
type ConvertFn = client.ConvertFn
// Event
type Event = cloudevents.Event
type EventResponse = cloudevents.EventResponse
// Context
type EventContext = cloudevents.EventContext
type EventContextV1 = cloudevents.EventContextV1
type EventContextV01 = cloudevents.EventContextV01
type EventContextV02 = cloudevents.EventContextV02
type EventContextV03 = cloudevents.EventContextV03
// Custom Types
type Timestamp = types.Timestamp
type URLRef = types.URLRef
// HTTP Transport
type HTTPOption http.Option
type HTTPTransport = http.Transport
type HTTPTransportContext = http.TransportContext
type HTTPTransportResponseContext = http.TransportResponseContext
type HTTPEncoding = http.Encoding
const (
// Encoding
ApplicationXML = cloudevents.ApplicationXML
ApplicationJSON = cloudevents.ApplicationJSON
ApplicationCloudEventsJSON = cloudevents.ApplicationCloudEventsJSON
ApplicationCloudEventsBatchJSON = cloudevents.ApplicationCloudEventsBatchJSON
Base64 = cloudevents.Base64
// Event Versions
VersionV1 = cloudevents.CloudEventsVersionV1
VersionV01 = cloudevents.CloudEventsVersionV01
VersionV02 = cloudevents.CloudEventsVersionV02
VersionV03 = cloudevents.CloudEventsVersionV03
// HTTP Transport Encodings
HTTPBinaryV1 = http.BinaryV1
HTTPStructuredV1 = http.StructuredV1
HTTPBatchedV1 = http.BatchedV1
HTTPBinaryV01 = http.BinaryV01
HTTPStructuredV01 = http.StructuredV01
HTTPBinaryV02 = http.BinaryV02
HTTPStructuredV02 = http.StructuredV02
HTTPBinaryV03 = http.BinaryV03
HTTPStructuredV03 = http.StructuredV03
HTTPBatchedV03 = http.BatchedV03
// Context HTTP Transport Encodings
Binary = http.Binary
Structured = http.Structured
)
var (
// ContentType Helpers
StringOfApplicationJSON = cloudevents.StringOfApplicationJSON
StringOfApplicationXML = cloudevents.StringOfApplicationXML
StringOfApplicationCloudEventsJSON = cloudevents.StringOfApplicationCloudEventsJSON
StringOfApplicationCloudEventsBatchJSON = cloudevents.StringOfApplicationCloudEventsBatchJSON
StringOfBase64 = cloudevents.StringOfBase64
// Client Creation
NewClient = client.New
NewDefaultClient = client.NewDefault
// Client Options
WithEventDefaulter = client.WithEventDefaulter
WithUUIDs = client.WithUUIDs
WithTimeNow = client.WithTimeNow
WithConverterFn = client.WithConverterFn
WithDataContentType = client.WithDataContentType
// Event Creation
NewEvent = cloudevents.New
// Tracing
EnableTracing = observability.EnableTracing
// Context
ContextWithTarget = context.WithTarget
TargetFromContext = context.TargetFrom
ContextWithEncoding = context.WithEncoding
EncodingFromContext = context.EncodingFrom
// Custom Types
ParseTimestamp = types.ParseTimestamp
ParseURLRef = types.ParseURLRef
ParseURIRef = types.ParseURIRef
ParseURI = types.ParseURI
// HTTP Transport
NewHTTPTransport = http.New
// HTTP Transport Options
WithTarget = http.WithTarget
WithMethod = http.WithMethod
WitHHeader = http.WithHeader
WithShutdownTimeout = http.WithShutdownTimeout
WithEncoding = http.WithEncoding
WithContextBasedEncoding = http.WithContextBasedEncoding
WithBinaryEncoding = http.WithBinaryEncoding
WithStructuredEncoding = http.WithStructuredEncoding
WithPort = http.WithPort
WithPath = http.WithPath
WithMiddleware = http.WithMiddleware
WithLongPollTarget = http.WithLongPollTarget
WithListener = http.WithListener
// HTTP Context
HTTPTransportContextFrom = http.TransportContextFrom
ContextWithHeader = http.ContextWithHeader
)