rime-api 0.0.2__tar.gz → 0.2.0__tar.gz
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.
- rime_api-0.2.0/NOTICE +6 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/PKG-INFO +55 -10
- rime_api-0.2.0/PROTOBUF_LICENSE +32 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/README.md +51 -8
- rime_api-0.2.0/SOURCE.json +9 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/pyproject.toml +5 -5
- rime_api-0.2.0/schema/google/protobuf/any.proto +106 -0
- rime_api-0.2.0/schema/google/protobuf/duration.proto +115 -0
- rime_api-0.2.0/schema/google/rpc/status.proto +49 -0
- rime_api-0.2.0/schema/rime/speech_to_text.proto +253 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/schema/rime/text_to_speech.proto +69 -20
- rime_api-0.2.0/schema/speech_to_text.asyncapi.yaml +448 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/schema/text_to_speech.asyncapi.yaml +37 -18
- rime_api-0.2.0/src/rime_api/speech_to_text_pb2.py +78 -0
- rime_api-0.2.0/src/rime_api/speech_to_text_pb2.pyi +190 -0
- rime_api-0.2.0/src/rime_api/text_to_speech_pb2.py +92 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/src/rime_api/text_to_speech_pb2.pyi +46 -38
- rime_api-0.0.2/NOTICE +0 -2
- rime_api-0.0.2/SOURCE.json +0 -9
- rime_api-0.0.2/src/rime_api/text_to_speech_pb2.py +0 -84
- {rime_api-0.0.2 → rime_api-0.2.0}/LICENSE +0 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/src/rime_api/__init__.py +0 -0
- {rime_api-0.0.2 → rime_api-0.2.0}/src/rime_api/py.typed +0 -0
rime_api-0.2.0/NOTICE
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rime-api
|
|
3
|
-
Version: 0.0
|
|
4
|
-
Summary: Generated protocol definitions for Rime text-to-speech
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Generated protocol definitions for Rime text-to-speech and speech-to-text
|
|
5
5
|
Project-URL: Documentation, https://docs.rime.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/rimelabs/rime-api
|
|
7
7
|
Project-URL: Issues, https://github.com/rimelabs/rime-api/issues
|
|
@@ -9,13 +9,15 @@ Author: Rime
|
|
|
9
9
|
License-Expression: Apache-2.0
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
License-File: NOTICE
|
|
12
|
+
License-File: PROTOBUF_LICENSE
|
|
12
13
|
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: googleapis-common-protos>=1.70.0
|
|
13
15
|
Requires-Dist: protobuf>=5.29.6
|
|
14
16
|
Description-Content-Type: text/markdown
|
|
15
17
|
|
|
16
18
|
# Rime API
|
|
17
19
|
|
|
18
|
-
Generated message definitions for Rime text-to-speech. Python and JavaScript
|
|
20
|
+
Generated message definitions for Rime text-to-speech and speech-to-text. Python and JavaScript
|
|
19
21
|
packages use the same schema and release version.
|
|
20
22
|
|
|
21
23
|
## Python
|
|
@@ -31,8 +33,9 @@ request = proto.WebSocketRequest(context_id='turn-42', text='Hello.')
|
|
|
31
33
|
encoded = request.SerializeToString()
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Python 3.10 or newer is required. The package includes type stubs.
|
|
35
|
-
|
|
36
|
+
Python 3.10 or newer is required. The package includes type stubs. Runtime
|
|
37
|
+
dependencies are `protobuf>=5.29.6` and `googleapis-common-protos>=1.70.0`.
|
|
38
|
+
It does not require gRPC.
|
|
36
39
|
|
|
37
40
|
## JavaScript and TypeScript
|
|
38
41
|
|
|
@@ -57,21 +60,63 @@ Consumers that import `@bufbuild/protobuf` directly should declare it as a
|
|
|
57
60
|
direct dependency too. Use its `fromJson` and `toJson` functions for the Rime
|
|
58
61
|
JSON protocol. `JSON.stringify` does not implement the protobuf JSON mapping.
|
|
59
62
|
|
|
63
|
+
## Speech-to-text
|
|
64
|
+
|
|
65
|
+
Python uses a separate module for STT:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from rime_api import speech_to_text_pb2 as proto
|
|
69
|
+
|
|
70
|
+
request = proto.SpeechWebSocketRequest(
|
|
71
|
+
start=proto.StreamingConfig(
|
|
72
|
+
output_contract=proto.STREAMING_OUTPUT_CONTRACT_REVISED_HYPOTHESES,
|
|
73
|
+
language="en",
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
encoded = request.SerializeToString()
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
JavaScript and TypeScript export STT definitions from the same package:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { create, toBinary } from "@bufbuild/protobuf";
|
|
83
|
+
import {
|
|
84
|
+
SpeechWebSocketRequestSchema,
|
|
85
|
+
StreamingOutputContract,
|
|
86
|
+
} from "@rimelabs/api";
|
|
87
|
+
|
|
88
|
+
const request = create(SpeechWebSocketRequestSchema, {
|
|
89
|
+
payload: {
|
|
90
|
+
case: "start",
|
|
91
|
+
value: {
|
|
92
|
+
outputContract: StreamingOutputContract.REVISED_HYPOTHESES,
|
|
93
|
+
language: "en",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
const encoded = toBinary(SpeechWebSocketRequestSchema, request);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The STT schema includes whole-utterance transcription, bidirectional streaming,
|
|
101
|
+
and WebSocket messages. See `schema/rime/speech_to_text.proto` and
|
|
102
|
+
`schema/speech_to_text.asyncapi.yaml` in the package for the full contract.
|
|
103
|
+
|
|
60
104
|
## Scope and compatibility
|
|
61
105
|
|
|
62
|
-
These packages contain the full public TTS
|
|
63
|
-
normalization, language and speaker queries, and WebSocket envelopes.
|
|
106
|
+
These packages contain the full public TTS and STT schemas, including synthesis,
|
|
107
|
+
normalization, language and speaker queries, transcription, and WebSocket envelopes.
|
|
64
108
|
Framework adapters own connections, authentication, cancellation, and audio I/O.
|
|
65
109
|
Service descriptors are included; gRPC client stubs are not included.
|
|
66
110
|
|
|
67
111
|
The protobuf package remains `rime`. The Python generator uses a virtual source
|
|
68
|
-
|
|
69
|
-
This changes the Python descriptor
|
|
112
|
+
paths, `rime_api/text_to_speech.proto` and `rime_api/speech_to_text.proto`,
|
|
113
|
+
to obtain the Python import names. This changes the Python descriptor file names, but preserves message names,
|
|
70
114
|
service names, field numbers, and both wire formats. Do not load independently
|
|
71
115
|
generated definitions of these same `rime` messages in one Python process.
|
|
72
116
|
|
|
73
117
|
The Python wheel, source archive, and npm archive include the exact Protobuf
|
|
74
|
-
and AsyncAPI definitions
|
|
118
|
+
and AsyncAPI definitions. The `schemas` map in `SOURCE.json` records each
|
|
119
|
+
public definition's path and SHA-256 hash. In the
|
|
75
120
|
wheel, the definitions are under `rime_api/schema/`. The other archives use
|
|
76
121
|
`schema/`. Generated code is part of the distribution;
|
|
77
122
|
installation requires no protobuf compiler or access to the Rime repository.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Copyright 2008 Google Inc. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above
|
|
10
|
+
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
in the documentation and/or other materials provided with the
|
|
12
|
+
distribution.
|
|
13
|
+
* Neither the name of Google Inc. nor the names of its
|
|
14
|
+
contributors may be used to endorse or promote products derived from
|
|
15
|
+
this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
|
29
|
+
Code generated by the Protocol Buffer compiler is owned by the owner
|
|
30
|
+
of the input file used when generating it. This code is not
|
|
31
|
+
standalone and requires a support library to be linked with it. This
|
|
32
|
+
support library is itself covered by the above license.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rime API
|
|
2
2
|
|
|
3
|
-
Generated message definitions for Rime text-to-speech. Python and JavaScript
|
|
3
|
+
Generated message definitions for Rime text-to-speech and speech-to-text. Python and JavaScript
|
|
4
4
|
packages use the same schema and release version.
|
|
5
5
|
|
|
6
6
|
## Python
|
|
@@ -16,8 +16,9 @@ request = proto.WebSocketRequest(context_id='turn-42', text='Hello.')
|
|
|
16
16
|
encoded = request.SerializeToString()
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Python 3.10 or newer is required. The package includes type stubs.
|
|
20
|
-
|
|
19
|
+
Python 3.10 or newer is required. The package includes type stubs. Runtime
|
|
20
|
+
dependencies are `protobuf>=5.29.6` and `googleapis-common-protos>=1.70.0`.
|
|
21
|
+
It does not require gRPC.
|
|
21
22
|
|
|
22
23
|
## JavaScript and TypeScript
|
|
23
24
|
|
|
@@ -42,21 +43,63 @@ Consumers that import `@bufbuild/protobuf` directly should declare it as a
|
|
|
42
43
|
direct dependency too. Use its `fromJson` and `toJson` functions for the Rime
|
|
43
44
|
JSON protocol. `JSON.stringify` does not implement the protobuf JSON mapping.
|
|
44
45
|
|
|
46
|
+
## Speech-to-text
|
|
47
|
+
|
|
48
|
+
Python uses a separate module for STT:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from rime_api import speech_to_text_pb2 as proto
|
|
52
|
+
|
|
53
|
+
request = proto.SpeechWebSocketRequest(
|
|
54
|
+
start=proto.StreamingConfig(
|
|
55
|
+
output_contract=proto.STREAMING_OUTPUT_CONTRACT_REVISED_HYPOTHESES,
|
|
56
|
+
language="en",
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
encoded = request.SerializeToString()
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
JavaScript and TypeScript export STT definitions from the same package:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { create, toBinary } from "@bufbuild/protobuf";
|
|
66
|
+
import {
|
|
67
|
+
SpeechWebSocketRequestSchema,
|
|
68
|
+
StreamingOutputContract,
|
|
69
|
+
} from "@rimelabs/api";
|
|
70
|
+
|
|
71
|
+
const request = create(SpeechWebSocketRequestSchema, {
|
|
72
|
+
payload: {
|
|
73
|
+
case: "start",
|
|
74
|
+
value: {
|
|
75
|
+
outputContract: StreamingOutputContract.REVISED_HYPOTHESES,
|
|
76
|
+
language: "en",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const encoded = toBinary(SpeechWebSocketRequestSchema, request);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The STT schema includes whole-utterance transcription, bidirectional streaming,
|
|
84
|
+
and WebSocket messages. See `schema/rime/speech_to_text.proto` and
|
|
85
|
+
`schema/speech_to_text.asyncapi.yaml` in the package for the full contract.
|
|
86
|
+
|
|
45
87
|
## Scope and compatibility
|
|
46
88
|
|
|
47
|
-
These packages contain the full public TTS
|
|
48
|
-
normalization, language and speaker queries, and WebSocket envelopes.
|
|
89
|
+
These packages contain the full public TTS and STT schemas, including synthesis,
|
|
90
|
+
normalization, language and speaker queries, transcription, and WebSocket envelopes.
|
|
49
91
|
Framework adapters own connections, authentication, cancellation, and audio I/O.
|
|
50
92
|
Service descriptors are included; gRPC client stubs are not included.
|
|
51
93
|
|
|
52
94
|
The protobuf package remains `rime`. The Python generator uses a virtual source
|
|
53
|
-
|
|
54
|
-
This changes the Python descriptor
|
|
95
|
+
paths, `rime_api/text_to_speech.proto` and `rime_api/speech_to_text.proto`,
|
|
96
|
+
to obtain the Python import names. This changes the Python descriptor file names, but preserves message names,
|
|
55
97
|
service names, field numbers, and both wire formats. Do not load independently
|
|
56
98
|
generated definitions of these same `rime` messages in one Python process.
|
|
57
99
|
|
|
58
100
|
The Python wheel, source archive, and npm archive include the exact Protobuf
|
|
59
|
-
and AsyncAPI definitions
|
|
101
|
+
and AsyncAPI definitions. The `schemas` map in `SOURCE.json` records each
|
|
102
|
+
public definition's path and SHA-256 hash. In the
|
|
60
103
|
wheel, the definitions are under `rime_api/schema/`. The other archives use
|
|
61
104
|
`schema/`. Generated code is part of the distribution;
|
|
62
105
|
installation requires no protobuf compiler or access to the Rime repository.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"schemas": {
|
|
4
|
+
"rime/speech_to_text.proto": "77131e17e7048cd989d547ff81c991151c23b896272b6bff903bd548eb8eb5b3",
|
|
5
|
+
"rime/text_to_speech.proto": "6a5707f207c95fcb32557f4b811e30fb67c01df8fc4dc60ec823e592cc477e5e",
|
|
6
|
+
"speech_to_text.asyncapi.yaml": "604cb549319ff1bc7cc792d4a6df15dd8d9d75123397d57a3f31e8e5d93b71b6",
|
|
7
|
+
"text_to_speech.asyncapi.yaml": "00e1223faf9858c278046bf774cf9f328606cfc336b02c71fdbf52c82a85ee35"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -4,14 +4,14 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rime-api"
|
|
7
|
-
version = "0.0
|
|
8
|
-
description = "Generated protocol definitions for Rime text-to-speech"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Generated protocol definitions for Rime text-to-speech and speech-to-text"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
license = "Apache-2.0"
|
|
12
|
-
license-files = ["LICENSE", "NOTICE"]
|
|
12
|
+
license-files = ["LICENSE", "NOTICE", "PROTOBUF_LICENSE"]
|
|
13
13
|
authors = [{ name = "Rime" }]
|
|
14
|
-
dependencies = ["protobuf>=5.29.6"]
|
|
14
|
+
dependencies = ["protobuf>=5.29.6", "googleapis-common-protos>=1.70.0"]
|
|
15
15
|
|
|
16
16
|
[project.urls]
|
|
17
17
|
Documentation = "https://docs.rime.ai"
|
|
@@ -26,4 +26,4 @@ packages = ["src/rime_api"]
|
|
|
26
26
|
"schema" = "rime_api/schema"
|
|
27
27
|
|
|
28
28
|
[tool.hatch.build.targets.sdist]
|
|
29
|
-
include = ["src", "schema", "SOURCE.json", "pyproject.toml", "README.md", "LICENSE", "NOTICE"]
|
|
29
|
+
include = ["src", "schema", "SOURCE.json", "pyproject.toml", "README.md", "LICENSE", "NOTICE", "PROTOBUF_LICENSE"]
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
|
4
|
+
//
|
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
|
6
|
+
// modification, are permitted provided that the following conditions are
|
|
7
|
+
// met:
|
|
8
|
+
//
|
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
// in the documentation and/or other materials provided with the
|
|
14
|
+
// distribution.
|
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
|
17
|
+
// this software without specific prior written permission.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
syntax = "proto3";
|
|
32
|
+
|
|
33
|
+
package google.protobuf;
|
|
34
|
+
|
|
35
|
+
option go_package = "google.golang.org/protobuf/types/known/anypb";
|
|
36
|
+
option java_package = "com.google.protobuf";
|
|
37
|
+
option java_outer_classname = "AnyProto";
|
|
38
|
+
option java_multiple_files = true;
|
|
39
|
+
option objc_class_prefix = "GPB";
|
|
40
|
+
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
|
41
|
+
|
|
42
|
+
// `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
43
|
+
// URL that describes the type of the serialized message.
|
|
44
|
+
//
|
|
45
|
+
// In its binary encoding, an `Any` is an ordinary message; but in other wire
|
|
46
|
+
// forms like JSON, it has a special encoding. The format of the type URL is
|
|
47
|
+
// described on the `type_url` field.
|
|
48
|
+
//
|
|
49
|
+
// Protobuf APIs provide utilities to interact with `Any` values:
|
|
50
|
+
//
|
|
51
|
+
// - A 'pack' operation accepts a message and constructs a generic `Any` wrapper
|
|
52
|
+
// around it.
|
|
53
|
+
// - An 'unpack' operation reads the content of an `Any` message, either into an
|
|
54
|
+
// existing message or a new one. Unpack operations must check the type of the
|
|
55
|
+
// value they unpack against the declared `type_url`.
|
|
56
|
+
// - An 'is' operation decides whether an `Any` contains a message of the given
|
|
57
|
+
// type, i.e. whether it can 'unpack' that type.
|
|
58
|
+
//
|
|
59
|
+
// The JSON format representation of an `Any` follows one of these cases:
|
|
60
|
+
//
|
|
61
|
+
// - For types without special-cased JSON encodings, the JSON format
|
|
62
|
+
// representation of the `Any` is the same as that of the message, with an
|
|
63
|
+
// additional `@type` field which contains the type URL.
|
|
64
|
+
// - For types with special-cased JSON encodings (typically called 'well-known'
|
|
65
|
+
// types, listed in https://protobuf.dev/programming-guides/json/#any), the
|
|
66
|
+
// JSON format representation has a key `@type` which contains the type URL
|
|
67
|
+
// and a key `value` which contains the JSON-serialized value.
|
|
68
|
+
//
|
|
69
|
+
// The text format representation of an `Any` is like a message with one field
|
|
70
|
+
// whose name is the type URL in brackets. For example, an `Any` containing a
|
|
71
|
+
// `foo.Bar` message may be written `[type.googleapis.com/foo.Bar] { a: 2 }`.
|
|
72
|
+
message Any {
|
|
73
|
+
// Identifies the type of the serialized Protobuf message with a URI reference
|
|
74
|
+
// consisting of a prefix ending in a slash and the fully-qualified type name.
|
|
75
|
+
//
|
|
76
|
+
// Example: type.googleapis.com/google.protobuf.StringValue
|
|
77
|
+
//
|
|
78
|
+
// This string must contain at least one `/` character, and the content after
|
|
79
|
+
// the last `/` must be the fully-qualified name of the type in canonical
|
|
80
|
+
// form, without a leading dot. Do not write a scheme on these URI references
|
|
81
|
+
// so that clients do not attempt to contact them.
|
|
82
|
+
//
|
|
83
|
+
// The prefix is arbitrary and Protobuf implementations are expected to
|
|
84
|
+
// simply strip off everything up to and including the last `/` to identify
|
|
85
|
+
// the type. `type.googleapis.com/` is a common default prefix that some
|
|
86
|
+
// legacy implementations require. This prefix does not indicate the origin of
|
|
87
|
+
// the type, and URIs containing it are not expected to respond to any
|
|
88
|
+
// requests.
|
|
89
|
+
//
|
|
90
|
+
// All type URL strings must be legal URI references with the additional
|
|
91
|
+
// restriction (for the text format) that the content of the reference
|
|
92
|
+
// must consist only of alphanumeric characters, percent-encoded escapes, and
|
|
93
|
+
// characters in the following set (not including the outer backticks):
|
|
94
|
+
// `/-.~_!$&()*+,;=`. Despite our allowing percent encodings, implementations
|
|
95
|
+
// should not unescape them to prevent confusion with existing parsers. For
|
|
96
|
+
// example, `type.googleapis.com%2FFoo` should be rejected.
|
|
97
|
+
//
|
|
98
|
+
// In the original design of `Any`, the possibility of launching a type
|
|
99
|
+
// resolution service at these type URLs was considered but Protobuf never
|
|
100
|
+
// implemented one and considers contacting these URLs to be problematic and
|
|
101
|
+
// a potential security issue. Do not attempt to contact type URLs.
|
|
102
|
+
string type_url = 1;
|
|
103
|
+
|
|
104
|
+
// Holds a Protobuf serialization of the type described by type_url.
|
|
105
|
+
bytes value = 2;
|
|
106
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
|
4
|
+
//
|
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
|
6
|
+
// modification, are permitted provided that the following conditions are
|
|
7
|
+
// met:
|
|
8
|
+
//
|
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
// in the documentation and/or other materials provided with the
|
|
14
|
+
// distribution.
|
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
|
17
|
+
// this software without specific prior written permission.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
syntax = "proto3";
|
|
32
|
+
|
|
33
|
+
package google.protobuf;
|
|
34
|
+
|
|
35
|
+
option cc_enable_arenas = true;
|
|
36
|
+
option go_package = "google.golang.org/protobuf/types/known/durationpb";
|
|
37
|
+
option java_package = "com.google.protobuf";
|
|
38
|
+
option java_outer_classname = "DurationProto";
|
|
39
|
+
option java_multiple_files = true;
|
|
40
|
+
option objc_class_prefix = "GPB";
|
|
41
|
+
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
|
42
|
+
|
|
43
|
+
// A Duration represents a signed, fixed-length span of time represented
|
|
44
|
+
// as a count of seconds and fractions of seconds at nanosecond
|
|
45
|
+
// resolution. It is independent of any calendar and concepts like "day"
|
|
46
|
+
// or "month". It is related to Timestamp in that the difference between
|
|
47
|
+
// two Timestamp values is a Duration and it can be added or subtracted
|
|
48
|
+
// from a Timestamp. Range is approximately +-10,000 years.
|
|
49
|
+
//
|
|
50
|
+
// # Examples
|
|
51
|
+
//
|
|
52
|
+
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
53
|
+
//
|
|
54
|
+
// Timestamp start = ...;
|
|
55
|
+
// Timestamp end = ...;
|
|
56
|
+
// Duration duration = ...;
|
|
57
|
+
//
|
|
58
|
+
// duration.seconds = end.seconds - start.seconds;
|
|
59
|
+
// duration.nanos = end.nanos - start.nanos;
|
|
60
|
+
//
|
|
61
|
+
// if (duration.seconds < 0 && duration.nanos > 0) {
|
|
62
|
+
// duration.seconds += 1;
|
|
63
|
+
// duration.nanos -= 1000000000;
|
|
64
|
+
// } else if (duration.seconds > 0 && duration.nanos < 0) {
|
|
65
|
+
// duration.seconds -= 1;
|
|
66
|
+
// duration.nanos += 1000000000;
|
|
67
|
+
// }
|
|
68
|
+
//
|
|
69
|
+
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
70
|
+
//
|
|
71
|
+
// Timestamp start = ...;
|
|
72
|
+
// Duration duration = ...;
|
|
73
|
+
// Timestamp end = ...;
|
|
74
|
+
//
|
|
75
|
+
// end.seconds = start.seconds + duration.seconds;
|
|
76
|
+
// end.nanos = start.nanos + duration.nanos;
|
|
77
|
+
//
|
|
78
|
+
// if (end.nanos < 0) {
|
|
79
|
+
// end.seconds -= 1;
|
|
80
|
+
// end.nanos += 1000000000;
|
|
81
|
+
// } else if (end.nanos >= 1000000000) {
|
|
82
|
+
// end.seconds += 1;
|
|
83
|
+
// end.nanos -= 1000000000;
|
|
84
|
+
// }
|
|
85
|
+
//
|
|
86
|
+
// Example 3: Compute Duration from datetime.timedelta in Python.
|
|
87
|
+
//
|
|
88
|
+
// td = datetime.timedelta(days=3, minutes=10)
|
|
89
|
+
// duration = Duration()
|
|
90
|
+
// duration.FromTimedelta(td)
|
|
91
|
+
//
|
|
92
|
+
// # JSON Mapping
|
|
93
|
+
//
|
|
94
|
+
// In JSON format, the Duration type is encoded as a string rather than an
|
|
95
|
+
// object, where the string ends in the suffix "s" (indicating seconds) and
|
|
96
|
+
// is preceded by the number of seconds, with nanoseconds expressed as
|
|
97
|
+
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
|
98
|
+
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
|
99
|
+
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
|
100
|
+
// microsecond should be expressed in JSON format as "3.000001s".
|
|
101
|
+
//
|
|
102
|
+
message Duration {
|
|
103
|
+
// Signed seconds of the span of time. Must be from -315,576,000,000
|
|
104
|
+
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
105
|
+
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
106
|
+
int64 seconds = 1;
|
|
107
|
+
|
|
108
|
+
// Signed fractions of a second at nanosecond resolution of the span
|
|
109
|
+
// of time. Durations less than one second are represented with a 0
|
|
110
|
+
// `seconds` field and a positive or negative `nanos` field. For durations
|
|
111
|
+
// of one second or more, a non-zero value for the `nanos` field must be
|
|
112
|
+
// of the same sign as the `seconds` field. Must be from -999,999,999
|
|
113
|
+
// to +999,999,999 inclusive.
|
|
114
|
+
int32 nanos = 2;
|
|
115
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2025 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.rpc;
|
|
18
|
+
|
|
19
|
+
import "google/protobuf/any.proto";
|
|
20
|
+
|
|
21
|
+
option cc_enable_arenas = true;
|
|
22
|
+
option go_package = "google.golang.org/genproto/googleapis/rpc/status;status";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_outer_classname = "StatusProto";
|
|
25
|
+
option java_package = "com.google.rpc";
|
|
26
|
+
option objc_class_prefix = "RPC";
|
|
27
|
+
|
|
28
|
+
// The `Status` type defines a logical error model that is suitable for
|
|
29
|
+
// different programming environments, including REST APIs and RPC APIs. It is
|
|
30
|
+
// used by [gRPC](https://github.com/grpc). Each `Status` message contains
|
|
31
|
+
// three pieces of data: error code, error message, and error details.
|
|
32
|
+
//
|
|
33
|
+
// You can find out more about this error model and how to work with it in the
|
|
34
|
+
// [API Design Guide](https://cloud.google.com/apis/design/errors).
|
|
35
|
+
message Status {
|
|
36
|
+
// The status code, which should be an enum value of
|
|
37
|
+
// [google.rpc.Code][google.rpc.Code].
|
|
38
|
+
int32 code = 1;
|
|
39
|
+
|
|
40
|
+
// A developer-facing error message, which should be in English. Any
|
|
41
|
+
// user-facing error message should be localized and sent in the
|
|
42
|
+
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
|
|
43
|
+
// by the client.
|
|
44
|
+
string message = 2;
|
|
45
|
+
|
|
46
|
+
// A list of messages that carry the error details. There is a common set of
|
|
47
|
+
// message types for APIs to use.
|
|
48
|
+
repeated google.protobuf.Any details = 3;
|
|
49
|
+
}
|