@scrawn/core 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/gen/auth/v1/auth_grpc_pb.js +45 -0
- package/dist/gen/auth/v1/auth_pb.js +471 -86
- package/dist/gen/data/v1/data_grpc_pb.js +44 -0
- package/dist/gen/data/v1/data_pb.js +1530 -0
- package/dist/gen/event/v1/event_grpc_pb.js +79 -0
- package/dist/gen/event/v1/event_pb.js +1862 -138
- package/dist/gen/package.json +3 -0
- package/dist/gen/payment/v1/payment_grpc_pb.js +45 -0
- package/dist/gen/payment/v1/payment_pb.js +321 -59
- package/dist/gen/query/v1/query_grpc_pb.js +44 -0
- package/dist/gen/query/v1/query_pb.js +2327 -0
- package/package.json +18 -14
- package/dist/config.d.ts +0 -26
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -25
- package/dist/config.js.map +0 -1
- package/dist/core/auth/apiKeyAuth.d.ts +0 -67
- package/dist/core/auth/apiKeyAuth.d.ts.map +0 -1
- package/dist/core/auth/apiKeyAuth.js +0 -71
- package/dist/core/auth/apiKeyAuth.js.map +0 -1
- package/dist/core/auth/baseAuth.d.ts +0 -92
- package/dist/core/auth/baseAuth.d.ts.map +0 -1
- package/dist/core/auth/baseAuth.js +0 -28
- package/dist/core/auth/baseAuth.js.map +0 -1
- package/dist/core/grpc/client.d.ts +0 -126
- package/dist/core/grpc/client.d.ts.map +0 -1
- package/dist/core/grpc/client.js +0 -138
- package/dist/core/grpc/client.js.map +0 -1
- package/dist/core/grpc/index.d.ts +0 -12
- package/dist/core/grpc/index.d.ts.map +0 -1
- package/dist/core/grpc/index.js +0 -11
- package/dist/core/grpc/index.js.map +0 -1
- package/dist/core/grpc/requestBuilder.d.ts +0 -116
- package/dist/core/grpc/requestBuilder.d.ts.map +0 -1
- package/dist/core/grpc/requestBuilder.js +0 -146
- package/dist/core/grpc/requestBuilder.js.map +0 -1
- package/dist/core/grpc/types.d.ts +0 -54
- package/dist/core/grpc/types.d.ts.map +0 -1
- package/dist/core/grpc/types.js +0 -9
- package/dist/core/grpc/types.js.map +0 -1
- package/dist/core/scrawn.d.ts +0 -197
- package/dist/core/scrawn.d.ts.map +0 -1
- package/dist/core/scrawn.js +0 -331
- package/dist/core/scrawn.js.map +0 -1
- package/dist/core/types/auth.d.ts +0 -31
- package/dist/core/types/auth.d.ts.map +0 -1
- package/dist/core/types/auth.js +0 -2
- package/dist/core/types/auth.js.map +0 -1
- package/dist/core/types/event.d.ts +0 -119
- package/dist/core/types/event.d.ts.map +0 -1
- package/dist/core/types/event.js +0 -15
- package/dist/core/types/event.js.map +0 -1
- package/dist/gen/auth/v1/auth_connect.d.ts +0 -22
- package/dist/gen/auth/v1/auth_connect.d.ts.map +0 -1
- package/dist/gen/auth/v1/auth_connect.js +0 -26
- package/dist/gen/auth/v1/auth_connect.js.map +0 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +0 -59
- package/dist/gen/auth/v1/auth_pb.d.ts.map +0 -1
- package/dist/gen/auth/v1/auth_pb.js.map +0 -1
- package/dist/gen/event/v1/event_connect.d.ts +0 -22
- package/dist/gen/event/v1/event_connect.d.ts.map +0 -1
- package/dist/gen/event/v1/event_connect.js +0 -26
- package/dist/gen/event/v1/event_connect.js.map +0 -1
- package/dist/gen/event/v1/event_pb.d.ts +0 -105
- package/dist/gen/event/v1/event_pb.d.ts.map +0 -1
- package/dist/gen/event/v1/event_pb.js.map +0 -1
- package/dist/gen/payment/v1/payment_connect.d.ts +0 -22
- package/dist/gen/payment/v1/payment_connect.d.ts.map +0 -1
- package/dist/gen/payment/v1/payment_connect.js +0 -26
- package/dist/gen/payment/v1/payment_connect.js.map +0 -1
- package/dist/gen/payment/v1/payment_pb.d.ts +0 -37
- package/dist/gen/payment/v1/payment_pb.d.ts.map +0 -1
- package/dist/gen/payment/v1/payment_pb.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -15
- package/dist/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -10
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -62
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/pathMatcher.d.ts +0 -25
- package/dist/utils/pathMatcher.d.ts.map +0 -1
- package/dist/utils/pathMatcher.js +0 -46
- package/dist/utils/pathMatcher.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Scrawn SDK
|
|
2
|
+
|
|
3
|
+
## What is Scrawn.js?
|
|
4
|
+
|
|
5
|
+
Scrawn.js is the official TypeScript SDK for integrating Scrawn's usage-based billing into your applications. It provides a simple, type-safe interface for tracking usage events and collecting payments via gRPC.
|
|
6
|
+
|
|
7
|
+
[View Docs](https://scrawn.vercel.app/docs/scrawn-js)
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **Simple API** - Track usage with a single function call
|
|
12
|
+
- **Type-Safe** - Full TypeScript support with auto-completion
|
|
13
|
+
- **gRPC-Powered** - Built on Connect-RPC for efficient communication
|
|
14
|
+
- **Framework Agnostic** - Works with any JavaScript framework
|
|
15
|
+
- **Middleware Support** - Built-in middleware with whitelist/blacklist patterns
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install Scrawn.js in your project:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun add @scrawn/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Example
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { Scrawn } from "@scrawn/core";
|
|
29
|
+
|
|
30
|
+
const scrawn = new Scrawn({
|
|
31
|
+
apiKey: process.env.SCRAWN_KEY as `scrn_${string}`,
|
|
32
|
+
baseURL: process.env.SCRAWN_BASE_URL || "http://localhost:8069",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Track a billable event
|
|
36
|
+
await scrawn.sdkCallEventConsumer({
|
|
37
|
+
userId: "user-123",
|
|
38
|
+
debitAmount: 100,
|
|
39
|
+
});
|
|
40
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// GENERATED CODE -- DO NOT EDIT!
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
var grpc = require('@grpc/grpc-js');
|
|
5
|
+
var auth_v1_auth_pb = require('../../auth/v1/auth_pb.js');
|
|
6
|
+
|
|
7
|
+
function serialize_auth_v1_CreateAPIKeyRequest(arg) {
|
|
8
|
+
if (!(arg instanceof auth_v1_auth_pb.CreateAPIKeyRequest)) {
|
|
9
|
+
throw new Error('Expected argument of type auth.v1.CreateAPIKeyRequest');
|
|
10
|
+
}
|
|
11
|
+
return Buffer.from(arg.serializeBinary());
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function deserialize_auth_v1_CreateAPIKeyRequest(buffer_arg) {
|
|
15
|
+
return auth_v1_auth_pb.CreateAPIKeyRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function serialize_auth_v1_CreateAPIKeyResponse(arg) {
|
|
19
|
+
if (!(arg instanceof auth_v1_auth_pb.CreateAPIKeyResponse)) {
|
|
20
|
+
throw new Error('Expected argument of type auth.v1.CreateAPIKeyResponse');
|
|
21
|
+
}
|
|
22
|
+
return Buffer.from(arg.serializeBinary());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function deserialize_auth_v1_CreateAPIKeyResponse(buffer_arg) {
|
|
26
|
+
return auth_v1_auth_pb.CreateAPIKeyResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var AuthServiceService = exports.AuthServiceService = {
|
|
31
|
+
// CreateAPIKey creates a new API key for the authenticated user
|
|
32
|
+
createAPIKey: {
|
|
33
|
+
path: '/auth.v1.AuthService/CreateAPIKey',
|
|
34
|
+
requestStream: false,
|
|
35
|
+
responseStream: false,
|
|
36
|
+
requestType: auth_v1_auth_pb.CreateAPIKeyRequest,
|
|
37
|
+
responseType: auth_v1_auth_pb.CreateAPIKeyResponse,
|
|
38
|
+
requestSerialize: serialize_auth_v1_CreateAPIKeyRequest,
|
|
39
|
+
requestDeserialize: deserialize_auth_v1_CreateAPIKeyRequest,
|
|
40
|
+
responseSerialize: serialize_auth_v1_CreateAPIKeyResponse,
|
|
41
|
+
responseDeserialize: deserialize_auth_v1_CreateAPIKeyResponse,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.AuthServiceClient = grpc.makeGenericClientConstructor(AuthServiceService, 'AuthService');
|
|
@@ -1,93 +1,478 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// source: auth/v1/auth.proto
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview
|
|
4
|
+
* @enhanceable
|
|
5
|
+
* @suppress {missingRequire} reports error on implicit type usages.
|
|
6
|
+
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
|
7
|
+
* field starts with 'MSG_' and isn't a translatable message.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
// GENERATED CODE -- DO NOT EDIT!
|
|
3
11
|
/* eslint-disable */
|
|
4
12
|
// @ts-nocheck
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
|
|
14
|
+
var jspb = require('google-protobuf');
|
|
15
|
+
var goog = jspb;
|
|
16
|
+
var global = (function() {
|
|
17
|
+
if (this) { return this; }
|
|
18
|
+
if (typeof window !== 'undefined') { return window; }
|
|
19
|
+
if (typeof global !== 'undefined') { return global; }
|
|
20
|
+
if (typeof self !== 'undefined') { return self; }
|
|
21
|
+
return Function('return this')();
|
|
22
|
+
}.call(null));
|
|
23
|
+
|
|
24
|
+
goog.exportSymbol('proto.auth.v1.CreateAPIKeyRequest', null, global);
|
|
25
|
+
goog.exportSymbol('proto.auth.v1.CreateAPIKeyResponse', null, global);
|
|
26
|
+
/**
|
|
27
|
+
* Generated by JsPbCodeGenerator.
|
|
28
|
+
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
29
|
+
* server response, or constructed directly in Javascript. The array is used
|
|
30
|
+
* in place and becomes part of the constructed object. It is not cloned.
|
|
31
|
+
* If no data is provided, the constructed object will be empty, but still
|
|
32
|
+
* valid.
|
|
33
|
+
* @extends {jspb.Message}
|
|
34
|
+
* @constructor
|
|
35
|
+
*/
|
|
36
|
+
proto.auth.v1.CreateAPIKeyRequest = function(opt_data) {
|
|
37
|
+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
38
|
+
};
|
|
39
|
+
goog.inherits(proto.auth.v1.CreateAPIKeyRequest, jspb.Message);
|
|
40
|
+
if (goog.DEBUG && !COMPILED) {
|
|
41
|
+
/**
|
|
42
|
+
* @public
|
|
43
|
+
* @override
|
|
44
|
+
*/
|
|
45
|
+
proto.auth.v1.CreateAPIKeyRequest.displayName = 'proto.auth.v1.CreateAPIKeyRequest';
|
|
36
46
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Generated by JsPbCodeGenerator.
|
|
49
|
+
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
50
|
+
* server response, or constructed directly in Javascript. The array is used
|
|
51
|
+
* in place and becomes part of the constructed object. It is not cloned.
|
|
52
|
+
* If no data is provided, the constructed object will be empty, but still
|
|
53
|
+
* valid.
|
|
54
|
+
* @extends {jspb.Message}
|
|
55
|
+
* @constructor
|
|
56
|
+
*/
|
|
57
|
+
proto.auth.v1.CreateAPIKeyResponse = function(opt_data) {
|
|
58
|
+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
59
|
+
};
|
|
60
|
+
goog.inherits(proto.auth.v1.CreateAPIKeyResponse, jspb.Message);
|
|
61
|
+
if (goog.DEBUG && !COMPILED) {
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
* @override
|
|
65
|
+
*/
|
|
66
|
+
proto.auth.v1.CreateAPIKeyResponse.displayName = 'proto.auth.v1.CreateAPIKeyResponse';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
72
|
+
/**
|
|
73
|
+
* Creates an object representation of this proto.
|
|
74
|
+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
75
|
+
* Optional fields that are not set will be set to undefined.
|
|
76
|
+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
77
|
+
* For the list of reserved names please see:
|
|
78
|
+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
79
|
+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
80
|
+
* JSPB instance for transitional soy proto support:
|
|
81
|
+
* http://goto/soy-param-migration
|
|
82
|
+
* @return {!Object}
|
|
83
|
+
*/
|
|
84
|
+
proto.auth.v1.CreateAPIKeyRequest.prototype.toObject = function(opt_includeInstance) {
|
|
85
|
+
return proto.auth.v1.CreateAPIKeyRequest.toObject(opt_includeInstance, this);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Static version of the {@see toObject} method.
|
|
91
|
+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
92
|
+
* the JSPB instance for transitional soy proto support:
|
|
93
|
+
* http://goto/soy-param-migration
|
|
94
|
+
* @param {!proto.auth.v1.CreateAPIKeyRequest} msg The msg instance to transform.
|
|
95
|
+
* @return {!Object}
|
|
96
|
+
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
97
|
+
*/
|
|
98
|
+
proto.auth.v1.CreateAPIKeyRequest.toObject = function(includeInstance, msg) {
|
|
99
|
+
var f, obj = {
|
|
100
|
+
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
101
|
+
expiresin: jspb.Message.getFieldWithDefault(msg, 2, 0)
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
if (includeInstance) {
|
|
105
|
+
obj.$jspbMessageInstance = msg;
|
|
106
|
+
}
|
|
107
|
+
return obj;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Deserializes binary data (in protobuf wire format).
|
|
114
|
+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
115
|
+
* @return {!proto.auth.v1.CreateAPIKeyRequest}
|
|
116
|
+
*/
|
|
117
|
+
proto.auth.v1.CreateAPIKeyRequest.deserializeBinary = function(bytes) {
|
|
118
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
119
|
+
var msg = new proto.auth.v1.CreateAPIKeyRequest;
|
|
120
|
+
return proto.auth.v1.CreateAPIKeyRequest.deserializeBinaryFromReader(msg, reader);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Deserializes binary data (in protobuf wire format) from the
|
|
126
|
+
* given reader into the given message object.
|
|
127
|
+
* @param {!proto.auth.v1.CreateAPIKeyRequest} msg The message object to deserialize into.
|
|
128
|
+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
129
|
+
* @return {!proto.auth.v1.CreateAPIKeyRequest}
|
|
130
|
+
*/
|
|
131
|
+
proto.auth.v1.CreateAPIKeyRequest.deserializeBinaryFromReader = function(msg, reader) {
|
|
132
|
+
while (reader.nextField()) {
|
|
133
|
+
if (reader.isEndGroup()) {
|
|
134
|
+
break;
|
|
73
135
|
}
|
|
74
|
-
|
|
75
|
-
|
|
136
|
+
var field = reader.getFieldNumber();
|
|
137
|
+
switch (field) {
|
|
138
|
+
case 1:
|
|
139
|
+
var value = /** @type {string} */ (reader.readString());
|
|
140
|
+
msg.setName(value);
|
|
141
|
+
break;
|
|
142
|
+
case 2:
|
|
143
|
+
var value = /** @type {number} */ (reader.readInt64());
|
|
144
|
+
msg.setExpiresin(value);
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
reader.skipField();
|
|
148
|
+
break;
|
|
76
149
|
}
|
|
77
|
-
|
|
78
|
-
|
|
150
|
+
}
|
|
151
|
+
return msg;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Serializes the message to binary data (in protobuf wire format).
|
|
157
|
+
* @return {!Uint8Array}
|
|
158
|
+
*/
|
|
159
|
+
proto.auth.v1.CreateAPIKeyRequest.prototype.serializeBinary = function() {
|
|
160
|
+
var writer = new jspb.BinaryWriter();
|
|
161
|
+
proto.auth.v1.CreateAPIKeyRequest.serializeBinaryToWriter(this, writer);
|
|
162
|
+
return writer.getResultBuffer();
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Serializes the given message to binary data (in protobuf wire
|
|
168
|
+
* format), writing to the given BinaryWriter.
|
|
169
|
+
* @param {!proto.auth.v1.CreateAPIKeyRequest} message
|
|
170
|
+
* @param {!jspb.BinaryWriter} writer
|
|
171
|
+
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
172
|
+
*/
|
|
173
|
+
proto.auth.v1.CreateAPIKeyRequest.serializeBinaryToWriter = function(message, writer) {
|
|
174
|
+
var f = undefined;
|
|
175
|
+
f = message.getName();
|
|
176
|
+
if (f.length > 0) {
|
|
177
|
+
writer.writeString(
|
|
178
|
+
1,
|
|
179
|
+
f
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
f = message.getExpiresin();
|
|
183
|
+
if (f !== 0) {
|
|
184
|
+
writer.writeInt64(
|
|
185
|
+
2,
|
|
186
|
+
f
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* optional string name = 1;
|
|
194
|
+
* @return {string}
|
|
195
|
+
*/
|
|
196
|
+
proto.auth.v1.CreateAPIKeyRequest.prototype.getName = function() {
|
|
197
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @param {string} value
|
|
203
|
+
* @return {!proto.auth.v1.CreateAPIKeyRequest} returns this
|
|
204
|
+
*/
|
|
205
|
+
proto.auth.v1.CreateAPIKeyRequest.prototype.setName = function(value) {
|
|
206
|
+
return jspb.Message.setProto3StringField(this, 1, value);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* optional int64 expiresIn = 2;
|
|
212
|
+
* @return {number}
|
|
213
|
+
*/
|
|
214
|
+
proto.auth.v1.CreateAPIKeyRequest.prototype.getExpiresin = function() {
|
|
215
|
+
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @param {number} value
|
|
221
|
+
* @return {!proto.auth.v1.CreateAPIKeyRequest} returns this
|
|
222
|
+
*/
|
|
223
|
+
proto.auth.v1.CreateAPIKeyRequest.prototype.setExpiresin = function(value) {
|
|
224
|
+
return jspb.Message.setProto3IntField(this, 2, value);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
232
|
+
/**
|
|
233
|
+
* Creates an object representation of this proto.
|
|
234
|
+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
235
|
+
* Optional fields that are not set will be set to undefined.
|
|
236
|
+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
237
|
+
* For the list of reserved names please see:
|
|
238
|
+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
239
|
+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
240
|
+
* JSPB instance for transitional soy proto support:
|
|
241
|
+
* http://goto/soy-param-migration
|
|
242
|
+
* @return {!Object}
|
|
243
|
+
*/
|
|
244
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.toObject = function(opt_includeInstance) {
|
|
245
|
+
return proto.auth.v1.CreateAPIKeyResponse.toObject(opt_includeInstance, this);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Static version of the {@see toObject} method.
|
|
251
|
+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
252
|
+
* the JSPB instance for transitional soy proto support:
|
|
253
|
+
* http://goto/soy-param-migration
|
|
254
|
+
* @param {!proto.auth.v1.CreateAPIKeyResponse} msg The msg instance to transform.
|
|
255
|
+
* @return {!Object}
|
|
256
|
+
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
257
|
+
*/
|
|
258
|
+
proto.auth.v1.CreateAPIKeyResponse.toObject = function(includeInstance, msg) {
|
|
259
|
+
var f, obj = {
|
|
260
|
+
apikeyid: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
261
|
+
apikey: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
262
|
+
name: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
|
263
|
+
createdat: jspb.Message.getFieldWithDefault(msg, 4, ""),
|
|
264
|
+
expiresat: jspb.Message.getFieldWithDefault(msg, 5, "")
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
if (includeInstance) {
|
|
268
|
+
obj.$jspbMessageInstance = msg;
|
|
269
|
+
}
|
|
270
|
+
return obj;
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Deserializes binary data (in protobuf wire format).
|
|
277
|
+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
278
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse}
|
|
279
|
+
*/
|
|
280
|
+
proto.auth.v1.CreateAPIKeyResponse.deserializeBinary = function(bytes) {
|
|
281
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
282
|
+
var msg = new proto.auth.v1.CreateAPIKeyResponse;
|
|
283
|
+
return proto.auth.v1.CreateAPIKeyResponse.deserializeBinaryFromReader(msg, reader);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Deserializes binary data (in protobuf wire format) from the
|
|
289
|
+
* given reader into the given message object.
|
|
290
|
+
* @param {!proto.auth.v1.CreateAPIKeyResponse} msg The message object to deserialize into.
|
|
291
|
+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
292
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse}
|
|
293
|
+
*/
|
|
294
|
+
proto.auth.v1.CreateAPIKeyResponse.deserializeBinaryFromReader = function(msg, reader) {
|
|
295
|
+
while (reader.nextField()) {
|
|
296
|
+
if (reader.isEndGroup()) {
|
|
297
|
+
break;
|
|
79
298
|
}
|
|
80
|
-
|
|
81
|
-
|
|
299
|
+
var field = reader.getFieldNumber();
|
|
300
|
+
switch (field) {
|
|
301
|
+
case 1:
|
|
302
|
+
var value = /** @type {string} */ (reader.readString());
|
|
303
|
+
msg.setApikeyid(value);
|
|
304
|
+
break;
|
|
305
|
+
case 2:
|
|
306
|
+
var value = /** @type {string} */ (reader.readString());
|
|
307
|
+
msg.setApikey(value);
|
|
308
|
+
break;
|
|
309
|
+
case 3:
|
|
310
|
+
var value = /** @type {string} */ (reader.readString());
|
|
311
|
+
msg.setName(value);
|
|
312
|
+
break;
|
|
313
|
+
case 4:
|
|
314
|
+
var value = /** @type {string} */ (reader.readString());
|
|
315
|
+
msg.setCreatedat(value);
|
|
316
|
+
break;
|
|
317
|
+
case 5:
|
|
318
|
+
var value = /** @type {string} */ (reader.readString());
|
|
319
|
+
msg.setExpiresat(value);
|
|
320
|
+
break;
|
|
321
|
+
default:
|
|
322
|
+
reader.skipField();
|
|
323
|
+
break;
|
|
82
324
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
325
|
+
}
|
|
326
|
+
return msg;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Serializes the message to binary data (in protobuf wire format).
|
|
332
|
+
* @return {!Uint8Array}
|
|
333
|
+
*/
|
|
334
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.serializeBinary = function() {
|
|
335
|
+
var writer = new jspb.BinaryWriter();
|
|
336
|
+
proto.auth.v1.CreateAPIKeyResponse.serializeBinaryToWriter(this, writer);
|
|
337
|
+
return writer.getResultBuffer();
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Serializes the given message to binary data (in protobuf wire
|
|
343
|
+
* format), writing to the given BinaryWriter.
|
|
344
|
+
* @param {!proto.auth.v1.CreateAPIKeyResponse} message
|
|
345
|
+
* @param {!jspb.BinaryWriter} writer
|
|
346
|
+
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
347
|
+
*/
|
|
348
|
+
proto.auth.v1.CreateAPIKeyResponse.serializeBinaryToWriter = function(message, writer) {
|
|
349
|
+
var f = undefined;
|
|
350
|
+
f = message.getApikeyid();
|
|
351
|
+
if (f.length > 0) {
|
|
352
|
+
writer.writeString(
|
|
353
|
+
1,
|
|
354
|
+
f
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
f = message.getApikey();
|
|
358
|
+
if (f.length > 0) {
|
|
359
|
+
writer.writeString(
|
|
360
|
+
2,
|
|
361
|
+
f
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
f = message.getName();
|
|
365
|
+
if (f.length > 0) {
|
|
366
|
+
writer.writeString(
|
|
367
|
+
3,
|
|
368
|
+
f
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
f = message.getCreatedat();
|
|
372
|
+
if (f.length > 0) {
|
|
373
|
+
writer.writeString(
|
|
374
|
+
4,
|
|
375
|
+
f
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
f = message.getExpiresat();
|
|
379
|
+
if (f.length > 0) {
|
|
380
|
+
writer.writeString(
|
|
381
|
+
5,
|
|
382
|
+
f
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* optional string apiKeyId = 1;
|
|
390
|
+
* @return {string}
|
|
391
|
+
*/
|
|
392
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.getApikeyid = function() {
|
|
393
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* @param {string} value
|
|
399
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse} returns this
|
|
400
|
+
*/
|
|
401
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.setApikeyid = function(value) {
|
|
402
|
+
return jspb.Message.setProto3StringField(this, 1, value);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* optional string apiKey = 2;
|
|
408
|
+
* @return {string}
|
|
409
|
+
*/
|
|
410
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.getApikey = function() {
|
|
411
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @param {string} value
|
|
417
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse} returns this
|
|
418
|
+
*/
|
|
419
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.setApikey = function(value) {
|
|
420
|
+
return jspb.Message.setProto3StringField(this, 2, value);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* optional string name = 3;
|
|
426
|
+
* @return {string}
|
|
427
|
+
*/
|
|
428
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.getName = function() {
|
|
429
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @param {string} value
|
|
435
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse} returns this
|
|
436
|
+
*/
|
|
437
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.setName = function(value) {
|
|
438
|
+
return jspb.Message.setProto3StringField(this, 3, value);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* optional string createdAt = 4;
|
|
444
|
+
* @return {string}
|
|
445
|
+
*/
|
|
446
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.getCreatedat = function() {
|
|
447
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @param {string} value
|
|
453
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse} returns this
|
|
454
|
+
*/
|
|
455
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.setCreatedat = function(value) {
|
|
456
|
+
return jspb.Message.setProto3StringField(this, 4, value);
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* optional string expiresAt = 5;
|
|
462
|
+
* @return {string}
|
|
463
|
+
*/
|
|
464
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.getExpiresat = function() {
|
|
465
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @param {string} value
|
|
471
|
+
* @return {!proto.auth.v1.CreateAPIKeyResponse} returns this
|
|
472
|
+
*/
|
|
473
|
+
proto.auth.v1.CreateAPIKeyResponse.prototype.setExpiresat = function(value) {
|
|
474
|
+
return jspb.Message.setProto3StringField(this, 5, value);
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
goog.object.extend(exports, proto.auth.v1);
|