@prodoctors/contracts 1.0.2 → 1.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/gen/account.ts +60 -61
- package/gen/auth.ts +129 -140
- package/gen/branch.ts +10 -10
- package/gen/common.ts +41 -0
- package/gen/google/protobuf/timestamp.ts +118 -0
- package/gen/inventory.ts +297 -0
- package/package.json +27 -27
- package/proto/account.proto +21 -23
- package/proto/auth.proto +71 -81
- package/proto/branch.proto +64 -64
- package/proto/common.proto +34 -0
- package/proto/inventory.proto +170 -0
package/gen/account.ts
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.5
|
|
4
|
-
// protoc
|
|
5
|
-
// source: account.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "account.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetAccountRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GetAccountResponse {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
username: string;
|
|
21
|
+
role: string;
|
|
22
|
+
branchId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
26
|
+
|
|
27
|
+
/** Account service for managing user profiles */
|
|
28
|
+
|
|
29
|
+
export interface AccountServiceClient {
|
|
30
|
+
/** Get user profile information */
|
|
31
|
+
|
|
32
|
+
getProfile(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Account service for managing user profiles */
|
|
36
|
+
|
|
37
|
+
export interface AccountServiceController {
|
|
38
|
+
/** Get user profile information */
|
|
39
|
+
|
|
40
|
+
getProfile(
|
|
41
|
+
request: GetAccountRequest,
|
|
42
|
+
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function AccountServiceControllerMethods() {
|
|
46
|
+
return function (constructor: Function) {
|
|
47
|
+
const grpcMethods: string[] = ["getProfile"];
|
|
48
|
+
for (const method of grpcMethods) {
|
|
49
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
50
|
+
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
51
|
+
}
|
|
52
|
+
const grpcStreamMethods: string[] = [];
|
|
53
|
+
for (const method of grpcStreamMethods) {
|
|
54
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
55
|
+
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
package/gen/auth.ts
CHANGED
|
@@ -1,140 +1,129 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.5
|
|
4
|
-
// protoc
|
|
5
|
-
// source: auth.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "auth.v1";
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
username: string;
|
|
26
|
-
password: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
131
|
-
}
|
|
132
|
-
const grpcStreamMethods: string[] = [];
|
|
133
|
-
for (const method of grpcStreamMethods) {
|
|
134
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
135
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "auth.v1";
|
|
12
|
+
|
|
13
|
+
export interface LoginRequest {
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LoginResponse {
|
|
19
|
+
accessToken: string;
|
|
20
|
+
refreshToken: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface RegisterRequest {
|
|
24
|
+
name: string;
|
|
25
|
+
username: string;
|
|
26
|
+
password: string;
|
|
27
|
+
role?: string | undefined;
|
|
28
|
+
branchId?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface RegisterResponse {
|
|
32
|
+
ok: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SendOtpRequest {
|
|
36
|
+
identifier: string;
|
|
37
|
+
type: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SendOtpResponse {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface VerifyOtpRequest {
|
|
45
|
+
identifier: string;
|
|
46
|
+
type: string;
|
|
47
|
+
code: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface VerifyOtpResponse {
|
|
51
|
+
accessToken: string;
|
|
52
|
+
refreshToken: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface RefreshRequest {
|
|
56
|
+
refreshToken: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface RefreshResponse {
|
|
60
|
+
accessToken: string;
|
|
61
|
+
refreshToken: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
65
|
+
|
|
66
|
+
/** Authentication service for sending and verifying OTPs */
|
|
67
|
+
|
|
68
|
+
export interface AuthServiceClient {
|
|
69
|
+
/** Authoriration user */
|
|
70
|
+
|
|
71
|
+
login(request: LoginRequest): Observable<LoginResponse>;
|
|
72
|
+
|
|
73
|
+
/** Registration user */
|
|
74
|
+
|
|
75
|
+
register(request: RegisterRequest): Observable<RegisterResponse>;
|
|
76
|
+
|
|
77
|
+
/** Send OTP to the user */
|
|
78
|
+
|
|
79
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
80
|
+
|
|
81
|
+
/** Verify the OTP sent to the user */
|
|
82
|
+
|
|
83
|
+
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
84
|
+
|
|
85
|
+
/** Refersh token */
|
|
86
|
+
|
|
87
|
+
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Authentication service for sending and verifying OTPs */
|
|
91
|
+
|
|
92
|
+
export interface AuthServiceController {
|
|
93
|
+
/** Authoriration user */
|
|
94
|
+
|
|
95
|
+
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
|
96
|
+
|
|
97
|
+
/** Registration user */
|
|
98
|
+
|
|
99
|
+
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
|
|
100
|
+
|
|
101
|
+
/** Send OTP to the user */
|
|
102
|
+
|
|
103
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
104
|
+
|
|
105
|
+
/** Verify the OTP sent to the user */
|
|
106
|
+
|
|
107
|
+
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
108
|
+
|
|
109
|
+
/** Refersh token */
|
|
110
|
+
|
|
111
|
+
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function AuthServiceControllerMethods() {
|
|
115
|
+
return function (constructor: Function) {
|
|
116
|
+
const grpcMethods: string[] = ["login", "register", "sendOtp", "verifyOtp", "refresh"];
|
|
117
|
+
for (const method of grpcMethods) {
|
|
118
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
119
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
120
|
+
}
|
|
121
|
+
const grpcStreamMethods: string[] = [];
|
|
122
|
+
for (const method of grpcStreamMethods) {
|
|
123
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
124
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
package/gen/branch.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.11.5
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v3.21.12
|
|
5
5
|
// source: branch.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
@@ -13,9 +13,9 @@ export const protobufPackage = "branch.v1";
|
|
|
13
13
|
export interface CreateBranchRequest {
|
|
14
14
|
name: string;
|
|
15
15
|
phone: string;
|
|
16
|
-
address
|
|
17
|
-
lat
|
|
18
|
-
lng
|
|
16
|
+
address?: string | undefined;
|
|
17
|
+
lat?: string | undefined;
|
|
18
|
+
lng?: string | undefined;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface CreateBranchResponse {
|
|
@@ -30,18 +30,18 @@ export interface GetBranchResponse {
|
|
|
30
30
|
id: string;
|
|
31
31
|
name: string;
|
|
32
32
|
phone: string;
|
|
33
|
-
address
|
|
34
|
-
lat
|
|
35
|
-
lng
|
|
33
|
+
address?: string | undefined;
|
|
34
|
+
lat?: string | undefined;
|
|
35
|
+
lng?: string | undefined;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface UpdateBranchRequest {
|
|
39
39
|
id: string;
|
|
40
40
|
name: string;
|
|
41
41
|
phone: string;
|
|
42
|
-
address
|
|
43
|
-
lat
|
|
44
|
-
lng
|
|
42
|
+
address?: string | undefined;
|
|
43
|
+
lat?: string | undefined;
|
|
44
|
+
lng?: string | undefined;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface UpdateBranchResponse {
|
package/gen/common.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: common.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "common.v1";
|
|
11
|
+
|
|
12
|
+
export interface Empty {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PaginationRequest {
|
|
16
|
+
page: number;
|
|
17
|
+
limit: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PaginationMeta {
|
|
21
|
+
page: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
total: number;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IdRequest {
|
|
28
|
+
id: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface BoolResponse {
|
|
32
|
+
success: boolean;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DateRange {
|
|
37
|
+
from: Timestamp | undefined;
|
|
38
|
+
to: Timestamp | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const COMMON_V1_PACKAGE_NAME = "common.v1";
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/timestamp.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
13
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
14
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
15
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
16
|
+
* Gregorian calendar backwards to year one.
|
|
17
|
+
*
|
|
18
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
19
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
20
|
+
* smear](https://developers.google.com/time/smear).
|
|
21
|
+
*
|
|
22
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
23
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
24
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
25
|
+
*
|
|
26
|
+
* # Examples
|
|
27
|
+
*
|
|
28
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
29
|
+
*
|
|
30
|
+
* Timestamp timestamp;
|
|
31
|
+
* timestamp.set_seconds(time(NULL));
|
|
32
|
+
* timestamp.set_nanos(0);
|
|
33
|
+
*
|
|
34
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
35
|
+
*
|
|
36
|
+
* struct timeval tv;
|
|
37
|
+
* gettimeofday(&tv, NULL);
|
|
38
|
+
*
|
|
39
|
+
* Timestamp timestamp;
|
|
40
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
41
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
42
|
+
*
|
|
43
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
44
|
+
*
|
|
45
|
+
* FILETIME ft;
|
|
46
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
47
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
48
|
+
*
|
|
49
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
50
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
51
|
+
* Timestamp timestamp;
|
|
52
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
53
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
54
|
+
*
|
|
55
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
56
|
+
*
|
|
57
|
+
* long millis = System.currentTimeMillis();
|
|
58
|
+
*
|
|
59
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
60
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
61
|
+
*
|
|
62
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
63
|
+
*
|
|
64
|
+
* Instant now = Instant.now();
|
|
65
|
+
*
|
|
66
|
+
* Timestamp timestamp =
|
|
67
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
68
|
+
* .setNanos(now.getNano()).build();
|
|
69
|
+
*
|
|
70
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
71
|
+
*
|
|
72
|
+
* timestamp = Timestamp()
|
|
73
|
+
* timestamp.GetCurrentTime()
|
|
74
|
+
*
|
|
75
|
+
* # JSON Mapping
|
|
76
|
+
*
|
|
77
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
78
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
79
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
80
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
81
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
82
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
83
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
84
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
85
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
86
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
87
|
+
*
|
|
88
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
89
|
+
* 01:30 UTC on January 15, 2017.
|
|
90
|
+
*
|
|
91
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
92
|
+
* standard
|
|
93
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
94
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
95
|
+
* to this format using
|
|
96
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
97
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
98
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
99
|
+
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
|
100
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
101
|
+
*/
|
|
102
|
+
export interface Timestamp {
|
|
103
|
+
/**
|
|
104
|
+
* Represents seconds of UTC time since Unix epoch
|
|
105
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
106
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
107
|
+
*/
|
|
108
|
+
seconds: number;
|
|
109
|
+
/**
|
|
110
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
111
|
+
* second values with fractions must still have non-negative nanos values
|
|
112
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
113
|
+
* inclusive.
|
|
114
|
+
*/
|
|
115
|
+
nanos: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|