Add IFTTT integration.

This commit is contained in:
Orne Brocaar 2022-07-06 15:43:00 +01:00
parent 9ab2f77ee2
commit 96ab49944c
28 changed files with 5495 additions and 832 deletions

File diff suppressed because it is too large Load Diff

View File

@ -107,6 +107,14 @@ type ApplicationServiceClient interface {
UpdatePilotThingsIntegration(ctx context.Context, in *UpdatePilotThingsIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Delete Pilot Things integration.
DeletePilotThingsIntegration(ctx context.Context, in *DeletePilotThingsIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Create IFTTT integration.
CreateIftttIntegration(ctx context.Context, in *CreateIftttIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Get IFTTT integration.
GetIftttIntegration(ctx context.Context, in *GetIftttIntegrationRequest, opts ...grpc.CallOption) (*GetIftttIntegrationResponse, error)
// Update IFTTT integration.
UpdateIftttIntegration(ctx context.Context, in *UpdateIftttIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Delete IFTTT integration.
DeleteIftttIntegration(ctx context.Context, in *DeleteIftttIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Generates application ID specific client-certificate.
GenerateMqttIntegrationClientCertificate(ctx context.Context, in *GenerateMqttIntegrationClientCertificateRequest, opts ...grpc.CallOption) (*GenerateMqttIntegrationClientCertificateResponse, error)
}
@ -497,6 +505,42 @@ func (c *applicationServiceClient) DeletePilotThingsIntegration(ctx context.Cont
return out, nil
}
func (c *applicationServiceClient) CreateIftttIntegration(ctx context.Context, in *CreateIftttIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.ApplicationService/CreateIftttIntegration", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *applicationServiceClient) GetIftttIntegration(ctx context.Context, in *GetIftttIntegrationRequest, opts ...grpc.CallOption) (*GetIftttIntegrationResponse, error) {
out := new(GetIftttIntegrationResponse)
err := c.cc.Invoke(ctx, "/api.ApplicationService/GetIftttIntegration", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *applicationServiceClient) UpdateIftttIntegration(ctx context.Context, in *UpdateIftttIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.ApplicationService/UpdateIftttIntegration", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *applicationServiceClient) DeleteIftttIntegration(ctx context.Context, in *DeleteIftttIntegrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.ApplicationService/DeleteIftttIntegration", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *applicationServiceClient) GenerateMqttIntegrationClientCertificate(ctx context.Context, in *GenerateMqttIntegrationClientCertificateRequest, opts ...grpc.CallOption) (*GenerateMqttIntegrationClientCertificateResponse, error) {
out := new(GenerateMqttIntegrationClientCertificateResponse)
err := c.cc.Invoke(ctx, "/api.ApplicationService/GenerateMqttIntegrationClientCertificate", in, out, opts...)
@ -594,6 +638,14 @@ type ApplicationServiceServer interface {
UpdatePilotThingsIntegration(context.Context, *UpdatePilotThingsIntegrationRequest) (*emptypb.Empty, error)
// Delete Pilot Things integration.
DeletePilotThingsIntegration(context.Context, *DeletePilotThingsIntegrationRequest) (*emptypb.Empty, error)
// Create IFTTT integration.
CreateIftttIntegration(context.Context, *CreateIftttIntegrationRequest) (*emptypb.Empty, error)
// Get IFTTT integration.
GetIftttIntegration(context.Context, *GetIftttIntegrationRequest) (*GetIftttIntegrationResponse, error)
// Update IFTTT integration.
UpdateIftttIntegration(context.Context, *UpdateIftttIntegrationRequest) (*emptypb.Empty, error)
// Delete IFTTT integration.
DeleteIftttIntegration(context.Context, *DeleteIftttIntegrationRequest) (*emptypb.Empty, error)
// Generates application ID specific client-certificate.
GenerateMqttIntegrationClientCertificate(context.Context, *GenerateMqttIntegrationClientCertificateRequest) (*GenerateMqttIntegrationClientCertificateResponse, error)
mustEmbedUnimplementedApplicationServiceServer()
@ -729,6 +781,18 @@ func (UnimplementedApplicationServiceServer) UpdatePilotThingsIntegration(contex
func (UnimplementedApplicationServiceServer) DeletePilotThingsIntegration(context.Context, *DeletePilotThingsIntegrationRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeletePilotThingsIntegration not implemented")
}
func (UnimplementedApplicationServiceServer) CreateIftttIntegration(context.Context, *CreateIftttIntegrationRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateIftttIntegration not implemented")
}
func (UnimplementedApplicationServiceServer) GetIftttIntegration(context.Context, *GetIftttIntegrationRequest) (*GetIftttIntegrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetIftttIntegration not implemented")
}
func (UnimplementedApplicationServiceServer) UpdateIftttIntegration(context.Context, *UpdateIftttIntegrationRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateIftttIntegration not implemented")
}
func (UnimplementedApplicationServiceServer) DeleteIftttIntegration(context.Context, *DeleteIftttIntegrationRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteIftttIntegration not implemented")
}
func (UnimplementedApplicationServiceServer) GenerateMqttIntegrationClientCertificate(context.Context, *GenerateMqttIntegrationClientCertificateRequest) (*GenerateMqttIntegrationClientCertificateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GenerateMqttIntegrationClientCertificate not implemented")
}
@ -1501,6 +1565,78 @@ func _ApplicationService_DeletePilotThingsIntegration_Handler(srv interface{}, c
return interceptor(ctx, in, info, handler)
}
func _ApplicationService_CreateIftttIntegration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateIftttIntegrationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ApplicationServiceServer).CreateIftttIntegration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.ApplicationService/CreateIftttIntegration",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ApplicationServiceServer).CreateIftttIntegration(ctx, req.(*CreateIftttIntegrationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ApplicationService_GetIftttIntegration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetIftttIntegrationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ApplicationServiceServer).GetIftttIntegration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.ApplicationService/GetIftttIntegration",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ApplicationServiceServer).GetIftttIntegration(ctx, req.(*GetIftttIntegrationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ApplicationService_UpdateIftttIntegration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateIftttIntegrationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ApplicationServiceServer).UpdateIftttIntegration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.ApplicationService/UpdateIftttIntegration",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ApplicationServiceServer).UpdateIftttIntegration(ctx, req.(*UpdateIftttIntegrationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ApplicationService_DeleteIftttIntegration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteIftttIntegrationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ApplicationServiceServer).DeleteIftttIntegration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.ApplicationService/DeleteIftttIntegration",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ApplicationServiceServer).DeleteIftttIntegration(ctx, req.(*DeleteIftttIntegrationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ApplicationService_GenerateMqttIntegrationClientCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenerateMqttIntegrationClientCertificateRequest)
if err := dec(in); err != nil {
@ -1694,6 +1830,22 @@ var ApplicationService_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeletePilotThingsIntegration",
Handler: _ApplicationService_DeletePilotThingsIntegration_Handler,
},
{
MethodName: "CreateIftttIntegration",
Handler: _ApplicationService_CreateIftttIntegration_Handler,
},
{
MethodName: "GetIftttIntegration",
Handler: _ApplicationService_GetIftttIntegration_Handler,
},
{
MethodName: "UpdateIftttIntegration",
Handler: _ApplicationService_UpdateIftttIntegration_Handler,
},
{
MethodName: "DeleteIftttIntegration",
Handler: _ApplicationService_DeleteIftttIntegration_Handler,
},
{
MethodName: "GenerateMqttIntegrationClientCertificate",
Handler: _ApplicationService_GenerateMqttIntegrationClientCertificate_Handler,

View File

@ -303,6 +303,34 @@ export class ApplicationServiceClient {
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
createIftttIntegration(
request: api_application_pb.CreateIftttIntegrationRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
getIftttIntegration(
request: api_application_pb.GetIftttIntegrationRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: api_application_pb.GetIftttIntegrationResponse) => void
): grpcWeb.ClientReadableStream<api_application_pb.GetIftttIntegrationResponse>;
updateIftttIntegration(
request: api_application_pb.UpdateIftttIntegrationRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
deleteIftttIntegration(
request: api_application_pb.DeleteIftttIntegrationRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
generateMqttIntegrationClientCertificate(
request: api_application_pb.GenerateMqttIntegrationClientCertificateRequest,
metadata: grpcWeb.Metadata | undefined,
@ -527,6 +555,26 @@ export class ApplicationServicePromiseClient {
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
createIftttIntegration(
request: api_application_pb.CreateIftttIntegrationRequest,
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
getIftttIntegration(
request: api_application_pb.GetIftttIntegrationRequest,
metadata?: grpcWeb.Metadata
): Promise<api_application_pb.GetIftttIntegrationResponse>;
updateIftttIntegration(
request: api_application_pb.UpdateIftttIntegrationRequest,
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
deleteIftttIntegration(
request: api_application_pb.DeleteIftttIntegrationRequest,
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
generateMqttIntegrationClientCertificate(
request: api_application_pb.GenerateMqttIntegrationClientCertificateRequest,
metadata?: grpcWeb.Metadata

View File

@ -3434,6 +3434,326 @@ proto.api.ApplicationServicePromiseClient.prototype.deletePilotThingsIntegration
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.CreateIftttIntegrationRequest,
* !proto.google.protobuf.Empty>}
*/
const methodDescriptor_ApplicationService_CreateIftttIntegration = new grpc.web.MethodDescriptor(
'/api.ApplicationService/CreateIftttIntegration',
grpc.web.MethodType.UNARY,
proto.api.CreateIftttIntegrationRequest,
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.CreateIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.CreateIftttIntegrationRequest,
* !proto.google.protobuf.Empty>}
*/
const methodInfo_ApplicationService_CreateIftttIntegration = new grpc.web.AbstractClientBase.MethodInfo(
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.CreateIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @param {!proto.api.CreateIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.google.protobuf.Empty>|undefined}
* The XHR Node Readable Stream
*/
proto.api.ApplicationServiceClient.prototype.createIftttIntegration =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.ApplicationService/CreateIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_CreateIftttIntegration,
callback);
};
/**
* @param {!proto.api.CreateIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.google.protobuf.Empty>}
* Promise that resolves to the response
*/
proto.api.ApplicationServicePromiseClient.prototype.createIftttIntegration =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.ApplicationService/CreateIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_CreateIftttIntegration);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.GetIftttIntegrationRequest,
* !proto.api.GetIftttIntegrationResponse>}
*/
const methodDescriptor_ApplicationService_GetIftttIntegration = new grpc.web.MethodDescriptor(
'/api.ApplicationService/GetIftttIntegration',
grpc.web.MethodType.UNARY,
proto.api.GetIftttIntegrationRequest,
proto.api.GetIftttIntegrationResponse,
/**
* @param {!proto.api.GetIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetIftttIntegrationResponse.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.GetIftttIntegrationRequest,
* !proto.api.GetIftttIntegrationResponse>}
*/
const methodInfo_ApplicationService_GetIftttIntegration = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetIftttIntegrationResponse,
/**
* @param {!proto.api.GetIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetIftttIntegrationResponse.deserializeBinary
);
/**
* @param {!proto.api.GetIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.api.GetIftttIntegrationResponse)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.api.GetIftttIntegrationResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.api.ApplicationServiceClient.prototype.getIftttIntegration =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.ApplicationService/GetIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_GetIftttIntegration,
callback);
};
/**
* @param {!proto.api.GetIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.api.GetIftttIntegrationResponse>}
* Promise that resolves to the response
*/
proto.api.ApplicationServicePromiseClient.prototype.getIftttIntegration =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.ApplicationService/GetIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_GetIftttIntegration);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.UpdateIftttIntegrationRequest,
* !proto.google.protobuf.Empty>}
*/
const methodDescriptor_ApplicationService_UpdateIftttIntegration = new grpc.web.MethodDescriptor(
'/api.ApplicationService/UpdateIftttIntegration',
grpc.web.MethodType.UNARY,
proto.api.UpdateIftttIntegrationRequest,
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.UpdateIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.UpdateIftttIntegrationRequest,
* !proto.google.protobuf.Empty>}
*/
const methodInfo_ApplicationService_UpdateIftttIntegration = new grpc.web.AbstractClientBase.MethodInfo(
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.UpdateIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @param {!proto.api.UpdateIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.google.protobuf.Empty>|undefined}
* The XHR Node Readable Stream
*/
proto.api.ApplicationServiceClient.prototype.updateIftttIntegration =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.ApplicationService/UpdateIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_UpdateIftttIntegration,
callback);
};
/**
* @param {!proto.api.UpdateIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.google.protobuf.Empty>}
* Promise that resolves to the response
*/
proto.api.ApplicationServicePromiseClient.prototype.updateIftttIntegration =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.ApplicationService/UpdateIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_UpdateIftttIntegration);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.DeleteIftttIntegrationRequest,
* !proto.google.protobuf.Empty>}
*/
const methodDescriptor_ApplicationService_DeleteIftttIntegration = new grpc.web.MethodDescriptor(
'/api.ApplicationService/DeleteIftttIntegration',
grpc.web.MethodType.UNARY,
proto.api.DeleteIftttIntegrationRequest,
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.DeleteIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.DeleteIftttIntegrationRequest,
* !proto.google.protobuf.Empty>}
*/
const methodInfo_ApplicationService_DeleteIftttIntegration = new grpc.web.AbstractClientBase.MethodInfo(
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.DeleteIftttIntegrationRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @param {!proto.api.DeleteIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.google.protobuf.Empty>|undefined}
* The XHR Node Readable Stream
*/
proto.api.ApplicationServiceClient.prototype.deleteIftttIntegration =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.ApplicationService/DeleteIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_DeleteIftttIntegration,
callback);
};
/**
* @param {!proto.api.DeleteIftttIntegrationRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.google.protobuf.Empty>}
* Promise that resolves to the response
*/
proto.api.ApplicationServicePromiseClient.prototype.deleteIftttIntegration =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.ApplicationService/DeleteIftttIntegration',
request,
metadata || {},
methodDescriptor_ApplicationService_DeleteIftttIntegration);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<

View File

@ -144,6 +144,11 @@ export class GetApplicationResponse extends jspb.Message {
hasUpdatedAt(): boolean;
clearUpdatedAt(): GetApplicationResponse;
getMeasurementKeysList(): Array<string>;
setMeasurementKeysList(value: Array<string>): GetApplicationResponse;
clearMeasurementKeysList(): GetApplicationResponse;
addMeasurementKeys(value: string, index?: number): GetApplicationResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetApplicationResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetApplicationResponse): GetApplicationResponse.AsObject;
@ -157,6 +162,7 @@ export namespace GetApplicationResponse {
application?: Application.AsObject,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
measurementKeysList: Array<string>,
}
}
@ -1534,6 +1540,130 @@ export namespace DeletePilotThingsIntegrationRequest {
}
}
export class IftttIntegration extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): IftttIntegration;
getKey(): string;
setKey(value: string): IftttIntegration;
getUplinkValuesList(): Array<string>;
setUplinkValuesList(value: Array<string>): IftttIntegration;
clearUplinkValuesList(): IftttIntegration;
addUplinkValues(value: string, index?: number): IftttIntegration;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): IftttIntegration.AsObject;
static toObject(includeInstance: boolean, msg: IftttIntegration): IftttIntegration.AsObject;
static serializeBinaryToWriter(message: IftttIntegration, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): IftttIntegration;
static deserializeBinaryFromReader(message: IftttIntegration, reader: jspb.BinaryReader): IftttIntegration;
}
export namespace IftttIntegration {
export type AsObject = {
applicationId: string,
key: string,
uplinkValuesList: Array<string>,
}
}
export class CreateIftttIntegrationRequest extends jspb.Message {
getIntegration(): IftttIntegration | undefined;
setIntegration(value?: IftttIntegration): CreateIftttIntegrationRequest;
hasIntegration(): boolean;
clearIntegration(): CreateIftttIntegrationRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateIftttIntegrationRequest): CreateIftttIntegrationRequest.AsObject;
static serializeBinaryToWriter(message: CreateIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateIftttIntegrationRequest;
static deserializeBinaryFromReader(message: CreateIftttIntegrationRequest, reader: jspb.BinaryReader): CreateIftttIntegrationRequest;
}
export namespace CreateIftttIntegrationRequest {
export type AsObject = {
integration?: IftttIntegration.AsObject,
}
}
export class GetIftttIntegrationRequest extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): GetIftttIntegrationRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetIftttIntegrationRequest): GetIftttIntegrationRequest.AsObject;
static serializeBinaryToWriter(message: GetIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetIftttIntegrationRequest;
static deserializeBinaryFromReader(message: GetIftttIntegrationRequest, reader: jspb.BinaryReader): GetIftttIntegrationRequest;
}
export namespace GetIftttIntegrationRequest {
export type AsObject = {
applicationId: string,
}
}
export class GetIftttIntegrationResponse extends jspb.Message {
getIntegration(): IftttIntegration | undefined;
setIntegration(value?: IftttIntegration): GetIftttIntegrationResponse;
hasIntegration(): boolean;
clearIntegration(): GetIftttIntegrationResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetIftttIntegrationResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetIftttIntegrationResponse): GetIftttIntegrationResponse.AsObject;
static serializeBinaryToWriter(message: GetIftttIntegrationResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetIftttIntegrationResponse;
static deserializeBinaryFromReader(message: GetIftttIntegrationResponse, reader: jspb.BinaryReader): GetIftttIntegrationResponse;
}
export namespace GetIftttIntegrationResponse {
export type AsObject = {
integration?: IftttIntegration.AsObject,
}
}
export class UpdateIftttIntegrationRequest extends jspb.Message {
getIntegration(): IftttIntegration | undefined;
setIntegration(value?: IftttIntegration): UpdateIftttIntegrationRequest;
hasIntegration(): boolean;
clearIntegration(): UpdateIftttIntegrationRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: UpdateIftttIntegrationRequest): UpdateIftttIntegrationRequest.AsObject;
static serializeBinaryToWriter(message: UpdateIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateIftttIntegrationRequest;
static deserializeBinaryFromReader(message: UpdateIftttIntegrationRequest, reader: jspb.BinaryReader): UpdateIftttIntegrationRequest;
}
export namespace UpdateIftttIntegrationRequest {
export type AsObject = {
integration?: IftttIntegration.AsObject,
}
}
export class DeleteIftttIntegrationRequest extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): DeleteIftttIntegrationRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeleteIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: DeleteIftttIntegrationRequest): DeleteIftttIntegrationRequest.AsObject;
static serializeBinaryToWriter(message: DeleteIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeleteIftttIntegrationRequest;
static deserializeBinaryFromReader(message: DeleteIftttIntegrationRequest, reader: jspb.BinaryReader): DeleteIftttIntegrationRequest;
}
export namespace DeleteIftttIntegrationRequest {
export type AsObject = {
applicationId: string,
}
}
export class GenerateMqttIntegrationClientCertificateRequest extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): GenerateMqttIntegrationClientCertificateRequest;
@ -1599,6 +1729,7 @@ export enum IntegrationKind {
AZURE_SERVICE_BUS = 7,
PILOT_THINGS = 8,
MQTT_GLOBAL = 9,
IFTTT = 10,
}
export enum InfluxDbPrecision {
NS = 0,

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,10 @@ interface IApplicationServiceService extends grpc.ServiceDefinition<grpc.Untyped
getPilotThingsIntegration: grpc.MethodDefinition<api_application_pb.GetPilotThingsIntegrationRequest, api_application_pb.GetPilotThingsIntegrationResponse>;
updatePilotThingsIntegration: grpc.MethodDefinition<api_application_pb.UpdatePilotThingsIntegrationRequest, google_protobuf_empty_pb.Empty>;
deletePilotThingsIntegration: grpc.MethodDefinition<api_application_pb.DeletePilotThingsIntegrationRequest, google_protobuf_empty_pb.Empty>;
createIftttIntegration: grpc.MethodDefinition<api_application_pb.CreateIftttIntegrationRequest, google_protobuf_empty_pb.Empty>;
getIftttIntegration: grpc.MethodDefinition<api_application_pb.GetIftttIntegrationRequest, api_application_pb.GetIftttIntegrationResponse>;
updateIftttIntegration: grpc.MethodDefinition<api_application_pb.UpdateIftttIntegrationRequest, google_protobuf_empty_pb.Empty>;
deleteIftttIntegration: grpc.MethodDefinition<api_application_pb.DeleteIftttIntegrationRequest, google_protobuf_empty_pb.Empty>;
generateMqttIntegrationClientCertificate: grpc.MethodDefinition<api_application_pb.GenerateMqttIntegrationClientCertificateRequest, api_application_pb.GenerateMqttIntegrationClientCertificateResponse>;
}
@ -98,6 +102,10 @@ export interface IApplicationServiceServer extends grpc.UntypedServiceImplementa
getPilotThingsIntegration: grpc.handleUnaryCall<api_application_pb.GetPilotThingsIntegrationRequest, api_application_pb.GetPilotThingsIntegrationResponse>;
updatePilotThingsIntegration: grpc.handleUnaryCall<api_application_pb.UpdatePilotThingsIntegrationRequest, google_protobuf_empty_pb.Empty>;
deletePilotThingsIntegration: grpc.handleUnaryCall<api_application_pb.DeletePilotThingsIntegrationRequest, google_protobuf_empty_pb.Empty>;
createIftttIntegration: grpc.handleUnaryCall<api_application_pb.CreateIftttIntegrationRequest, google_protobuf_empty_pb.Empty>;
getIftttIntegration: grpc.handleUnaryCall<api_application_pb.GetIftttIntegrationRequest, api_application_pb.GetIftttIntegrationResponse>;
updateIftttIntegration: grpc.handleUnaryCall<api_application_pb.UpdateIftttIntegrationRequest, google_protobuf_empty_pb.Empty>;
deleteIftttIntegration: grpc.handleUnaryCall<api_application_pb.DeleteIftttIntegrationRequest, google_protobuf_empty_pb.Empty>;
generateMqttIntegrationClientCertificate: grpc.handleUnaryCall<api_application_pb.GenerateMqttIntegrationClientCertificateRequest, api_application_pb.GenerateMqttIntegrationClientCertificateResponse>;
}
@ -229,6 +237,18 @@ export class ApplicationServiceClient extends grpc.Client {
deletePilotThingsIntegration(argument: api_application_pb.DeletePilotThingsIntegrationRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
deletePilotThingsIntegration(argument: api_application_pb.DeletePilotThingsIntegrationRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
deletePilotThingsIntegration(argument: api_application_pb.DeletePilotThingsIntegrationRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
createIftttIntegration(argument: api_application_pb.CreateIftttIntegrationRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
createIftttIntegration(argument: api_application_pb.CreateIftttIntegrationRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
createIftttIntegration(argument: api_application_pb.CreateIftttIntegrationRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
getIftttIntegration(argument: api_application_pb.GetIftttIntegrationRequest, callback: grpc.requestCallback<api_application_pb.GetIftttIntegrationResponse>): grpc.ClientUnaryCall;
getIftttIntegration(argument: api_application_pb.GetIftttIntegrationRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_application_pb.GetIftttIntegrationResponse>): grpc.ClientUnaryCall;
getIftttIntegration(argument: api_application_pb.GetIftttIntegrationRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_application_pb.GetIftttIntegrationResponse>): grpc.ClientUnaryCall;
updateIftttIntegration(argument: api_application_pb.UpdateIftttIntegrationRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
updateIftttIntegration(argument: api_application_pb.UpdateIftttIntegrationRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
updateIftttIntegration(argument: api_application_pb.UpdateIftttIntegrationRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
deleteIftttIntegration(argument: api_application_pb.DeleteIftttIntegrationRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
deleteIftttIntegration(argument: api_application_pb.DeleteIftttIntegrationRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
deleteIftttIntegration(argument: api_application_pb.DeleteIftttIntegrationRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
generateMqttIntegrationClientCertificate(argument: api_application_pb.GenerateMqttIntegrationClientCertificateRequest, callback: grpc.requestCallback<api_application_pb.GenerateMqttIntegrationClientCertificateResponse>): grpc.ClientUnaryCall;
generateMqttIntegrationClientCertificate(argument: api_application_pb.GenerateMqttIntegrationClientCertificateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_application_pb.GenerateMqttIntegrationClientCertificateResponse>): grpc.ClientUnaryCall;
generateMqttIntegrationClientCertificate(argument: api_application_pb.GenerateMqttIntegrationClientCertificateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_application_pb.GenerateMqttIntegrationClientCertificateResponse>): grpc.ClientUnaryCall;

View File

@ -72,6 +72,17 @@ function deserialize_api_CreateHttpIntegrationRequest(buffer_arg) {
return api_application_pb.CreateHttpIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_CreateIftttIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.CreateIftttIntegrationRequest)) {
throw new Error('Expected argument of type api.CreateIftttIntegrationRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_CreateIftttIntegrationRequest(buffer_arg) {
return api_application_pb.CreateIftttIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_CreateInfluxDbIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.CreateInfluxDbIntegrationRequest)) {
throw new Error('Expected argument of type api.CreateInfluxDbIntegrationRequest');
@ -182,6 +193,17 @@ function deserialize_api_DeleteHttpIntegrationRequest(buffer_arg) {
return api_application_pb.DeleteHttpIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_DeleteIftttIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.DeleteIftttIntegrationRequest)) {
throw new Error('Expected argument of type api.DeleteIftttIntegrationRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_DeleteIftttIntegrationRequest(buffer_arg) {
return api_application_pb.DeleteIftttIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_DeleteInfluxDbIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.DeleteInfluxDbIntegrationRequest)) {
throw new Error('Expected argument of type api.DeleteInfluxDbIntegrationRequest');
@ -369,6 +391,28 @@ function deserialize_api_GetHttpIntegrationResponse(buffer_arg) {
return api_application_pb.GetHttpIntegrationResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetIftttIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.GetIftttIntegrationRequest)) {
throw new Error('Expected argument of type api.GetIftttIntegrationRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetIftttIntegrationRequest(buffer_arg) {
return api_application_pb.GetIftttIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetIftttIntegrationResponse(arg) {
if (!(arg instanceof api_application_pb.GetIftttIntegrationResponse)) {
throw new Error('Expected argument of type api.GetIftttIntegrationResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetIftttIntegrationResponse(buffer_arg) {
return api_application_pb.GetIftttIntegrationResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetInfluxDbIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.GetInfluxDbIntegrationRequest)) {
throw new Error('Expected argument of type api.GetInfluxDbIntegrationRequest');
@ -578,6 +622,17 @@ function deserialize_api_UpdateHttpIntegrationRequest(buffer_arg) {
return api_application_pb.UpdateHttpIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_UpdateIftttIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.UpdateIftttIntegrationRequest)) {
throw new Error('Expected argument of type api.UpdateIftttIntegrationRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_UpdateIftttIntegrationRequest(buffer_arg) {
return api_application_pb.UpdateIftttIntegrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_UpdateInfluxDbIntegrationRequest(arg) {
if (!(arg instanceof api_application_pb.UpdateInfluxDbIntegrationRequest)) {
throw new Error('Expected argument of type api.UpdateInfluxDbIntegrationRequest');
@ -1151,6 +1206,54 @@ deletePilotThingsIntegration: {
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// Create IFTTT integration.
createIftttIntegration: {
path: '/api.ApplicationService/CreateIftttIntegration',
requestStream: false,
responseStream: false,
requestType: api_application_pb.CreateIftttIntegrationRequest,
responseType: google_protobuf_empty_pb.Empty,
requestSerialize: serialize_api_CreateIftttIntegrationRequest,
requestDeserialize: deserialize_api_CreateIftttIntegrationRequest,
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// Get IFTTT integration.
getIftttIntegration: {
path: '/api.ApplicationService/GetIftttIntegration',
requestStream: false,
responseStream: false,
requestType: api_application_pb.GetIftttIntegrationRequest,
responseType: api_application_pb.GetIftttIntegrationResponse,
requestSerialize: serialize_api_GetIftttIntegrationRequest,
requestDeserialize: deserialize_api_GetIftttIntegrationRequest,
responseSerialize: serialize_api_GetIftttIntegrationResponse,
responseDeserialize: deserialize_api_GetIftttIntegrationResponse,
},
// Update IFTTT integration.
updateIftttIntegration: {
path: '/api.ApplicationService/UpdateIftttIntegration',
requestStream: false,
responseStream: false,
requestType: api_application_pb.UpdateIftttIntegrationRequest,
responseType: google_protobuf_empty_pb.Empty,
requestSerialize: serialize_api_UpdateIftttIntegrationRequest,
requestDeserialize: deserialize_api_UpdateIftttIntegrationRequest,
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// Delete IFTTT integration.
deleteIftttIntegration: {
path: '/api.ApplicationService/DeleteIftttIntegration',
requestStream: false,
responseStream: false,
requestType: api_application_pb.DeleteIftttIntegrationRequest,
responseType: google_protobuf_empty_pb.Empty,
requestSerialize: serialize_api_DeleteIftttIntegrationRequest,
requestDeserialize: deserialize_api_DeleteIftttIntegrationRequest,
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// Generates application ID specific client-certificate.
generateMqttIntegrationClientCertificate: {
path: '/api.ApplicationService/GenerateMqttIntegrationClientCertificate',

View File

@ -155,6 +155,11 @@ export class GetApplicationResponse extends jspb.Message {
getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): void;
clearMeasurementKeysList(): void;
getMeasurementKeysList(): Array<string>;
setMeasurementKeysList(value: Array<string>): void;
addMeasurementKeys(value: string, index?: number): string;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetApplicationResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetApplicationResponse): GetApplicationResponse.AsObject;
@ -170,6 +175,7 @@ export namespace GetApplicationResponse {
application?: Application.AsObject,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
measurementKeysList: Array<string>,
}
}
@ -1670,6 +1676,142 @@ export namespace DeletePilotThingsIntegrationRequest {
}
}
export class IftttIntegration extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): void;
getKey(): string;
setKey(value: string): void;
clearUplinkValuesList(): void;
getUplinkValuesList(): Array<string>;
setUplinkValuesList(value: Array<string>): void;
addUplinkValues(value: string, index?: number): string;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): IftttIntegration.AsObject;
static toObject(includeInstance: boolean, msg: IftttIntegration): IftttIntegration.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: IftttIntegration, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): IftttIntegration;
static deserializeBinaryFromReader(message: IftttIntegration, reader: jspb.BinaryReader): IftttIntegration;
}
export namespace IftttIntegration {
export type AsObject = {
applicationId: string,
key: string,
uplinkValuesList: Array<string>,
}
}
export class CreateIftttIntegrationRequest extends jspb.Message {
hasIntegration(): boolean;
clearIntegration(): void;
getIntegration(): IftttIntegration | undefined;
setIntegration(value?: IftttIntegration): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateIftttIntegrationRequest): CreateIftttIntegrationRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateIftttIntegrationRequest;
static deserializeBinaryFromReader(message: CreateIftttIntegrationRequest, reader: jspb.BinaryReader): CreateIftttIntegrationRequest;
}
export namespace CreateIftttIntegrationRequest {
export type AsObject = {
integration?: IftttIntegration.AsObject,
}
}
export class GetIftttIntegrationRequest extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetIftttIntegrationRequest): GetIftttIntegrationRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetIftttIntegrationRequest;
static deserializeBinaryFromReader(message: GetIftttIntegrationRequest, reader: jspb.BinaryReader): GetIftttIntegrationRequest;
}
export namespace GetIftttIntegrationRequest {
export type AsObject = {
applicationId: string,
}
}
export class GetIftttIntegrationResponse extends jspb.Message {
hasIntegration(): boolean;
clearIntegration(): void;
getIntegration(): IftttIntegration | undefined;
setIntegration(value?: IftttIntegration): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetIftttIntegrationResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetIftttIntegrationResponse): GetIftttIntegrationResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetIftttIntegrationResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetIftttIntegrationResponse;
static deserializeBinaryFromReader(message: GetIftttIntegrationResponse, reader: jspb.BinaryReader): GetIftttIntegrationResponse;
}
export namespace GetIftttIntegrationResponse {
export type AsObject = {
integration?: IftttIntegration.AsObject,
}
}
export class UpdateIftttIntegrationRequest extends jspb.Message {
hasIntegration(): boolean;
clearIntegration(): void;
getIntegration(): IftttIntegration | undefined;
setIntegration(value?: IftttIntegration): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: UpdateIftttIntegrationRequest): UpdateIftttIntegrationRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpdateIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateIftttIntegrationRequest;
static deserializeBinaryFromReader(message: UpdateIftttIntegrationRequest, reader: jspb.BinaryReader): UpdateIftttIntegrationRequest;
}
export namespace UpdateIftttIntegrationRequest {
export type AsObject = {
integration?: IftttIntegration.AsObject,
}
}
export class DeleteIftttIntegrationRequest extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeleteIftttIntegrationRequest.AsObject;
static toObject(includeInstance: boolean, msg: DeleteIftttIntegrationRequest): DeleteIftttIntegrationRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeleteIftttIntegrationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeleteIftttIntegrationRequest;
static deserializeBinaryFromReader(message: DeleteIftttIntegrationRequest, reader: jspb.BinaryReader): DeleteIftttIntegrationRequest;
}
export namespace DeleteIftttIntegrationRequest {
export type AsObject = {
applicationId: string,
}
}
export class GenerateMqttIntegrationClientCertificateRequest extends jspb.Message {
getApplicationId(): string;
setApplicationId(value: string): void;
@ -1742,6 +1884,7 @@ export interface IntegrationKindMap {
AZURE_SERVICE_BUS: 7;
PILOT_THINGS: 8;
MQTT_GLOBAL: 9;
IFTTT: 10;
}
export const IntegrationKind: IntegrationKindMap;

File diff suppressed because it is too large Load Diff

View File

@ -138,6 +138,18 @@ service ApplicationService {
// Delete Pilot Things integration.
rpc DeletePilotThingsIntegration(DeletePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Create IFTTT integration.
rpc CreateIftttIntegration(CreateIftttIntegrationRequest) returns (google.protobuf.Empty) {}
// Get IFTTT integration.
rpc GetIftttIntegration(GetIftttIntegrationRequest) returns (GetIftttIntegrationResponse) {}
// Update IFTTT integration.
rpc UpdateIftttIntegration(UpdateIftttIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete IFTTT integration.
rpc DeleteIftttIntegration(DeleteIftttIntegrationRequest) returns (google.protobuf.Empty) {}
// Generates application ID specific client-certificate.
rpc GenerateMqttIntegrationClientCertificate(GenerateMqttIntegrationClientCertificateRequest) returns (GenerateMqttIntegrationClientCertificateResponse) {}
}
@ -158,6 +170,7 @@ enum IntegrationKind {
AZURE_SERVICE_BUS = 7;
PILOT_THINGS = 8;
MQTT_GLOBAL = 9;
IFTTT = 10;
}
message Application {
@ -216,6 +229,11 @@ message GetApplicationResponse {
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Measurement keys.
// This contains the measurement keys from all the device-profiles that
// are used by the devices under this application.
repeated string measurement_keys = 4;
}
message UpdateApplicationRequest {
@ -718,6 +736,53 @@ message DeletePilotThingsIntegrationRequest {
string application_id = 1;
}
message IftttIntegration {
// Application ID (UUID).
string application_id = 1;
// Key.
// This key can be obtained from the IFTTT Webhooks documentation page.
string key = 2;
// Values.
// Up to 2 values can be forwarded to IFTTT. These values must map to the
// decoded payload keys. For example:
// {
// "batteryLevel": 75.3,
// "buttons": [{"pressed": false}, {"pressed": true}]
// }
// You would specify the following fields:
// uplink_values = ["batteryLevel", "buttons_0_pressed"]
//
// Note: The first value is always used for the DevEUI.
repeated string uplink_values = 3;
}
message CreateIftttIntegrationRequest {
// Integration object.
IftttIntegration integration = 1;
}
message GetIftttIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetIftttIntegrationResponse {
// Integration object.
IftttIntegration integration = 1;
}
message UpdateIftttIntegrationRequest {
// Integration object to update.
IftttIntegration integration = 1;
}
message DeleteIftttIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GenerateMqttIntegrationClientCertificateRequest {
// Application ID (UUID).
string application_id = 1;

View File

@ -138,6 +138,18 @@ service ApplicationService {
// Delete Pilot Things integration.
rpc DeletePilotThingsIntegration(DeletePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Create IFTTT integration.
rpc CreateIftttIntegration(CreateIftttIntegrationRequest) returns (google.protobuf.Empty) {}
// Get IFTTT integration.
rpc GetIftttIntegration(GetIftttIntegrationRequest) returns (GetIftttIntegrationResponse) {}
// Update IFTTT integration.
rpc UpdateIftttIntegration(UpdateIftttIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete IFTTT integration.
rpc DeleteIftttIntegration(DeleteIftttIntegrationRequest) returns (google.protobuf.Empty) {}
// Generates application ID specific client-certificate.
rpc GenerateMqttIntegrationClientCertificate(GenerateMqttIntegrationClientCertificateRequest) returns (GenerateMqttIntegrationClientCertificateResponse) {}
}
@ -158,6 +170,7 @@ enum IntegrationKind {
AZURE_SERVICE_BUS = 7;
PILOT_THINGS = 8;
MQTT_GLOBAL = 9;
IFTTT = 10;
}
message Application {
@ -216,6 +229,11 @@ message GetApplicationResponse {
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Measurement keys.
// This contains the measurement keys from all the device-profiles that
// are used by the devices under this application.
repeated string measurement_keys = 4;
}
message UpdateApplicationRequest {
@ -718,6 +736,53 @@ message DeletePilotThingsIntegrationRequest {
string application_id = 1;
}
message IftttIntegration {
// Application ID (UUID).
string application_id = 1;
// Key.
// This key can be obtained from the IFTTT Webhooks documentation page.
string key = 2;
// Values.
// Up to 2 values can be forwarded to IFTTT. These values must map to the
// decoded payload keys. For example:
// {
// "batteryLevel": 75.3,
// "buttons": [{"pressed": false}, {"pressed": true}]
// }
// You would specify the following fields:
// uplink_values = ["batteryLevel", "buttons_0_pressed"]
//
// Note: The first value is always used for the DevEUI.
repeated string uplink_values = 3;
}
message CreateIftttIntegrationRequest {
// Integration object.
IftttIntegration integration = 1;
}
message GetIftttIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetIftttIntegrationResponse {
// Integration object.
IftttIntegration integration = 1;
}
message UpdateIftttIntegrationRequest {
// Integration object to update.
IftttIntegration integration = 1;
}
message DeleteIftttIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GenerateMqttIntegrationClientCertificateRequest {
// Application ID (UUID).
string application_id = 1;

View File

@ -72,6 +72,9 @@ impl ApplicationService for Application {
.await?;
let a = application::get(&app_id).await.map_err(|e| e.status())?;
let measurement_keys = application::get_measurement_keys(&app_id)
.await
.map_err(|e| e.status())?;
Ok(Response::new(api::GetApplicationResponse {
application: Some(api::Application {
@ -82,6 +85,7 @@ impl ApplicationService for Application {
}),
created_at: Some(helpers::datetime_to_prost_timestamp(&a.created_at)),
updated_at: Some(helpers::datetime_to_prost_timestamp(&a.updated_at)),
measurement_keys,
}))
}
@ -213,6 +217,7 @@ impl ApplicationService for Application {
api::IntegrationKind::AzureServiceBus
}
application::IntegrationKind::PilotThings => api::IntegrationKind::PilotThings,
application::IntegrationKind::Ifttt => api::IntegrationKind::Ifttt,
}
.into(),
})
@ -1486,6 +1491,136 @@ impl ApplicationService for Application {
Ok(Response::new(()))
}
async fn create_ifttt_integration(
&self,
request: Request<api::CreateIftttIntegrationRequest>,
) -> Result<Response<()>, Status> {
let req_int = match &request.get_ref().integration {
Some(v) => v,
None => {
return Err(Status::invalid_argument("integration is missing"));
}
};
let app_id = Uuid::from_str(&req_int.application_id).map_err(|e| e.status())?;
self.validator
.validate(
request.extensions(),
validator::ValidateApplicationAccess::new(validator::Flag::Update, app_id),
)
.await?;
let _ = application::create_integration(application::Integration {
application_id: app_id,
kind: application::IntegrationKind::Ifttt,
configuration: application::IntegrationConfiguration::Ifttt(
application::IftttConfiguration {
key: req_int.key.clone(),
uplink_values: [
req_int.uplink_values.get(0).cloned().unwrap_or_default(),
req_int.uplink_values.get(1).cloned().unwrap_or_default(),
],
},
),
..Default::default()
})
.await
.map_err(|e| e.status())?;
Ok(Response::new(()))
}
async fn get_ifttt_integration(
&self,
request: Request<api::GetIftttIntegrationRequest>,
) -> Result<Response<api::GetIftttIntegrationResponse>, Status> {
let req = request.get_ref();
let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?;
self.validator
.validate(
request.extensions(),
validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id),
)
.await?;
let i = application::get_integration(&app_id, application::IntegrationKind::Ifttt)
.await
.map_err(|e| e.status())?;
if let application::IntegrationConfiguration::Ifttt(conf) = &i.configuration {
Ok(Response::new(api::GetIftttIntegrationResponse {
integration: Some(api::IftttIntegration {
application_id: app_id.to_string(),
key: conf.key.clone(),
uplink_values: conf.uplink_values.to_vec(),
}),
}))
} else {
Err(Status::internal("Integration has no Ifttt configuration"))
}
}
async fn update_ifttt_integration(
&self,
request: Request<api::UpdateIftttIntegrationRequest>,
) -> Result<Response<()>, Status> {
let req_int = match &request.get_ref().integration {
Some(v) => v,
None => {
return Err(Status::invalid_argument("integration is missing"));
}
};
let app_id = Uuid::from_str(&req_int.application_id).map_err(|e| e.status())?;
self.validator
.validate(
request.extensions(),
validator::ValidateApplicationAccess::new(validator::Flag::Update, app_id),
)
.await?;
let _ = application::update_integration(application::Integration {
application_id: app_id,
kind: application::IntegrationKind::Ifttt,
configuration: application::IntegrationConfiguration::Ifttt(
application::IftttConfiguration {
key: req_int.key.clone(),
uplink_values: [
req_int.uplink_values.get(0).cloned().unwrap_or_default(),
req_int.uplink_values.get(1).cloned().unwrap_or_default(),
],
},
),
..Default::default()
})
.await
.map_err(|e| e.status())?;
Ok(Response::new(()))
}
async fn delete_ifttt_integration(
&self,
request: Request<api::DeleteIftttIntegrationRequest>,
) -> Result<Response<()>, Status> {
let req = request.get_ref();
let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?;
self.validator
.validate(
request.extensions(),
validator::ValidateApplicationAccess::new(validator::Flag::Update, app_id),
)
.await?;
application::delete_integration(&app_id, application::IntegrationKind::Ifttt)
.await
.map_err(|e| e.status())?;
Ok(Response::new(()))
}
async fn generate_mqtt_integration_client_certificate(
&self,
request: Request<api::GenerateMqttIntegrationClientCertificateRequest>,
@ -2974,4 +3109,126 @@ pub mod test {
list_resp
);
}
#[tokio::test]
async fn test_ifttt_integration() {
let _guard = test::prepare().await;
let app = get_application().await;
let u = get_user().await;
let service = Application::new(RequestValidator::new());
// create
let create_req = get_request(
&u.id,
api::CreateIftttIntegrationRequest {
integration: Some(api::IftttIntegration {
application_id: app.id.to_string(),
key: "verysecret".into(),
uplink_values: vec!["value_1".into(), "value_2".into()],
}),
},
);
let _ = service.create_ifttt_integration(create_req).await.unwrap();
// get
let get_req = get_request(
&u.id,
api::GetIftttIntegrationRequest {
application_id: app.id.to_string(),
},
);
let get_resp = service.get_ifttt_integration(get_req).await.unwrap();
let get_resp = get_resp.get_ref();
assert_eq!(
Some(api::IftttIntegration {
application_id: app.id.to_string(),
key: "verysecret".into(),
uplink_values: vec!["value_1".into(), "value_2".into()],
}),
get_resp.integration
);
// update
let update_req = get_request(
&u.id,
api::UpdateIftttIntegrationRequest {
integration: Some(api::IftttIntegration {
application_id: app.id.to_string(),
key: "verysecrettoo".into(),
uplink_values: vec!["value_4".into(), "value_5".into()],
}),
},
);
let _ = service.update_ifttt_integration(update_req).await.unwrap();
// get
let get_req = get_request(
&u.id,
api::GetIftttIntegrationRequest {
application_id: app.id.to_string(),
},
);
let get_resp = service.get_ifttt_integration(get_req).await.unwrap();
let get_resp = get_resp.get_ref();
assert_eq!(
Some(api::IftttIntegration {
application_id: app.id.to_string(),
key: "verysecrettoo".into(),
uplink_values: vec!["value_4".into(), "value_5".into()],
}),
get_resp.integration
);
// list
let list_req = get_request(
&u.id,
api::ListIntegrationsRequest {
application_id: app.id.to_string(),
},
);
let list_resp = service.list_integrations(list_req).await.unwrap();
let list_resp = list_resp.get_ref();
assert_eq!(
&api::ListIntegrationsResponse {
total_count: 2,
result: vec![
api::IntegrationListItem {
kind: api::IntegrationKind::Ifttt.into(),
},
api::IntegrationListItem {
kind: api::IntegrationKind::MqttGlobal.into(),
}
],
},
list_resp
);
// delete
let del_req = get_request(
&u.id,
api::DeleteIftttIntegrationRequest {
application_id: app.id.to_string(),
},
);
let _ = service.delete_ifttt_integration(del_req).await.unwrap();
// list
let list_req = get_request(
&u.id,
api::ListIntegrationsRequest {
application_id: app.id.to_string(),
},
);
let list_resp = service.list_integrations(list_req).await.unwrap();
let list_resp = list_resp.get_ref();
assert_eq!(
&api::ListIntegrationsResponse {
total_count: 1,
result: vec![api::IntegrationListItem {
kind: api::IntegrationKind::MqttGlobal.into(),
},],
},
list_resp
);
}
}

View File

@ -0,0 +1,231 @@
use std::collections::HashMap;
use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use reqwest::header::{HeaderMap, CONTENT_TYPE};
use reqwest::Client;
use serde::{Deserialize, Serialize};
use tracing::{error, info, trace};
use super::Integration as IntegrationTrait;
use crate::codec;
use crate::storage::application::IftttConfiguration;
use chirpstack_api::integration;
#[derive(Serialize, Deserialize)]
struct Values {
#[serde(skip_serializing_if = "String::is_empty")]
pub value1: String,
#[serde(skip_serializing_if = "String::is_empty")]
pub value2: String,
#[serde(skip_serializing_if = "String::is_empty")]
pub value3: String,
}
pub struct Integration {
key: String,
uplink_values: [String; 2],
server: String,
}
impl Integration {
pub fn new(conf: &IftttConfiguration) -> Integration {
trace!("Initializing ifttt integration");
Integration {
key: conf.key.clone(),
uplink_values: conf.uplink_values.clone(),
server: "https://maker.ifttt.com".to_string(),
}
}
async fn post(&self, event: &str, v: Values) -> Result<()> {
let url = format!("{}/trigger/{}/with/key/{}", self.server, event, self.key);
let client = Client::builder().timeout(Duration::from_secs(5)).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
info!(event = %event, "Sending event to IFTTT");
let res = client.post(url).json(&v).headers(headers).send().await?;
match res.error_for_status() {
Ok(_) => Ok(()),
Err(e) => {
error!(event = %event, error = %e, "Sending event to IFTTT failed");
Err(anyhow::Error::new(e))
}
}
}
}
#[async_trait]
impl IntegrationTrait for Integration {
async fn uplink_event(
&self,
_vars: &HashMap<String, String>,
pl: &integration::UplinkEvent,
) -> Result<()> {
let data_measurements: HashMap<String, pbjson_types::value::Kind> = match &pl.object {
None => {
trace!("object is None, nothing to send");
return Ok(());
}
Some(v) => codec::get_measurements(v),
};
let v = Values {
value1: pl.device_info.as_ref().unwrap().dev_eui.clone(),
value2: match data_measurements.get(&self.uplink_values[0]) {
Some(v) => kind_to_string(v),
None => "".to_string(),
},
value3: match data_measurements.get(&self.uplink_values[1]) {
Some(v) => kind_to_string(v),
None => "".to_string(),
},
};
// Nothing to do.
if v.value1.is_empty() && v.value2.is_empty() && v.value3.is_empty() {
trace!("All values are empty, nothing to send");
return Ok(());
}
self.post("up", v).await
}
async fn join_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::JoinEvent,
) -> Result<()> {
Ok(())
}
async fn status_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::StatusEvent,
) -> Result<()> {
Ok(())
}
async fn ack_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::AckEvent,
) -> Result<()> {
Ok(())
}
async fn txack_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::TxAckEvent,
) -> Result<()> {
Ok(())
}
async fn log_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::LogEvent,
) -> Result<()> {
Ok(())
}
async fn location_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::LocationEvent,
) -> Result<()> {
Ok(())
}
async fn integration_event(
&self,
_vars: &HashMap<String, String>,
_pl: &integration::IntegrationEvent,
) -> Result<()> {
Ok(())
}
}
fn kind_to_string(k: &pbjson_types::value::Kind) -> String {
match k {
pbjson_types::value::Kind::NullValue(_) => "".to_string(),
pbjson_types::value::Kind::NumberValue(v) => v.to_string(),
pbjson_types::value::Kind::StringValue(v) => v.clone(),
pbjson_types::value::Kind::BoolValue(v) => v.to_string(),
pbjson_types::value::Kind::StructValue(_) | pbjson_types::value::Kind::ListValue(_) => {
// this should not happen
"".to_string()
}
}
}
#[cfg(test)]
pub mod test {
use super::*;
use httpmock::prelude::*;
#[tokio::test]
async fn test_ifttt() {
let server = MockServer::start();
let i = Integration {
key: "verysecret".into(),
uplink_values: ["temp".to_string(), "door_open".to_string()],
server: server.url(""),
};
// uplink event
let pl = integration::UplinkEvent {
device_info: Some(integration::DeviceInfo {
dev_eui: "0102030405060708".to_string(),
..Default::default()
}),
object: Some(pbjson_types::Struct {
fields: [
(
"temp".to_string(),
pbjson_types::Value {
kind: Some(pbjson_types::value::Kind::NumberValue(23.5)),
},
),
(
"door_open".to_string(),
pbjson_types::Value {
kind: Some(pbjson_types::value::Kind::StringValue(
"closed".to_string(),
)),
},
),
]
.iter()
.cloned()
.collect(),
}),
..Default::default()
};
let mut mock = server.mock(|when, then| {
when.method(POST)
.path("/trigger/up/with/key/verysecret")
.header("Content-Type", "application/json")
.body(
serde_json::to_string(&Values {
value1: "0102030405060708".to_string(),
value2: "23.5".to_string(),
value3: "closed".to_string(),
})
.unwrap(),
);
then.status(200);
});
i.uplink_event(&HashMap::new(), &pl).await.unwrap();
mock.assert();
mock.delete();
}
}

View File

@ -17,6 +17,7 @@ mod aws_sns;
mod azure_service_bus;
mod gcp_pub_sub;
mod http;
mod ifttt;
mod influxdb;
mod loracloud;
#[cfg(test)]
@ -162,6 +163,9 @@ async fn for_application_id(id: &Uuid) -> Result<Vec<Box<dyn Integration + Sync
application::IntegrationConfiguration::ThingsBoard(conf) => {
Box::new(thingsboard::Integration::new(conf))
}
application::IntegrationConfiguration::Ifttt(conf) => {
Box::new(ifttt::Integration::new(conf))
}
_ => {
continue;
}

View File

@ -85,6 +85,7 @@ pub enum IntegrationKind {
AwsSns,
AzureServiceBus,
PilotThings,
Ifttt,
}
impl fmt::Display for IntegrationKind {
@ -107,6 +108,7 @@ impl FromStr for IntegrationKind {
"AwsSns" => IntegrationKind::AwsSns,
"AzureServiceBus" => IntegrationKind::AzureServiceBus,
"PilotThings" => IntegrationKind::PilotThings,
"Ifttt" => IntegrationKind::Ifttt,
_ => {
return Err(anyhow!("Unexpected IntegrationKind: {}", s));
}
@ -148,6 +150,7 @@ pub enum IntegrationConfiguration {
AwsSns(AwsSnsConfiguration),
AzureServiceBus(AzureServiceBusConfiguration),
PilotThings(PilotThingsConfiguration),
Ifttt(IftttConfiguration),
}
impl deserialize::FromSql<Jsonb, Pg> for IntegrationConfiguration {
@ -249,6 +252,12 @@ pub struct PilotThingsConfiguration {
pub token: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct IftttConfiguration {
pub key: String,
pub uplink_values: [String; 2], // The first value is reserved for the DevEUI
}
#[derive(Clone, Queryable, Insertable, AsChangeset, PartialEq, Debug)]
#[table_name = "application_integration"]
pub struct Integration {
@ -542,6 +551,40 @@ pub async fn get_integrations_for_application(
.await?
}
pub async fn get_measurement_keys(application_id: &Uuid) -> Result<Vec<String>, Error> {
#[derive(QueryableByName)]
struct Measurement {
#[sql_type = "diesel::sql_types::Text"]
pub key: String,
}
task::spawn_blocking({
let application_id = *application_id;
move || -> Result<Vec<String>, Error> {
let c = get_db_conn()?;
let keys: Vec<Measurement> = diesel::sql_query(
r#"
select
distinct jsonb_object_keys(dp.measurements) as key
from
device_profile dp
inner join device d
on d.device_profile_id = dp.id
where
d.application_id = $1
order by
key
"#,
)
.bind::<diesel::pg::types::sql_types::Uuid, _>(application_id)
.load(&c)
.map_err(|e| Error::from_diesel(e, application_id.to_string()))?;
Ok(keys.iter().map(|k| k.key.clone()).collect())
}
})
.await?
}
#[cfg(test)]
pub mod test {
use super::*;

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -78,7 +78,12 @@ class CodeEditor extends Component<IProps, IState> {
return (
<Form.Item label={this.props.label} name={this.props.name} tooltip={this.props.tooltip}>
<div style={{ border: "1px solid #cccccc" }}>
<CodeMirror key={`code-editor-refresh-${this.state.reloadKey}`} value={this.state.value} options={codeMirrorOptions} onBeforeChange={this.handleChange} />
<CodeMirror
key={`code-editor-refresh-${this.state.reloadKey}`}
value={this.state.value}
options={codeMirrorOptions}
onBeforeChange={this.handleChange}
/>
</div>
</Form.Item>
);

View File

@ -57,6 +57,11 @@ import {
GetThingsBoardIntegrationResponse,
UpdateThingsBoardIntegrationRequest,
DeleteThingsBoardIntegrationRequest,
CreateIftttIntegrationRequest,
GetIftttIntegrationRequest,
GetIftttIntegrationResponse,
UpdateIftttIntegrationRequest,
DeleteIftttIntegrationRequest,
GenerateMqttIntegrationClientCertificateRequest,
GenerateMqttIntegrationClientCertificateResponse,
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
@ -717,6 +722,69 @@ class ApplicationStore extends EventEmitter {
});
};
createIftttIntegration = (req: CreateIftttIntegrationRequest, callbackFunc: () => void) => {
this.client.createIftttIntegration(req, SessionStore.getMetadata(), err => {
if (err !== null) {
HandleError(err);
return;
}
notification.success({
message: "IFTTT integration created",
duration: 3,
});
callbackFunc();
});
};
getIftttIntegration = (
req: GetIftttIntegrationRequest,
callbackFunc: (resp: GetIftttIntegrationResponse) => void,
) => {
this.client.getIftttIntegration(req, SessionStore.getMetadata(), (err, resp) => {
if (err !== null) {
HandleError(err);
return;
}
callbackFunc(resp);
});
};
updateIftttIntegration = (req: UpdateIftttIntegrationRequest, callbackFunc: () => void) => {
this.client.updateIftttIntegration(req, SessionStore.getMetadata(), err => {
if (err !== null) {
HandleError(err);
return;
}
notification.success({
message: "IFTTT integration updated",
duration: 3,
});
callbackFunc();
});
};
deleteIftttIntegration = (req: DeleteIftttIntegrationRequest, callbackFunc: () => void) => {
this.client.deleteIftttIntegration(req, SessionStore.getMetadata(), err => {
if (err !== null) {
HandleError(err);
return;
}
notification.success({
message: "IFTTT integration deleted",
duration: 3,
});
this.emit("integration.delete");
callbackFunc();
});
};
generateMqttIntegrationClientCertificate = (
req: GenerateMqttIntegrationClientCertificateRequest,
callbackFunc: (resp: GenerateMqttIntegrationClientCertificateResponse) => void,

View File

@ -34,10 +34,13 @@ import EditLoRaCloudIntegration from "./integrations/EditLoRaCloudIntegration";
import CreateThingsBoardIntegration from "./integrations/CreateThingsBoardIntegration";
import EditThingsBoardIntegration from "./integrations/EditThingsBoardIntegration";
import GenerateMqttCertificate from "./integrations/GenerateMqttCertificate";
import CreateIftttIntegration from "./integrations/CreateIftttIntegration";
import EditIftttIntegration from "./integrations/EditIftttIntegration";
interface IProps extends RouteComponentProps {
tenant: Tenant;
application: Application;
measurementKeys: string[];
}
class ApplicationLayout extends Component<IProps> {
@ -243,6 +246,20 @@ class ApplicationLayout extends Component<IProps> {
path={`${this.props.match.path}/integrations/mqtt/certificate`}
render={props => <GenerateMqttCertificate application={app} {...props} />}
/>
<Route
exact
path={`${this.props.match.path}/integrations/ifttt/create`}
render={props => (
<CreateIftttIntegration application={app} measurementKeys={this.props.measurementKeys} {...props} />
)}
/>
<Route
exact
path={`${this.props.match.path}/integrations/ifttt/edit`}
render={props => (
<EditIftttIntegration application={app} measurementKeys={this.props.measurementKeys} {...props} />
)}
/>
</Switch>
</Card>
</Space>

View File

@ -25,12 +25,15 @@ interface IProps extends RouteComponentProps<MatchParams> {
interface IState {
application?: Application;
measurementKeys: string[];
}
class ApplicationLoader extends Component<IProps, IState> {
constructor(props: IProps) {
super(props);
this.state = {};
this.state = {
measurementKeys: [],
};
}
componentDidMount() {
@ -44,6 +47,7 @@ class ApplicationLoader extends Component<IProps, IState> {
ApplicationStore.get(req, (resp: GetApplicationResponse) => {
this.setState({
application: resp.getApplication(),
measurementKeys: resp.getMeasurementKeysList(),
});
});
};
@ -77,7 +81,17 @@ class ApplicationLoader extends Component<IProps, IState> {
path={`${path}/devices/:devEui([0-9a-f]{16})`}
component={(props: any) => <DeviceLayout tenant={tenant} application={app} {...props} />}
/>
<Route path={path} render={props => <ApplicationLayout tenant={tenant} application={app} {...props} />} />
<Route
path={path}
render={props => (
<ApplicationLayout
tenant={tenant}
application={app}
measurementKeys={this.state.measurementKeys}
{...props}
/>
)}
/>
</Switch>
);
}

View File

@ -21,6 +21,7 @@ import InfluxdbCard from "./integrations/InfluxdbCard";
import PilotThingsCard from "./integrations/PilotThingsCard";
import LoRaCloudCard from "./integrations/LoRaCloudCard";
import ThingsBoardCard from "./integrations/ThingsBoardCard";
import IftttCard from "./integrations/IftttCard";
interface IProps {
application: Application;
@ -95,6 +96,13 @@ class ListIntegrations extends Component<IProps, IState> {
available.push(<HttpCard application={this.props.application} add />);
}
// IFTTT
if (includes(resp.getResultList(), IntegrationKind.IFTTT)) {
configured.push(<IftttCard application={this.props.application} />);
} else {
available.push(<IftttCard application={this.props.application} add />);
}
// InfluxDB
if (includes(resp.getResultList(), IntegrationKind.INFLUX_DB)) {
configured.push(<InfluxdbCard application={this.props.application} />);

View File

@ -0,0 +1,46 @@
import React, { Component } from "react";
import { RouteComponentProps } from "react-router-dom";
import { Card } from "antd";
import {
Application,
IftttIntegration,
CreateIftttIntegrationRequest,
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
import IftttIntegrationForm from "./IftttIntegrationForm";
import ApplicationStore from "../../../stores/ApplicationStore";
interface IProps extends RouteComponentProps {
application: Application;
measurementKeys: string[];
}
class CreateIftttIntegration extends Component<IProps> {
onFinish = (obj: IftttIntegration) => {
obj.setApplicationId(this.props.application.getId());
let req = new CreateIftttIntegrationRequest();
req.setIntegration(obj);
ApplicationStore.createIftttIntegration(req, () => {
this.props.history.push(
`/tenants/${this.props.application.getTenantId()}/applications/${this.props.application.getId()}/integrations`,
);
});
};
render() {
const i = new IftttIntegration();
i.setUplinkValuesList(["", ""]);
return (
<Card title="Add IFTTT integration">
<IftttIntegrationForm measurementKeys={this.props.measurementKeys} initialValues={i} onFinish={this.onFinish} />
</Card>
);
}
}
export default CreateIftttIntegration;

View File

@ -0,0 +1,71 @@
import React, { Component } from "react";
import { RouteComponentProps } from "react-router-dom";
import { Card } from "antd";
import {
Application,
IftttIntegration,
GetIftttIntegrationRequest,
GetIftttIntegrationResponse,
UpdateIftttIntegrationRequest,
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
import IftttIntegrationForm from "./IftttIntegrationForm";
import ApplicationStore from "../../../stores/ApplicationStore";
interface IProps extends RouteComponentProps {
application: Application;
measurementKeys: string[];
}
interface IState {
integration?: IftttIntegration;
}
class EditIftttIntegration extends Component<IProps, IState> {
constructor(props: IProps) {
super(props);
this.state = {};
}
componentDidMount() {
let req = new GetIftttIntegrationRequest();
req.setApplicationId(this.props.application.getId());
ApplicationStore.getIftttIntegration(req, (resp: GetIftttIntegrationResponse) => {
this.setState({
integration: resp.getIntegration(),
});
});
}
onFinish = (obj: IftttIntegration) => {
let req = new UpdateIftttIntegrationRequest();
req.setIntegration(obj);
ApplicationStore.updateIftttIntegration(req, () => {
this.props.history.push(
`/tenants/${this.props.application.getTenantId()}/applications/${this.props.application.getId()}/integrations`,
);
});
};
render() {
if (this.state.integration === undefined) {
return null;
}
return (
<Card title="Update IFTTT integration">
<IftttIntegrationForm
measurementKeys={this.props.measurementKeys}
initialValues={this.state.integration}
onFinish={this.onFinish}
/>
</Card>
);
}
}
export default EditIftttIntegration;

View File

@ -0,0 +1,58 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Col, Card, Popconfirm } from "antd";
import { PlusOutlined, EditOutlined, DeleteOutlined } from "@ant-design/icons";
import { Application, DeleteIftttIntegrationRequest } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
import ApplicationStore from "../../../stores/ApplicationStore";
interface IProps {
application: Application;
add?: boolean;
}
class IftttCard extends Component<IProps> {
onDelete = () => {
let req = new DeleteIftttIntegrationRequest();
req.setApplicationId(this.props.application.getId());
ApplicationStore.deleteIftttIntegration(req, () => {});
};
render() {
let actions: any[] = [];
if (!!this.props.add) {
actions = [
<Link to="integrations/ifttt/create">
<PlusOutlined />
</Link>,
];
} else {
actions = [
<Link to="integrations/ifttt/edit">
<EditOutlined />
</Link>,
<Popconfirm title="Are you sure you want to delete this integration?" onConfirm={this.onDelete}>
<DeleteOutlined />
</Popconfirm>,
];
}
return (
<Col span={8}>
<Card
title="IFTTT"
className="integration-card"
cover={<img alt="IFTTT" src="/integrations/ifttt.png" style={{ padding: 1 }} />}
actions={actions}
>
<Card.Meta description="The IFTTT integration forwards events to the IFTTT Webhooks integration." />
</Card>
</Col>
);
}
}
export default IftttCard;

View File

@ -0,0 +1,67 @@
import React, { Component } from "react";
import { Form, Input, AutoComplete, Button } from "antd";
import { IftttIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
interface IProps {
measurementKeys: string[];
initialValues: IftttIntegration;
onFinish: (obj: IftttIntegration) => void;
}
class IftttIntegrationForm extends Component<IProps> {
onFinish = (values: IftttIntegration.AsObject) => {
const v = Object.assign(this.props.initialValues.toObject(), values);
let i = new IftttIntegration();
i.setApplicationId(v.applicationId);
i.setKey(v.key);
i.setUplinkValuesList(v.uplinkValuesList);
this.props.onFinish(i);
};
render() {
const options: {
value: string;
}[] = this.props.measurementKeys.map(v => {
return { value: v };
});
return (
<Form layout="vertical" initialValues={this.props.initialValues.toObject()} onFinish={this.onFinish}>
<Form.Item
label="Key"
name="key"
rules={[{ required: true, message: "Please enter a key!" }]}
tooltip="This key can be obtained from the IFTTT Webhooks integrations documentation"
>
<Input.Password />
</Form.Item>
<Form.List name="uplinkValuesList">
{fields => (
<div>
{fields.map((field, i) => (
<Form.Item
label={`Value ${i + 1} key`}
{...field}
tooltip="This must match the key in the decoded uplink payload. Nested keys are joined with a '_', array elements are indexed (starting at zero), e.g. 'sensor_0', 'sensor_1'. Auto-completion is based on measurements configuration in the device-profile(s) used within this application."
>
<AutoComplete options={options} />
</Form.Item>
))}
</div>
)}
</Form.List>
<Form.Item>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
);
}
}
export default IftttIntegrationForm;

View File

@ -64,7 +64,7 @@ class GatewayForm extends Component<IProps, IState> {
this.setLocationFields,
);
});
}
};
onFinish = (values: Gateway.AsObject) => {
const v = Object.assign(this.props.initialValues.toObject(), values);
@ -154,7 +154,14 @@ class GatewayForm extends Component<IProps, IState> {
eventHandlers={{ dragend: this.updateLocation }}
/>
</Map>
<Button onClick={this.getCurrentLocation} disabled={this.state.locationPending} type="link" style={{float: "right"}}>Set to current location</Button>
<Button
onClick={this.getCurrentLocation}
disabled={this.state.locationPending}
type="link"
style={{ float: "right" }}
>
Set to current location
</Button>
</Space>
</Form.Item>
</Tabs.TabPane>

View File

@ -1881,7 +1881,7 @@
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@chirpstack/chirpstack-api-grpc-web@file:../api/grpc-web":
version "4.0.0-test.6"
version "4.0.0-test.7"
dependencies:
"@types/google-protobuf" "^3.15.2"
google-protobuf "^3.17.3"