Update dependencies (#886)
parent
1dc93ec4f0
commit
a3bee01e0a
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7748
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_server_2.pb.go
generated
vendored
7748
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_server_2.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2321
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_server_friends.pb.go
generated
vendored
2321
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_server_friends.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
1294
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_server_login.pb.go
generated
vendored
1294
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_server_login.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
397
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_site_license.pb.go
generated
vendored
397
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/client_site_license.pb.go
generated
vendored
@ -0,0 +1,397 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: steammessages_sitelicenseclient.proto
|
||||||
|
|
||||||
|
package protobuf
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
math "math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package protobuf is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package protobuf to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type CMsgClientSiteInfo struct {
|
||||||
|
SiteId *uint64 `protobuf:"varint,1,opt,name=site_id" json:"site_id,omitempty"`
|
||||||
|
SiteName *string `protobuf:"bytes,2,opt,name=site_name" json:"site_name,omitempty"`
|
||||||
|
AllowCachedCredentials *bool `protobuf:"varint,3,opt,name=allow_cached_credentials" json:"allow_cached_credentials,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteInfo) Reset() { *m = CMsgClientSiteInfo{} }
|
||||||
|
func (m *CMsgClientSiteInfo) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CMsgClientSiteInfo) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteInfo) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteInfo.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteInfo.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteInfo) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteInfo.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteInfo) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteInfo.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteInfo) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteInfo.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteInfo proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteInfo) GetSiteId() uint64 {
|
||||||
|
if m != nil && m.SiteId != nil {
|
||||||
|
return *m.SiteId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteInfo) GetSiteName() string {
|
||||||
|
if m != nil && m.SiteName != nil {
|
||||||
|
return *m.SiteName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteInfo) GetAllowCachedCredentials() bool {
|
||||||
|
if m != nil && m.AllowCachedCredentials != nil {
|
||||||
|
return *m.AllowCachedCredentials
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
type CMsgClientSiteLicenseCheckout struct {
|
||||||
|
Appid *uint32 `protobuf:"varint,1,opt,name=appid" json:"appid,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) Reset() { *m = CMsgClientSiteLicenseCheckout{} }
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CMsgClientSiteLicenseCheckout) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteLicenseCheckout) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseCheckout.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseCheckout.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseCheckout.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseCheckout.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseCheckout.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteLicenseCheckout proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseCheckout) GetAppid() uint32 {
|
||||||
|
if m != nil && m.Appid != nil {
|
||||||
|
return *m.Appid
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type CMsgClientSiteLicenseCheckoutResponse struct {
|
||||||
|
Eresult *int32 `protobuf:"varint,1,opt,name=eresult,def=2" json:"eresult,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) Reset() { *m = CMsgClientSiteLicenseCheckoutResponse{} }
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CMsgClientSiteLicenseCheckoutResponse) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteLicenseCheckoutResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseCheckoutResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseCheckoutResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseCheckoutResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseCheckoutResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseCheckoutResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteLicenseCheckoutResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
const Default_CMsgClientSiteLicenseCheckoutResponse_Eresult int32 = 2
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseCheckoutResponse) GetEresult() int32 {
|
||||||
|
if m != nil && m.Eresult != nil {
|
||||||
|
return *m.Eresult
|
||||||
|
}
|
||||||
|
return Default_CMsgClientSiteLicenseCheckoutResponse_Eresult
|
||||||
|
}
|
||||||
|
|
||||||
|
type CMsgClientSiteLicenseGetAvailableSeats struct {
|
||||||
|
Appid *uint32 `protobuf:"varint,1,opt,name=appid" json:"appid,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) Reset() {
|
||||||
|
*m = CMsgClientSiteLicenseGetAvailableSeats{}
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CMsgClientSiteLicenseGetAvailableSeats) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteLicenseGetAvailableSeats) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeats.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeats.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeats.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeats.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeats.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeats proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeats) GetAppid() uint32 {
|
||||||
|
if m != nil && m.Appid != nil {
|
||||||
|
return *m.Appid
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type CMsgClientSiteLicenseGetAvailableSeatsResponse struct {
|
||||||
|
Eresult *int32 `protobuf:"varint,1,opt,name=eresult,def=2" json:"eresult,omitempty"`
|
||||||
|
Seats *uint32 `protobuf:"varint,2,opt,name=seats" json:"seats,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) Reset() {
|
||||||
|
*m = CMsgClientSiteLicenseGetAvailableSeatsResponse{}
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) String() string {
|
||||||
|
return proto.CompactTextString(m)
|
||||||
|
}
|
||||||
|
func (*CMsgClientSiteLicenseGetAvailableSeatsResponse) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteLicenseGetAvailableSeatsResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeatsResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeatsResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeatsResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeatsResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeatsResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteLicenseGetAvailableSeatsResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
const Default_CMsgClientSiteLicenseGetAvailableSeatsResponse_Eresult int32 = 2
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) GetEresult() int32 {
|
||||||
|
if m != nil && m.Eresult != nil {
|
||||||
|
return *m.Eresult
|
||||||
|
}
|
||||||
|
return Default_CMsgClientSiteLicenseGetAvailableSeatsResponse_Eresult
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetAvailableSeatsResponse) GetSeats() uint32 {
|
||||||
|
if m != nil && m.Seats != nil {
|
||||||
|
return *m.Seats
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type CMsgClientSiteLicenseGetContentCacheInfo struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) Reset() {
|
||||||
|
*m = CMsgClientSiteLicenseGetContentCacheInfo{}
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CMsgClientSiteLicenseGetContentCacheInfo) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteLicenseGetContentCacheInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfo.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfo.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfo.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfo.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfo) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfo.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfo proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type CMsgClientSiteLicenseGetContentCacheInfoResponse struct {
|
||||||
|
UseCache *bool `protobuf:"varint,1,opt,name=use_cache" json:"use_cache,omitempty"`
|
||||||
|
Ipv4Address *uint32 `protobuf:"varint,2,opt,name=ipv4_address" json:"ipv4_address,omitempty"`
|
||||||
|
PortNumber *uint32 `protobuf:"varint,3,opt,name=port_number" json:"port_number,omitempty"`
|
||||||
|
P2PGroup *uint32 `protobuf:"varint,4,opt,name=p2p_group" json:"p2p_group,omitempty"`
|
||||||
|
IpAddress *string `protobuf:"bytes,5,opt,name=ip_address" json:"ip_address,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) Reset() {
|
||||||
|
*m = CMsgClientSiteLicenseGetContentCacheInfoResponse{}
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) String() string {
|
||||||
|
return proto.CompactTextString(m)
|
||||||
|
}
|
||||||
|
func (*CMsgClientSiteLicenseGetContentCacheInfoResponse) ProtoMessage() {}
|
||||||
|
func (*CMsgClientSiteLicenseGetContentCacheInfoResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_0a32817a56a37a6e, []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfoResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfoResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfoResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfoResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfoResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CMsgClientSiteLicenseGetContentCacheInfoResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) GetUseCache() bool {
|
||||||
|
if m != nil && m.UseCache != nil {
|
||||||
|
return *m.UseCache
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) GetIpv4Address() uint32 {
|
||||||
|
if m != nil && m.Ipv4Address != nil {
|
||||||
|
return *m.Ipv4Address
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) GetPortNumber() uint32 {
|
||||||
|
if m != nil && m.PortNumber != nil {
|
||||||
|
return *m.PortNumber
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) GetP2PGroup() uint32 {
|
||||||
|
if m != nil && m.P2PGroup != nil {
|
||||||
|
return *m.P2PGroup
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CMsgClientSiteLicenseGetContentCacheInfoResponse) GetIpAddress() string {
|
||||||
|
if m != nil && m.IpAddress != nil {
|
||||||
|
return *m.IpAddress
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*CMsgClientSiteInfo)(nil), "CMsgClientSiteInfo")
|
||||||
|
proto.RegisterType((*CMsgClientSiteLicenseCheckout)(nil), "CMsgClientSiteLicenseCheckout")
|
||||||
|
proto.RegisterType((*CMsgClientSiteLicenseCheckoutResponse)(nil), "CMsgClientSiteLicenseCheckoutResponse")
|
||||||
|
proto.RegisterType((*CMsgClientSiteLicenseGetAvailableSeats)(nil), "CMsgClientSiteLicenseGetAvailableSeats")
|
||||||
|
proto.RegisterType((*CMsgClientSiteLicenseGetAvailableSeatsResponse)(nil), "CMsgClientSiteLicenseGetAvailableSeatsResponse")
|
||||||
|
proto.RegisterType((*CMsgClientSiteLicenseGetContentCacheInfo)(nil), "CMsgClientSiteLicenseGetContentCacheInfo")
|
||||||
|
proto.RegisterType((*CMsgClientSiteLicenseGetContentCacheInfoResponse)(nil), "CMsgClientSiteLicenseGetContentCacheInfoResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("steammessages_sitelicenseclient.proto", fileDescriptor_0a32817a56a37a6e)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_0a32817a56a37a6e = []byte{
|
||||||
|
// 335 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x41, 0x4b, 0xfb, 0x40,
|
||||||
|
0x14, 0xc4, 0xff, 0xfb, 0xb7, 0xa1, 0xed, 0xd3, 0x20, 0x5d, 0x3d, 0x04, 0x41, 0x08, 0x81, 0x4a,
|
||||||
|
0xf0, 0x50, 0xa4, 0x08, 0x82, 0x9e, 0x34, 0x07, 0x15, 0xf4, 0x62, 0x6f, 0x5e, 0xc2, 0x36, 0x79,
|
||||||
|
0xb6, 0x8b, 0x9b, 0xdd, 0x25, 0x6f, 0x53, 0xaf, 0x7e, 0x0b, 0xbf, 0xae, 0x64, 0x5b, 0x0a, 0x15,
|
||||||
|
0x2d, 0xbd, 0xee, 0xce, 0x6f, 0x66, 0x98, 0x07, 0x43, 0x72, 0x28, 0xaa, 0x0a, 0x89, 0xc4, 0x0c,
|
||||||
|
0x29, 0x27, 0xe9, 0x50, 0xc9, 0x02, 0x35, 0x61, 0xa1, 0x24, 0x6a, 0x37, 0xb2, 0xb5, 0x71, 0xe6,
|
||||||
|
0x24, 0xda, 0x94, 0x4d, 0x05, 0xe1, 0xf2, 0x27, 0x79, 0x05, 0x9e, 0x3d, 0xd3, 0x2c, 0xf3, 0xea,
|
||||||
|
0x89, 0x74, 0xf8, 0xa8, 0xdf, 0x0c, 0x3f, 0x84, 0x6e, 0x6b, 0x95, 0xcb, 0x32, 0x62, 0x31, 0x4b,
|
||||||
|
0x3b, 0x7c, 0x00, 0x7d, 0xff, 0xa0, 0x45, 0x85, 0xd1, 0xff, 0x98, 0xa5, 0x7d, 0x1e, 0x43, 0x24,
|
||||||
|
0x94, 0x32, 0x1f, 0x79, 0x21, 0x8a, 0x39, 0x96, 0x79, 0x51, 0x63, 0x89, 0xda, 0x49, 0xa1, 0x28,
|
||||||
|
0xda, 0x8b, 0x59, 0xda, 0x4b, 0x46, 0x70, 0xba, 0xe9, 0xfd, 0xb4, 0xac, 0x96, 0xcd, 0xb1, 0x78,
|
||||||
|
0x37, 0x8d, 0xe3, 0x21, 0x04, 0xc2, 0xda, 0x55, 0x48, 0x98, 0xdc, 0xc0, 0x70, 0xab, 0xfe, 0x05,
|
||||||
|
0xc9, 0x1a, 0x4d, 0xc8, 0x39, 0x74, 0xb1, 0x46, 0x6a, 0x94, 0xf3, 0x64, 0x70, 0xcd, 0xc6, 0xc9,
|
||||||
|
0x15, 0x9c, 0xfd, 0x0a, 0xdf, 0xa3, 0xbb, 0x5d, 0x08, 0xa9, 0xc4, 0x54, 0xe1, 0x04, 0x85, 0xa3,
|
||||||
|
0x9f, 0xa9, 0x13, 0x18, 0xed, 0x06, 0x6e, 0x8b, 0x6f, 0x4d, 0xa9, 0x15, 0xf9, 0x71, 0xc2, 0xe4,
|
||||||
|
0x1c, 0xd2, 0xbf, 0x4c, 0x33, 0xa3, 0x1d, 0x6a, 0x97, 0xb5, 0xab, 0xb5, 0x63, 0x27, 0x5f, 0x0c,
|
||||||
|
0x2e, 0x76, 0x15, 0xaf, 0x3b, 0x0c, 0xa0, 0xdf, 0x10, 0x2e, 0xb7, 0xf7, 0x2d, 0x7a, 0xfc, 0x18,
|
||||||
|
0x0e, 0xa4, 0x5d, 0x5c, 0xe6, 0xa2, 0x2c, 0x6b, 0xa4, 0x55, 0x13, 0x7e, 0x04, 0xfb, 0xd6, 0xd4,
|
||||||
|
0x2e, 0xd7, 0x4d, 0x35, 0xc5, 0xda, 0x5f, 0x26, 0x6c, 0x69, 0x3b, 0xb6, 0xf9, 0xac, 0x36, 0x8d,
|
||||||
|
0x8d, 0x3a, 0xfe, 0x89, 0x03, 0x48, 0xbb, 0x66, 0x83, 0xf6, 0xc4, 0x77, 0xc1, 0x03, 0xfb, 0x64,
|
||||||
|
0xff, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x09, 0x2f, 0x9f, 0xe9, 0x65, 0x02, 0x00, 0x00,
|
||||||
|
}
|
415
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/content_manifest.pb.go
generated
vendored
415
vendor/github.com/Philipp15b/go-steam/protocol/protobuf/content_manifest.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@
|
|||||||
|
module github.com/d5/tengo
|
||||||
|
|
||||||
|
go 1.12
|
@ -1,53 +0,0 @@
|
|||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"regexp"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
var tengoModFileRE = regexp.MustCompile(`^srcmod_(\w+).tengo$`)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
modules := make(map[string]string)
|
|
||||||
|
|
||||||
// enumerate all Tengo module files
|
|
||||||
files, err := ioutil.ReadDir(".")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, file := range files {
|
|
||||||
m := tengoModFileRE.FindStringSubmatch(file.Name())
|
|
||||||
if m != nil {
|
|
||||||
modName := m[1]
|
|
||||||
|
|
||||||
src, err := ioutil.ReadFile(file.Name())
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("file '%s' read error: %s", file.Name(), err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
modules[modName] = string(src)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
|
||||||
out.WriteString(`// Code generated using gensrcmods.go; DO NOT EDIT.
|
|
||||||
|
|
||||||
package stdlib
|
|
||||||
|
|
||||||
// SourceModules are source type standard library modules.
|
|
||||||
var SourceModules = map[string]string{` + "\n")
|
|
||||||
for modName, modSrc := range modules {
|
|
||||||
out.WriteString("\t\"" + modName + "\": " + strconv.Quote(modSrc) + ",\n")
|
|
||||||
}
|
|
||||||
out.WriteString("}\n")
|
|
||||||
|
|
||||||
const target = "source_modules.go"
|
|
||||||
if err := ioutil.WriteFile(target, out.Bytes(), 0644); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
language: go
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- go: 1.7.x
|
|
||||||
- go: 1.8.x
|
|
||||||
- go: 1.9.x
|
|
||||||
- go: 1.10.x
|
|
||||||
- go: 1.11.x
|
|
||||||
- go: tip
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go get -t -v ./...
|
|
||||||
- diff -u <(echo -n) <(gofmt -d .)
|
|
||||||
- go vet $(go list ./... | grep -v /vendor/)
|
|
||||||
- go test -v -race ./...
|
|
@ -0,0 +1,3 @@
|
|||||||
|
module github.com/gorilla/websocket
|
||||||
|
|
||||||
|
go 1.12
|
@ -0,0 +1,2 @@
|
|||||||
|
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||||
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright 2019 The Gorilla WebSocket Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package websocket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// JoinMessages concatenates received messages to create a single io.Reader.
|
||||||
|
// The string term is appended to each message. The returned reader does not
|
||||||
|
// support concurrent calls to the Read method.
|
||||||
|
func JoinMessages(c *Conn, term string) io.Reader {
|
||||||
|
return &joinReader{c: c, term: term}
|
||||||
|
}
|
||||||
|
|
||||||
|
type joinReader struct {
|
||||||
|
c *Conn
|
||||||
|
term string
|
||||||
|
r io.Reader
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *joinReader) Read(p []byte) (int, error) {
|
||||||
|
if r.r == nil {
|
||||||
|
var err error
|
||||||
|
_, r.r, err = r.c.NextReader()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if r.term != "" {
|
||||||
|
r.r = io.MultiReader(r.r, strings.NewReader(r.term))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n, err := r.r.Read(p)
|
||||||
|
if err == io.EOF {
|
||||||
|
err = nil
|
||||||
|
r.r = nil
|
||||||
|
}
|
||||||
|
return n, err
|
||||||
|
}
|
@ -1 +1,3 @@
|
|||||||
module github.com/hashicorp/golang-lru
|
module github.com/hashicorp/golang-lru
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
@ -1,53 +1,34 @@
|
|||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
github.com/labstack/gommon v0.2.8 h1:JvRqmeZcfrHC5u6uVleB4NxxNbzx6gpbJiQknDbKQu0=
|
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
|
||||||
github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4=
|
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
|
||||||
github.com/labstack/gommon v0.2.9 h1:heVeuAYtevIQVYkGj6A41dtfT91LrvFG220lavpWhrU=
|
|
||||||
github.com/labstack/gommon v0.2.9/go.mod h1:E8ZTmW9vw5az5/ZyHWCp0Lw4OH2ecsaBP1C/NKavGG4=
|
|
||||||
github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg=
|
|
||||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
|
||||||
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
||||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc=
|
|
||||||
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||||
|
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
|
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
|
||||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo=
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
||||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco=
|
|
||||||
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
|
||||||
golang.org/x/net v0.0.0-20190607181551-461777fb6f67 h1:rJJxsykSlULwd2P2+pg/rtnwN2FrWp4IuCxOSyS0V00=
|
|
||||||
golang.org/x/net v0.0.0-20190607181551-461777fb6f67/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2 h1:T5DasATyLQfmbTpfEXx/IOL9vfjzW6up+ZDkmHvIf2s=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190609082536-301114b31cce/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
golang.org/x/tools v0.0.0-20190608022120-eacb66d2a7c3/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module github.com/mattn/go-isatty
|
module github.com/mattn/go-isatty
|
||||||
|
|
||||||
require golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
|
require golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
|
||||||
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/davecgh/go-spew"
|
|
||||||
packages = ["spew"]
|
|
||||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
|
||||||
version = "v1.1.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/gorilla/websocket"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
|
|
||||||
version = "v1.2.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/pkg/errors"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
|
||||||
version = "v0.8.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/pmezard/go-difflib"
|
|
||||||
packages = ["difflib"]
|
|
||||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/stretchr/testify"
|
|
||||||
packages = ["assert"]
|
|
||||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
|
||||||
version = "v1.2.2"
|
|
||||||
|
|
||||||
[solve-meta]
|
|
||||||
analyzer-name = "dep"
|
|
||||||
analyzer-version = 1
|
|
||||||
inputs-digest = "596fa546322c2a1e9708a10c9f39aca2e04792b477fab86fb2899fbaab776070"
|
|
||||||
solver-name = "gps-cdcl"
|
|
||||||
solver-version = 1
|
|
@ -1,17 +0,0 @@
|
|||||||
ignored = ["github.com/lusis/slack-test"]
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/gorilla/websocket"
|
|
||||||
version = "1.2.0"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/stretchr/testify"
|
|
||||||
version = "1.2.1"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/pkg/errors"
|
|
||||||
version = "0.8.0"
|
|
||||||
|
|
||||||
[prune]
|
|
||||||
go-tests = true
|
|
||||||
unused-packages = true
|
|
@ -0,0 +1,71 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// @NOTE: Blocks are in beta and subject to change.
|
||||||
|
|
||||||
|
// More Information: https://api.slack.com/block-kit
|
||||||
|
|
||||||
|
// MessageBlockType defines a named string type to define each block type
|
||||||
|
// as a constant for use within the package.
|
||||||
|
type MessageBlockType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
MBTSection MessageBlockType = "section"
|
||||||
|
MBTDivider MessageBlockType = "divider"
|
||||||
|
MBTImage MessageBlockType = "image"
|
||||||
|
MBTAction MessageBlockType = "actions"
|
||||||
|
MBTContext MessageBlockType = "context"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Block defines an interface all block types should implement
|
||||||
|
// to ensure consistency between blocks.
|
||||||
|
type Block interface {
|
||||||
|
BlockType() MessageBlockType
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blocks is a convenience struct defined to allow dynamic unmarshalling of
|
||||||
|
// the "blocks" value in Slack's JSON response, which varies depending on block type
|
||||||
|
type Blocks struct {
|
||||||
|
BlockSet []Block `json:"blocks,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockAction is the action callback sent when a block is interacted with
|
||||||
|
type BlockAction struct {
|
||||||
|
ActionID string `json:"action_id"`
|
||||||
|
BlockID string `json:"block_id"`
|
||||||
|
Type actionType `json:"type"`
|
||||||
|
Text TextBlockObject `json:"text"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
ActionTs string `json:"action_ts"`
|
||||||
|
SelectedOption OptionBlockObject `json:"selected_option"`
|
||||||
|
SelectedUser string `json:"selected_user"`
|
||||||
|
SelectedChannel string `json:"selected_channel"`
|
||||||
|
SelectedConversation string `json:"selected_conversation"`
|
||||||
|
SelectedDate string `json:"selected_date"`
|
||||||
|
InitialOption OptionBlockObject `json:"initial_option"`
|
||||||
|
InitialUser string `json:"initial_user"`
|
||||||
|
InitialChannel string `json:"initial_channel"`
|
||||||
|
InitialConversation string `json:"initial_conversation"`
|
||||||
|
InitialDate string `json:"initial_date"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// actionType returns the type of the action
|
||||||
|
func (b BlockAction) actionType() actionType {
|
||||||
|
return b.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewBlockMessage creates a new Message that contains one or more blocks to be displayed
|
||||||
|
func NewBlockMessage(blocks ...Block) Message {
|
||||||
|
return Message{
|
||||||
|
Msg: Msg{
|
||||||
|
Blocks: Blocks{
|
||||||
|
BlockSet: blocks,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddBlockMessage appends a block to the end of the existing list of blocks
|
||||||
|
func AddBlockMessage(message Message, newBlk Block) Message {
|
||||||
|
message.Msg.Blocks.BlockSet = append(message.Msg.Blocks.BlockSet, newBlk)
|
||||||
|
return message
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// ActionBlock defines data that is used to hold interactive elements.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/blocks#actions
|
||||||
|
type ActionBlock struct {
|
||||||
|
Type MessageBlockType `json:"type"`
|
||||||
|
BlockID string `json:"block_id,omitempty"`
|
||||||
|
Elements BlockElements `json:"elements"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockType returns the type of the block
|
||||||
|
func (s ActionBlock) BlockType() MessageBlockType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewActionBlock returns a new instance of an Action Block
|
||||||
|
func NewActionBlock(blockID string, elements ...BlockElement) *ActionBlock {
|
||||||
|
return &ActionBlock{
|
||||||
|
Type: MBTAction,
|
||||||
|
BlockID: blockID,
|
||||||
|
Elements: BlockElements{
|
||||||
|
ElementSet: elements,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// ContextBlock defines data that is used to display message context, which can
|
||||||
|
// include both images and text.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/blocks#actions
|
||||||
|
type ContextBlock struct {
|
||||||
|
Type MessageBlockType `json:"type"`
|
||||||
|
BlockID string `json:"block_id,omitempty"`
|
||||||
|
ContextElements ContextElements `json:"elements"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockType returns the type of the block
|
||||||
|
func (s ContextBlock) BlockType() MessageBlockType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContextElements struct {
|
||||||
|
Elements []MixedElement
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContextBlock returns a new instance of a context block
|
||||||
|
func NewContextBlock(blockID string, mixedElements ...MixedElement) *ContextBlock {
|
||||||
|
elements := ContextElements{
|
||||||
|
Elements: mixedElements,
|
||||||
|
}
|
||||||
|
return &ContextBlock{
|
||||||
|
Type: MBTContext,
|
||||||
|
BlockID: blockID,
|
||||||
|
ContextElements: elements,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,303 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type sumtype struct {
|
||||||
|
TypeVal string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the Marshaller interface for Blocks so that any JSON
|
||||||
|
// marshalling is delegated and proper type determination can be made before marshal
|
||||||
|
func (b Blocks) MarshalJSON() ([]byte, error) {
|
||||||
|
bytes, err := json.Marshal(b.BlockSet)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the Unmarshaller interface for Blocks, so that any JSON
|
||||||
|
// unmarshalling is delegated and proper type determination can be made before unmarshal
|
||||||
|
func (b *Blocks) UnmarshalJSON(data []byte) error {
|
||||||
|
var raw []json.RawMessage
|
||||||
|
|
||||||
|
if string(data) == "{}" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(data, &raw)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var blocks Blocks
|
||||||
|
for _, r := range raw {
|
||||||
|
s := sumtype{}
|
||||||
|
err := json.Unmarshal(r, &s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var blockType string
|
||||||
|
if s.TypeVal != "" {
|
||||||
|
blockType = s.TypeVal
|
||||||
|
}
|
||||||
|
|
||||||
|
var block Block
|
||||||
|
switch blockType {
|
||||||
|
case "actions":
|
||||||
|
block = &ActionBlock{}
|
||||||
|
case "context":
|
||||||
|
block = &ContextBlock{}
|
||||||
|
case "divider":
|
||||||
|
block = &DividerBlock{}
|
||||||
|
case "image":
|
||||||
|
block = &ImageBlock{}
|
||||||
|
case "section":
|
||||||
|
block = &SectionBlock{}
|
||||||
|
default:
|
||||||
|
return errors.New("unsupported block type")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(r, block)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
blocks.BlockSet = append(blocks.BlockSet, block)
|
||||||
|
}
|
||||||
|
|
||||||
|
*b = blocks
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the Marshaller interface for BlockElements so that any JSON
|
||||||
|
// marshalling is delegated and proper type determination can be made before marshal
|
||||||
|
func (b *BlockElements) MarshalJSON() ([]byte, error) {
|
||||||
|
bytes, err := json.Marshal(b.ElementSet)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the Unmarshaller interface for BlockElements, so that any JSON
|
||||||
|
// unmarshalling is delegated and proper type determination can be made before unmarshal
|
||||||
|
func (b *BlockElements) UnmarshalJSON(data []byte) error {
|
||||||
|
var raw []json.RawMessage
|
||||||
|
|
||||||
|
if string(data) == "{}" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(data, &raw)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var blockElements BlockElements
|
||||||
|
for _, r := range raw {
|
||||||
|
s := sumtype{}
|
||||||
|
err := json.Unmarshal(r, &s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var blockElementType string
|
||||||
|
if s.TypeVal != "" {
|
||||||
|
blockElementType = s.TypeVal
|
||||||
|
}
|
||||||
|
|
||||||
|
var blockElement BlockElement
|
||||||
|
switch blockElementType {
|
||||||
|
case "image":
|
||||||
|
blockElement = &ImageBlockElement{}
|
||||||
|
case "button":
|
||||||
|
blockElement = &ButtonBlockElement{}
|
||||||
|
case "overflow":
|
||||||
|
blockElement = &OverflowBlockElement{}
|
||||||
|
case "datepicker":
|
||||||
|
blockElement = &DatePickerBlockElement{}
|
||||||
|
case "static_select", "external_select", "users_select", "conversations_select", "channels_select":
|
||||||
|
blockElement = &SelectBlockElement{}
|
||||||
|
default:
|
||||||
|
return errors.New("unsupported block element type")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(r, blockElement)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
blockElements.ElementSet = append(blockElements.ElementSet, blockElement)
|
||||||
|
}
|
||||||
|
|
||||||
|
*b = blockElements
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the Marshaller interface for Accessory so that any JSON
|
||||||
|
// marshalling is delegated and proper type determination can be made before marshal
|
||||||
|
func (a *Accessory) MarshalJSON() ([]byte, error) {
|
||||||
|
bytes, err := json.Marshal(toBlockElement(a))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the Unmarshaller interface for Accessory, so that any JSON
|
||||||
|
// unmarshalling is delegated and proper type determination can be made before unmarshal
|
||||||
|
func (a *Accessory) UnmarshalJSON(data []byte) error {
|
||||||
|
var r json.RawMessage
|
||||||
|
|
||||||
|
if string(data) == "{\"accessory\":null}" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(data, &r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
s := sumtype{}
|
||||||
|
err = json.Unmarshal(r, &s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var blockElementType string
|
||||||
|
if s.TypeVal != "" {
|
||||||
|
blockElementType = s.TypeVal
|
||||||
|
}
|
||||||
|
|
||||||
|
switch blockElementType {
|
||||||
|
case "image":
|
||||||
|
element, err := unmarshalBlockElement(r, &ImageBlockElement{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
a.ImageElement = element.(*ImageBlockElement)
|
||||||
|
case "button":
|
||||||
|
element, err := unmarshalBlockElement(r, &ButtonBlockElement{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
a.ButtonElement = element.(*ButtonBlockElement)
|
||||||
|
case "overflow":
|
||||||
|
element, err := unmarshalBlockElement(r, &OverflowBlockElement{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
a.OverflowElement = element.(*OverflowBlockElement)
|
||||||
|
case "datepicker":
|
||||||
|
element, err := unmarshalBlockElement(r, &DatePickerBlockElement{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
a.DatePickerElement = element.(*DatePickerBlockElement)
|
||||||
|
case "static_select":
|
||||||
|
element, err := unmarshalBlockElement(r, &SelectBlockElement{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
a.SelectElement = element.(*SelectBlockElement)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalBlockElement(r json.RawMessage, element BlockElement) (BlockElement, error) {
|
||||||
|
err := json.Unmarshal(r, element)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return element, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func toBlockElement(element *Accessory) BlockElement {
|
||||||
|
if element.ImageElement != nil {
|
||||||
|
return element.ImageElement
|
||||||
|
}
|
||||||
|
if element.ButtonElement != nil {
|
||||||
|
return element.ButtonElement
|
||||||
|
}
|
||||||
|
if element.OverflowElement != nil {
|
||||||
|
return element.OverflowElement
|
||||||
|
}
|
||||||
|
if element.DatePickerElement != nil {
|
||||||
|
return element.DatePickerElement
|
||||||
|
}
|
||||||
|
if element.SelectElement != nil {
|
||||||
|
return element.SelectElement
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the Marshaller interface for ContextElements so that any JSON
|
||||||
|
// marshalling is delegated and proper type determination can be made before marshal
|
||||||
|
func (e *ContextElements) MarshalJSON() ([]byte, error) {
|
||||||
|
bytes, err := json.Marshal(e.Elements)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the Unmarshaller interface for ContextElements, so that any JSON
|
||||||
|
// unmarshalling is delegated and proper type determination can be made before unmarshal
|
||||||
|
func (e *ContextElements) UnmarshalJSON(data []byte) error {
|
||||||
|
var raw []json.RawMessage
|
||||||
|
|
||||||
|
if string(data) == "{\"elements\":null}" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(data, &raw)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range raw {
|
||||||
|
s := sumtype{}
|
||||||
|
err := json.Unmarshal(r, &s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var contextElementType string
|
||||||
|
if s.TypeVal != "" {
|
||||||
|
contextElementType = s.TypeVal
|
||||||
|
}
|
||||||
|
|
||||||
|
switch contextElementType {
|
||||||
|
case PlainTextType, MarkdownType:
|
||||||
|
elem, err := unmarshalBlockObject(r, &TextBlockObject{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Elements = append(e.Elements, elem.(*TextBlockObject))
|
||||||
|
case "image":
|
||||||
|
elem, err := unmarshalBlockElement(r, &ImageBlockElement{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Elements = append(e.Elements, elem.(*ImageBlockElement))
|
||||||
|
default:
|
||||||
|
return errors.New("unsupported context element type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// DividerBlock for displaying a divider line between blocks (similar to <hr> tag in html)
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/blocks#divider
|
||||||
|
type DividerBlock struct {
|
||||||
|
Type MessageBlockType `json:"type"`
|
||||||
|
BlockID string `json:"block_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockType returns the type of the block
|
||||||
|
func (s DividerBlock) BlockType() MessageBlockType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDividerBlock returns a new instance of a divider block
|
||||||
|
func NewDividerBlock() *DividerBlock {
|
||||||
|
return &DividerBlock{
|
||||||
|
Type: MBTDivider,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,238 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// https://api.slack.com/reference/messaging/block-elements
|
||||||
|
|
||||||
|
const (
|
||||||
|
METImage MessageElementType = "image"
|
||||||
|
METButton MessageElementType = "button"
|
||||||
|
METOverflow MessageElementType = "overflow"
|
||||||
|
METDatepicker MessageElementType = "datepicker"
|
||||||
|
|
||||||
|
MixedElementImage MixedElementType = "mixed_image"
|
||||||
|
MixedElementText MixedElementType = "mixed_text"
|
||||||
|
|
||||||
|
OptTypeStatic string = "static_select"
|
||||||
|
OptTypeExternal string = "external_select"
|
||||||
|
OptTypeUser string = "users_select"
|
||||||
|
OptTypeConversations string = "conversations_select"
|
||||||
|
OptTypeChannels string = "channels_select"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MessageElementType string
|
||||||
|
type MixedElementType string
|
||||||
|
|
||||||
|
// BlockElement defines an interface that all block element types should implement.
|
||||||
|
type BlockElement interface {
|
||||||
|
ElementType() MessageElementType
|
||||||
|
}
|
||||||
|
|
||||||
|
type MixedElement interface {
|
||||||
|
MixedElementType() MixedElementType
|
||||||
|
}
|
||||||
|
|
||||||
|
type Accessory struct {
|
||||||
|
ImageElement *ImageBlockElement
|
||||||
|
ButtonElement *ButtonBlockElement
|
||||||
|
OverflowElement *OverflowBlockElement
|
||||||
|
DatePickerElement *DatePickerBlockElement
|
||||||
|
SelectElement *SelectBlockElement
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccessory returns a new Accessory for a given block element
|
||||||
|
func NewAccessory(element BlockElement) *Accessory {
|
||||||
|
switch element.(type) {
|
||||||
|
case *ImageBlockElement:
|
||||||
|
return &Accessory{ImageElement: element.(*ImageBlockElement)}
|
||||||
|
case *ButtonBlockElement:
|
||||||
|
return &Accessory{ButtonElement: element.(*ButtonBlockElement)}
|
||||||
|
case *OverflowBlockElement:
|
||||||
|
return &Accessory{OverflowElement: element.(*OverflowBlockElement)}
|
||||||
|
case *DatePickerBlockElement:
|
||||||
|
return &Accessory{DatePickerElement: element.(*DatePickerBlockElement)}
|
||||||
|
case *SelectBlockElement:
|
||||||
|
return &Accessory{SelectElement: element.(*SelectBlockElement)}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockElements is a convenience struct defined to allow dynamic unmarshalling of
|
||||||
|
// the "elements" value in Slack's JSON response, which varies depending on BlockElement type
|
||||||
|
type BlockElements struct {
|
||||||
|
ElementSet []BlockElement `json:"elements,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageBlockElement An element to insert an image - this element can be used
|
||||||
|
// in section and context blocks only. If you want a block with only an image
|
||||||
|
// in it, you're looking for the image block.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/block-elements#image
|
||||||
|
type ImageBlockElement struct {
|
||||||
|
Type MessageElementType `json:"type"`
|
||||||
|
ImageURL string `json:"image_url"`
|
||||||
|
AltText string `json:"alt_text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ElementType returns the type of the Element
|
||||||
|
func (s ImageBlockElement) ElementType() MessageElementType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s ImageBlockElement) MixedElementType() MixedElementType {
|
||||||
|
return MixedElementImage
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewImageBlockElement returns a new instance of an image block element
|
||||||
|
func NewImageBlockElement(imageURL, altText string) *ImageBlockElement {
|
||||||
|
return &ImageBlockElement{
|
||||||
|
Type: METImage,
|
||||||
|
ImageURL: imageURL,
|
||||||
|
AltText: altText,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Style string
|
||||||
|
|
||||||
|
const (
|
||||||
|
StyleDefault Style = "default"
|
||||||
|
StylePrimary Style = "primary"
|
||||||
|
StyleDanger Style = "danger"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ButtonBlockElement defines an interactive element that inserts a button. The
|
||||||
|
// button can be a trigger for anything from opening a simple link to starting
|
||||||
|
// a complex workflow.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/block-elements#button
|
||||||
|
type ButtonBlockElement struct {
|
||||||
|
Type MessageElementType `json:"type,omitempty"`
|
||||||
|
Text *TextBlockObject `json:"text"`
|
||||||
|
ActionID string `json:"action_id,omitempty"`
|
||||||
|
URL string `json:"url,omitempty"`
|
||||||
|
Value string `json:"value,omitempty"`
|
||||||
|
Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
|
||||||
|
Style Style `json:"style,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ElementType returns the type of the element
|
||||||
|
func (s ButtonBlockElement) ElementType() MessageElementType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// add styling to button object
|
||||||
|
func (s *ButtonBlockElement) WithStyle(style Style) {
|
||||||
|
s.Style = style
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewButtonBlockElement returns an instance of a new button element to be used within a block
|
||||||
|
func NewButtonBlockElement(actionID, value string, text *TextBlockObject) *ButtonBlockElement {
|
||||||
|
return &ButtonBlockElement{
|
||||||
|
Type: METButton,
|
||||||
|
ActionID: actionID,
|
||||||
|
Text: text,
|
||||||
|
Value: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelectBlockElement defines the simplest form of select menu, with a static list
|
||||||
|
// of options passed in when defining the element.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/block-elements#select
|
||||||
|
type SelectBlockElement struct {
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
Placeholder *TextBlockObject `json:"placeholder,omitempty"`
|
||||||
|
ActionID string `json:"action_id,omitempty"`
|
||||||
|
Options []*OptionBlockObject `json:"options,omitempty"`
|
||||||
|
OptionGroups []*OptionGroupBlockObject `json:"option_groups,omitempty"`
|
||||||
|
InitialOption *OptionBlockObject `json:"initial_option,omitempty"`
|
||||||
|
InitialUser string `json:"initial_user,omitempty"`
|
||||||
|
InitialConversation string `json:"initial_conversation,omitempty"`
|
||||||
|
InitialChannel string `json:"initial_channel,omitempty"`
|
||||||
|
MinQueryLength int `json:"min_query_length,omitempty"`
|
||||||
|
Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ElementType returns the type of the Element
|
||||||
|
func (s SelectBlockElement) ElementType() MessageElementType {
|
||||||
|
return MessageElementType(s.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOptionsSelectBlockElement returns a new instance of SelectBlockElement for use with
|
||||||
|
// the Options object only.
|
||||||
|
func NewOptionsSelectBlockElement(optType string, placeholder *TextBlockObject, actionID string, options ...*OptionBlockObject) *SelectBlockElement {
|
||||||
|
return &SelectBlockElement{
|
||||||
|
Type: optType,
|
||||||
|
Placeholder: placeholder,
|
||||||
|
ActionID: actionID,
|
||||||
|
Options: options,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOptionsGroupSelectBlockElement returns a new instance of SelectBlockElement for use with
|
||||||
|
// the Options object only.
|
||||||
|
func NewOptionsGroupSelectBlockElement(
|
||||||
|
optType string,
|
||||||
|
placeholder *TextBlockObject,
|
||||||
|
actionID string,
|
||||||
|
optGroups ...*OptionGroupBlockObject,
|
||||||
|
) *SelectBlockElement {
|
||||||
|
return &SelectBlockElement{
|
||||||
|
Type: optType,
|
||||||
|
Placeholder: placeholder,
|
||||||
|
ActionID: actionID,
|
||||||
|
OptionGroups: optGroups,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OverflowBlockElement defines the fields needed to use an overflow element.
|
||||||
|
// And Overflow Element is like a cross between a button and a select menu -
|
||||||
|
// when a user clicks on this overflow button, they will be presented with a
|
||||||
|
// list of options to choose from.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/block-elements#overflow
|
||||||
|
type OverflowBlockElement struct {
|
||||||
|
Type MessageElementType `json:"type"`
|
||||||
|
ActionID string `json:"action_id,omitempty"`
|
||||||
|
Options []*OptionBlockObject `json:"options"`
|
||||||
|
Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ElementType returns the type of the Element
|
||||||
|
func (s OverflowBlockElement) ElementType() MessageElementType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOverflowBlockElement returns an instance of a new Overflow Block Element
|
||||||
|
func NewOverflowBlockElement(actionID string, options ...*OptionBlockObject) *OverflowBlockElement {
|
||||||
|
return &OverflowBlockElement{
|
||||||
|
Type: METOverflow,
|
||||||
|
ActionID: actionID,
|
||||||
|
Options: options,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DatePickerBlockElement defines an element which lets users easily select a
|
||||||
|
// date from a calendar style UI. Date picker elements can be used inside of
|
||||||
|
// section and actions blocks.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/block-elements#datepicker
|
||||||
|
type DatePickerBlockElement struct {
|
||||||
|
Type MessageElementType `json:"type"`
|
||||||
|
ActionID string `json:"action_id"`
|
||||||
|
Placeholder *TextBlockObject `json:"placeholder,omitempty"`
|
||||||
|
InitialDate string `json:"initial_date,omitempty"`
|
||||||
|
Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ElementType returns the type of the Element
|
||||||
|
func (s DatePickerBlockElement) ElementType() MessageElementType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDatePickerBlockElement returns an instance of a date picker element
|
||||||
|
func NewDatePickerBlockElement(actionID string) *DatePickerBlockElement {
|
||||||
|
return &DatePickerBlockElement{
|
||||||
|
Type: METDatepicker,
|
||||||
|
ActionID: actionID,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// ImageBlock defines data required to display an image as a block element
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/blocks#image
|
||||||
|
type ImageBlock struct {
|
||||||
|
Type MessageBlockType `json:"type"`
|
||||||
|
ImageURL string `json:"image_url"`
|
||||||
|
AltText string `json:"alt_text"`
|
||||||
|
BlockID string `json:"block_id,omitempty"`
|
||||||
|
Title *TextBlockObject `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockType returns the type of the block
|
||||||
|
func (s ImageBlock) BlockType() MessageBlockType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewImageBlock returns an instance of a new Image Block type
|
||||||
|
func NewImageBlock(imageURL, altText, blockID string, title *TextBlockObject) *ImageBlock {
|
||||||
|
return &ImageBlock{
|
||||||
|
Type: MBTImage,
|
||||||
|
ImageURL: imageURL,
|
||||||
|
AltText: altText,
|
||||||
|
BlockID: blockID,
|
||||||
|
Title: title,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,216 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Block Objects are also known as Composition Objects
|
||||||
|
//
|
||||||
|
// For more information: https://api.slack.com/reference/messaging/composition-objects
|
||||||
|
|
||||||
|
// BlockObject defines an interface that all block object types should
|
||||||
|
// implement.
|
||||||
|
// @TODO: Is this interface needed?
|
||||||
|
|
||||||
|
// blockObject object types
|
||||||
|
const (
|
||||||
|
MarkdownType = "mrkdwn"
|
||||||
|
PlainTextType = "plain_text"
|
||||||
|
// The following objects don't actually have types and their corresponding
|
||||||
|
// const values are just for internal use
|
||||||
|
motConfirmation = "confirm"
|
||||||
|
motOption = "option"
|
||||||
|
motOptionGroup = "option_group"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MessageObjectType string
|
||||||
|
|
||||||
|
type blockObject interface {
|
||||||
|
validateType() MessageObjectType
|
||||||
|
}
|
||||||
|
|
||||||
|
type BlockObjects struct {
|
||||||
|
TextObjects []*TextBlockObject
|
||||||
|
ConfirmationObjects []*ConfirmationBlockObject
|
||||||
|
OptionObjects []*OptionBlockObject
|
||||||
|
OptionGroupObjects []*OptionGroupBlockObject
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the Unmarshaller interface for BlockObjects, so that any JSON
|
||||||
|
// unmarshalling is delegated and proper type determination can be made before unmarshal
|
||||||
|
func (b *BlockObjects) UnmarshalJSON(data []byte) error {
|
||||||
|
var raw []json.RawMessage
|
||||||
|
err := json.Unmarshal(data, &raw)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range raw {
|
||||||
|
var obj map[string]interface{}
|
||||||
|
err := json.Unmarshal(r, &obj)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
blockObjectType := getBlockObjectType(obj)
|
||||||
|
|
||||||
|
switch blockObjectType {
|
||||||
|
case PlainTextType, MarkdownType:
|
||||||
|
object, err := unmarshalBlockObject(r, &TextBlockObject{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
b.TextObjects = append(b.TextObjects, object.(*TextBlockObject))
|
||||||
|
case motConfirmation:
|
||||||
|
object, err := unmarshalBlockObject(r, &ConfirmationBlockObject{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
b.ConfirmationObjects = append(b.ConfirmationObjects, object.(*ConfirmationBlockObject))
|
||||||
|
case motOption:
|
||||||
|
object, err := unmarshalBlockObject(r, &OptionBlockObject{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
b.OptionObjects = append(b.OptionObjects, object.(*OptionBlockObject))
|
||||||
|
case motOptionGroup:
|
||||||
|
object, err := unmarshalBlockObject(r, &OptionGroupBlockObject{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
b.OptionGroupObjects = append(b.OptionGroupObjects, object.(*OptionGroupBlockObject))
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ideally would have a better way to identify the block objects for
|
||||||
|
// type casting at time of unmarshalling, should be adapted if possible
|
||||||
|
// to accomplish in a more reliable manner.
|
||||||
|
func getBlockObjectType(obj map[string]interface{}) string {
|
||||||
|
if t, ok := obj["type"].(string); ok {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
if _, ok := obj["confirm"].(string); ok {
|
||||||
|
return "confirm"
|
||||||
|
}
|
||||||
|
if _, ok := obj["options"].(string); ok {
|
||||||
|
return "option_group"
|
||||||
|
}
|
||||||
|
if _, ok := obj["text"].(string); ok {
|
||||||
|
if _, ok := obj["value"].(string); ok {
|
||||||
|
return "option"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalBlockObject(r json.RawMessage, object blockObject) (blockObject, error) {
|
||||||
|
err := json.Unmarshal(r, object)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return object, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextBlockObject defines a text element object to be used with blocks
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/composition-objects#text
|
||||||
|
type TextBlockObject struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
Emoji bool `json:"emoji,omitempty"`
|
||||||
|
Verbatim bool `json:"verbatim,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateType enforces block objects for element and block parameters
|
||||||
|
func (s TextBlockObject) validateType() MessageObjectType {
|
||||||
|
return MessageObjectType(s.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateType enforces block objects for element and block parameters
|
||||||
|
func (s TextBlockObject) MixedElementType() MixedElementType {
|
||||||
|
return MixedElementText
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewTextBlockObject returns an instance of a new Text Block Object
|
||||||
|
func NewTextBlockObject(elementType, text string, emoji, verbatim bool) *TextBlockObject {
|
||||||
|
return &TextBlockObject{
|
||||||
|
Type: elementType,
|
||||||
|
Text: text,
|
||||||
|
Emoji: emoji,
|
||||||
|
Verbatim: verbatim,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfirmationBlockObject defines a dialog that provides a confirmation step to
|
||||||
|
// any interactive element. This dialog will ask the user to confirm their action by
|
||||||
|
// offering a confirm and deny buttons.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/composition-objects#confirm
|
||||||
|
type ConfirmationBlockObject struct {
|
||||||
|
Title *TextBlockObject `json:"title"`
|
||||||
|
Text *TextBlockObject `json:"text"`
|
||||||
|
Confirm *TextBlockObject `json:"confirm"`
|
||||||
|
Deny *TextBlockObject `json:"deny"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateType enforces block objects for element and block parameters
|
||||||
|
func (s ConfirmationBlockObject) validateType() MessageObjectType {
|
||||||
|
return motConfirmation
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConfirmationBlockObject returns an instance of a new Confirmation Block Object
|
||||||
|
func NewConfirmationBlockObject(title, text, confirm, deny *TextBlockObject) *ConfirmationBlockObject {
|
||||||
|
return &ConfirmationBlockObject{
|
||||||
|
Title: title,
|
||||||
|
Text: text,
|
||||||
|
Confirm: confirm,
|
||||||
|
Deny: deny,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OptionBlockObject represents a single selectable item in a select menu
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/composition-objects#option
|
||||||
|
type OptionBlockObject struct {
|
||||||
|
Text *TextBlockObject `json:"text"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOptionBlockObject returns an instance of a new Option Block Element
|
||||||
|
func NewOptionBlockObject(value string, text *TextBlockObject) *OptionBlockObject {
|
||||||
|
return &OptionBlockObject{
|
||||||
|
Text: text,
|
||||||
|
Value: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateType enforces block objects for element and block parameters
|
||||||
|
func (s OptionBlockObject) validateType() MessageObjectType {
|
||||||
|
return motOption
|
||||||
|
}
|
||||||
|
|
||||||
|
// OptionGroupBlockObject Provides a way to group options in a select menu.
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/composition-objects#option-group
|
||||||
|
type OptionGroupBlockObject struct {
|
||||||
|
Label *TextBlockObject `json:"label,omitempty"`
|
||||||
|
Options []*OptionBlockObject `json:"options"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateType enforces block objects for element and block parameters
|
||||||
|
func (s OptionGroupBlockObject) validateType() MessageObjectType {
|
||||||
|
return motOptionGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOptionGroupBlockElement returns an instance of a new option group block element
|
||||||
|
func NewOptionGroupBlockElement(label *TextBlockObject, options ...*OptionBlockObject) *OptionGroupBlockObject {
|
||||||
|
return &OptionGroupBlockObject{
|
||||||
|
Label: label,
|
||||||
|
Options: options,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
// SectionBlock defines a new block of type section
|
||||||
|
//
|
||||||
|
// More Information: https://api.slack.com/reference/messaging/blocks#section
|
||||||
|
type SectionBlock struct {
|
||||||
|
Type MessageBlockType `json:"type"`
|
||||||
|
Text *TextBlockObject `json:"text,omitempty"`
|
||||||
|
BlockID string `json:"block_id,omitempty"`
|
||||||
|
Fields []*TextBlockObject `json:"fields,omitempty"`
|
||||||
|
Accessory *Accessory `json:"accessory,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlockType returns the type of the block
|
||||||
|
func (s SectionBlock) BlockType() MessageBlockType {
|
||||||
|
return s.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// SectionBlockOption allows configuration of options for a new section block
|
||||||
|
type SectionBlockOption func(*SectionBlock)
|
||||||
|
|
||||||
|
func SectionBlockOptionBlockID(blockID string) SectionBlockOption {
|
||||||
|
return func(block *SectionBlock) {
|
||||||
|
block.BlockID = blockID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSectionBlock returns a new instance of a section block to be rendered
|
||||||
|
func NewSectionBlock(textObj *TextBlockObject, fields []*TextBlockObject, accessory *Accessory, options ...SectionBlockOption) *SectionBlock {
|
||||||
|
block := SectionBlock{
|
||||||
|
Type: MBTSection,
|
||||||
|
Text: textObj,
|
||||||
|
Fields: fields,
|
||||||
|
Accessory: accessory,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, option := range options {
|
||||||
|
option(&block)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &block
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package slack
|
||||||
|
|
||||||
|
import "github.com/nlopes/slack/internal/errorsx"
|
||||||
|
|
||||||
|
// Errors returned by various methods.
|
||||||
|
const (
|
||||||
|
ErrAlreadyDisconnected = errorsx.String("Invalid call to Disconnect - Slack API is already disconnected")
|
||||||
|
ErrRTMDisconnected = errorsx.String("disconnect received while trying to connect")
|
||||||
|
ErrParametersMissing = errorsx.String("received empty parameters")
|
||||||
|
ErrInvalidConfiguration = errorsx.String("invalid configuration")
|
||||||
|
ErrMissingHeaders = errorsx.String("missing headers")
|
||||||
|
ErrExpiredTimestamp = errorsx.String("timestamp is too old")
|
||||||
|
)
|
||||||
|
|
||||||
|
// internal errors
|
||||||
|
const (
|
||||||
|
errPaginationComplete = errorsx.String("pagination complete")
|
||||||
|
)
|
@ -0,0 +1,9 @@
|
|||||||
|
module github.com/nlopes/slack
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/gorilla/websocket v1.2.0
|
||||||
|
github.com/pkg/errors v0.8.0
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/stretchr/testify v1.2.2
|
||||||
|
)
|
@ -0,0 +1,22 @@
|
|||||||
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
|
||||||
|
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
|
github.com/nlopes/slack v0.1.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM=
|
||||||
|
github.com/nlopes/slack v0.5.0 h1:NbIae8Kd0NpqaEI3iUrsuS0KbcEDhzhc939jLW5fNm0=
|
||||||
|
github.com/nlopes/slack v0.5.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM=
|
||||||
|
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/victorcoder/slack-test v0.0.0-20190131110821-6f9a569c10af h1:JFxr+No3ZWgCtxnnTWCybnB/z0Iy3qLmdj3u2NV5o48=
|
||||||
|
github.com/victorcoder/slack-test v0.0.0-20190131110821-6f9a569c10af/go.mod h1:dStM4ShMus8J3hiq66ExbbzGLkwyZ+RQJePwFhWCCvQ=
|
||||||
|
github.com/victorcoder/slack-test v0.0.0-20190131113129-a43b3bb77f43 h1:wtFekkaAAQibpy3iE4Hhx2Gi9pZAbITOSfVP7GXk5eM=
|
||||||
|
github.com/victorcoder/slack-test v0.0.0-20190131113129-a43b3bb77f43/go.mod h1:dStM4ShMus8J3hiq66ExbbzGLkwyZ+RQJePwFhWCCvQ=
|
||||||
|
golang.org/x/net v0.0.0-20180108090419-434ec0c7fe37 h1:BkNcmLtAVeWe9h5k0jt24CQgaG5vb4x/doFbAiEC/Ho=
|
||||||
|
golang.org/x/net v0.0.0-20180108090419-434ec0c7fe37/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
@ -0,0 +1,8 @@
|
|||||||
|
package errorsx
|
||||||
|
|
||||||
|
// String representing an error, useful for declaring string constants as errors.
|
||||||
|
type String string
|
||||||
|
|
||||||
|
func (t String) Error() string {
|
||||||
|
return string(t)
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package timex
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// Max returns the maximum duration
|
||||||
|
func Max(values ...time.Duration) time.Duration {
|
||||||
|
var (
|
||||||
|
max time.Duration
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, v := range values {
|
||||||
|
if v > max {
|
||||||
|
max = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return max
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue