@origincloud/support 0.0.0-stage → 0.13.0
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/LICENSE +202 -0
- package/README.md +24 -2
- package/dist/v1beta1/case.d.ts +148 -0
- package/dist/v1beta1/case.d.ts.map +1 -0
- package/dist/v1beta1/case.js +114 -0
- package/dist/v1beta1/case.js.map +1 -0
- package/dist/v1beta1/case_message.d.ts +99 -0
- package/dist/v1beta1/case_message.d.ts.map +1 -0
- package/dist/v1beta1/case_message.js +79 -0
- package/dist/v1beta1/case_message.js.map +1 -0
- package/dist/v1beta1/index.d.ts +3 -0
- package/dist/v1beta1/index.d.ts.map +1 -0
- package/dist/v1beta1/index.js +4 -0
- package/dist/v1beta1/index.js.map +1 -0
- package/package.json +40 -4
- package/src/v1beta1/case.ts +238 -0
- package/src/v1beta1/case_message.ts +163 -0
- package/src/v1beta1/index.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @origincloud/support
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The client of Origin Cloud's support service: support cases, each a conversation
|
|
4
|
+
between an organization and Origin Cloud support about a question or a problem.
|
|
5
|
+
Part of the [Origin Cloud SDK for
|
|
6
|
+
TypeScript](https://github.com/origincloudhq/sdk-typescript), generated from the
|
|
7
|
+
API definitions in [origincloudhq/api](https://github.com/origincloudhq/api).
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Client } from "@origincloud/core";
|
|
11
|
+
import { CaseClient } from "@origincloud/support/v1beta1";
|
|
12
|
+
|
|
13
|
+
const cases = new CaseClient(new Client());
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| Import | API |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `@origincloud/support/v1beta1` | Support cases, each a conversation between an organization and Origin Cloud support about a question or a problem |
|
|
19
|
+
|
|
20
|
+
`v1beta1` is a preview version and may change in incompatible ways, like the API
|
|
21
|
+
itself. See the [repository's
|
|
22
|
+
README](https://github.com/origincloudhq/sdk-typescript#readme) for credentials
|
|
23
|
+
and behaviour.
|
|
24
|
+
|
|
25
|
+
Apache License 2.0.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { type CallOptions, type Client, type Service } from "@origincloud/core";
|
|
2
|
+
/**
|
|
3
|
+
* Calls CaseService.
|
|
4
|
+
*
|
|
5
|
+
* Support cases: an organization's questions and problems, and where each
|
|
6
|
+
* one stands.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CaseClient {
|
|
9
|
+
/**
|
|
10
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
11
|
+
* operations its methods answer with.
|
|
12
|
+
*/
|
|
13
|
+
readonly service: Service;
|
|
14
|
+
/** A client of CaseService that sends its calls through `client`. */
|
|
15
|
+
constructor(client: Client);
|
|
16
|
+
/** Returns a case. Needs `admin.support_case.get` on the organization. */
|
|
17
|
+
getCase(request: GetCaseRequest, options?: CallOptions): Promise<Case>;
|
|
18
|
+
/**
|
|
19
|
+
* Lists an organization's cases, newest first. Needs
|
|
20
|
+
* `admin.support_case.list` on the organization.
|
|
21
|
+
*/
|
|
22
|
+
listCases(request: ListCasesRequest, options?: CallOptions): Promise<ListCasesResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Iterates over everything listCases lists from the request's page on,
|
|
25
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
26
|
+
* the iteration with its error.
|
|
27
|
+
*/
|
|
28
|
+
allCases(request: ListCasesRequest, options?: CallOptions): AsyncGenerator<Case, void, undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Opens a case, `OPEN`. Needs `admin.support_case.create` on the
|
|
31
|
+
* organization.
|
|
32
|
+
*/
|
|
33
|
+
createCase(request: CreateCaseRequest, options?: CallOptions): Promise<Case>;
|
|
34
|
+
/**
|
|
35
|
+
* Closes a case: its `state` becomes `CLOSED`, and its contact email is
|
|
36
|
+
* notified. Closing a closed case succeeds and changes nothing. Needs
|
|
37
|
+
* `admin.support_case.update` on the organization.
|
|
38
|
+
*/
|
|
39
|
+
closeCase(request: CloseCaseRequest, options?: CallOptions): Promise<Case>;
|
|
40
|
+
/**
|
|
41
|
+
* Opens a resolved or closed case again: its `state` becomes `OPEN`, and
|
|
42
|
+
* its contact email is notified. Reopening a case that is `OPEN` or
|
|
43
|
+
* `IN_PROGRESS` succeeds and changes nothing. Needs
|
|
44
|
+
* `admin.support_case.update` on the organization.
|
|
45
|
+
*/
|
|
46
|
+
reopenCase(request: ReopenCaseRequest, options?: CallOptions): Promise<Case>;
|
|
47
|
+
}
|
|
48
|
+
/** A support case: one question or problem, and the conversation about it. */
|
|
49
|
+
export interface Case {
|
|
50
|
+
/** The case's resource name, `organizations/{organization}/cases/{case}`. */
|
|
51
|
+
name?: string;
|
|
52
|
+
/** The case's URN, the identifier access policies and the audit log use. */
|
|
53
|
+
urn?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The project the case is about, `projects/{project}`, one of the
|
|
56
|
+
* organization's. Empty for a case about the organization as a whole.
|
|
57
|
+
*/
|
|
58
|
+
project?: string;
|
|
59
|
+
/** A one-line summary. Not empty. */
|
|
60
|
+
subject?: string;
|
|
61
|
+
/** What the case is about, in full. Not empty. */
|
|
62
|
+
description?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The email address every notification about the case is sent to, for
|
|
65
|
+
* as long as the case exists: when support replies, and when its state
|
|
66
|
+
* changes.
|
|
67
|
+
*/
|
|
68
|
+
contactEmail?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Where the case stands. Changed by support, and by `CloseCase` and
|
|
71
|
+
* `ReopenCase`.
|
|
72
|
+
*/
|
|
73
|
+
state?: Case_State;
|
|
74
|
+
/**
|
|
75
|
+
* The principal that opened the case, such as `user:<id>` or
|
|
76
|
+
* `service_account:<id>`.
|
|
77
|
+
*/
|
|
78
|
+
creator?: string;
|
|
79
|
+
/** When the case was opened. */
|
|
80
|
+
createTime?: string;
|
|
81
|
+
/** When the case last changed: a message added, or its state changed. */
|
|
82
|
+
updateTime?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Where the case stands. */
|
|
85
|
+
export declare const Case_State: {
|
|
86
|
+
/** Not set. */
|
|
87
|
+
readonly STATE_UNSPECIFIED: "STATE_UNSPECIFIED";
|
|
88
|
+
/** Opened, or opened again, and waiting for support. */
|
|
89
|
+
readonly OPEN: "OPEN";
|
|
90
|
+
/** Support is working on it. */
|
|
91
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
92
|
+
/** Support considers it solved. Reopen it if it isn't. */
|
|
93
|
+
readonly RESOLVED: "RESOLVED";
|
|
94
|
+
/** Finished. Reopen it to continue the conversation. */
|
|
95
|
+
readonly CLOSED: "CLOSED";
|
|
96
|
+
};
|
|
97
|
+
/** Where the case stands. */
|
|
98
|
+
export type Case_State = (typeof Case_State)[keyof typeof Case_State];
|
|
99
|
+
/** The request for GetCase. */
|
|
100
|
+
export interface GetCaseRequest {
|
|
101
|
+
/** The case to return. */
|
|
102
|
+
name?: string;
|
|
103
|
+
}
|
|
104
|
+
/** The request for ListCases. */
|
|
105
|
+
export interface ListCasesRequest {
|
|
106
|
+
/** The organization whose cases to list, `organizations/{organization}`. */
|
|
107
|
+
parent?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The most cases to return; the server clamps it, and 0 means its
|
|
110
|
+
* default.
|
|
111
|
+
*/
|
|
112
|
+
pageSize?: number;
|
|
113
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
114
|
+
pageToken?: string;
|
|
115
|
+
}
|
|
116
|
+
/** The response for ListCases. */
|
|
117
|
+
export interface ListCasesResponse {
|
|
118
|
+
/** The cases on this page. */
|
|
119
|
+
cases?: Case[];
|
|
120
|
+
/** The token for the next page; empty on the last one. */
|
|
121
|
+
nextPageToken?: string;
|
|
122
|
+
}
|
|
123
|
+
/** The request for CreateCase. */
|
|
124
|
+
export interface CreateCaseRequest {
|
|
125
|
+
/** The organization to open the case in, `organizations/{organization}`. */
|
|
126
|
+
parent?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The case to open: its `subject`, `description` and `contactEmail`,
|
|
129
|
+
* and its `project` if it is about one.
|
|
130
|
+
*/
|
|
131
|
+
case?: Case;
|
|
132
|
+
/**
|
|
133
|
+
* A UUID; a repeat with the same id returns the case the first request
|
|
134
|
+
* opened instead of opening a second one.
|
|
135
|
+
*/
|
|
136
|
+
requestId?: string;
|
|
137
|
+
}
|
|
138
|
+
/** The request for CloseCase. */
|
|
139
|
+
export interface CloseCaseRequest {
|
|
140
|
+
/** The case to close. */
|
|
141
|
+
name?: string;
|
|
142
|
+
}
|
|
143
|
+
/** The request for ReopenCase. */
|
|
144
|
+
export interface ReopenCaseRequest {
|
|
145
|
+
/** The case to open again. */
|
|
146
|
+
name?: string;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../src/v1beta1/case.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,OAAO,EAIb,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,qEAAqE;gBACzD,MAAM,EAAE,MAAM;IAI1B,0EAA0E;IACpE,OAA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rB;AAED,6BAA6B;AAC7B,eAAO,MAAM,UAAU;IACrB,eAAe;;IAEf,wDAAwD;;IAExD,gCAAgC;;IAEhC,0DAA0D;;IAE1D,wDAAwD;;CAEhD,CAAC;AAEX,6BAA6B;AAC7B,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEtE,+BAA+B;AAC/B,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/support/v1beta1/case.proto
|
|
3
|
+
import { newRequestId, pathValue, query, } from "@origincloud/core";
|
|
4
|
+
/**
|
|
5
|
+
* Calls CaseService.
|
|
6
|
+
*
|
|
7
|
+
* Support cases: an organization's questions and problems, and where each
|
|
8
|
+
* one stands.
|
|
9
|
+
*/
|
|
10
|
+
export class CaseClient {
|
|
11
|
+
/**
|
|
12
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
13
|
+
* operations its methods answer with.
|
|
14
|
+
*/
|
|
15
|
+
service;
|
|
16
|
+
/** A client of CaseService that sends its calls through `client`. */
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.service = client.service("support", false);
|
|
19
|
+
}
|
|
20
|
+
/** Returns a case. Needs `admin.support_case.get` on the organization. */
|
|
21
|
+
async getCase(request, options) {
|
|
22
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*");
|
|
23
|
+
return this.service.call({
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: `/v1beta1/${p0}`,
|
|
26
|
+
query: query(request, ["name"]),
|
|
27
|
+
idempotent: true,
|
|
28
|
+
}, options);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Lists an organization's cases, newest first. Needs
|
|
32
|
+
* `admin.support_case.list` on the organization.
|
|
33
|
+
*/
|
|
34
|
+
async listCases(request, options) {
|
|
35
|
+
const p0 = pathValue("parent", request.parent, "organizations/*");
|
|
36
|
+
return this.service.call({
|
|
37
|
+
method: "GET",
|
|
38
|
+
path: `/v1beta1/${p0}/cases`,
|
|
39
|
+
query: query(request, ["parent"]),
|
|
40
|
+
idempotent: true,
|
|
41
|
+
}, options);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Iterates over everything listCases lists from the request's page on,
|
|
45
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
46
|
+
* the iteration with its error.
|
|
47
|
+
*/
|
|
48
|
+
async *allCases(request, options) {
|
|
49
|
+
for (let page = request;;) {
|
|
50
|
+
const response = await this.listCases(page, options);
|
|
51
|
+
yield* response.cases ?? [];
|
|
52
|
+
if (!response.nextPageToken)
|
|
53
|
+
return;
|
|
54
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Opens a case, `OPEN`. Needs `admin.support_case.create` on the
|
|
59
|
+
* organization.
|
|
60
|
+
*/
|
|
61
|
+
async createCase(request, options) {
|
|
62
|
+
if (!request.requestId)
|
|
63
|
+
request = { ...request, requestId: newRequestId() };
|
|
64
|
+
const p0 = pathValue("parent", request.parent, "organizations/*");
|
|
65
|
+
return this.service.call({
|
|
66
|
+
method: "POST",
|
|
67
|
+
path: `/v1beta1/${p0}/cases`,
|
|
68
|
+
body: request.case,
|
|
69
|
+
query: query(request, ["parent", "case"]),
|
|
70
|
+
idempotent: true,
|
|
71
|
+
}, options);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Closes a case: its `state` becomes `CLOSED`, and its contact email is
|
|
75
|
+
* notified. Closing a closed case succeeds and changes nothing. Needs
|
|
76
|
+
* `admin.support_case.update` on the organization.
|
|
77
|
+
*/
|
|
78
|
+
async closeCase(request, options) {
|
|
79
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*");
|
|
80
|
+
return this.service.call({
|
|
81
|
+
method: "POST",
|
|
82
|
+
path: `/v1beta1/${p0}:close`,
|
|
83
|
+
body: request,
|
|
84
|
+
}, options);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Opens a resolved or closed case again: its `state` becomes `OPEN`, and
|
|
88
|
+
* its contact email is notified. Reopening a case that is `OPEN` or
|
|
89
|
+
* `IN_PROGRESS` succeeds and changes nothing. Needs
|
|
90
|
+
* `admin.support_case.update` on the organization.
|
|
91
|
+
*/
|
|
92
|
+
async reopenCase(request, options) {
|
|
93
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*");
|
|
94
|
+
return this.service.call({
|
|
95
|
+
method: "POST",
|
|
96
|
+
path: `/v1beta1/${p0}:reopen`,
|
|
97
|
+
body: request,
|
|
98
|
+
}, options);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** Where the case stands. */
|
|
102
|
+
export const Case_State = {
|
|
103
|
+
/** Not set. */
|
|
104
|
+
STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
|
|
105
|
+
/** Opened, or opened again, and waiting for support. */
|
|
106
|
+
OPEN: "OPEN",
|
|
107
|
+
/** Support is working on it. */
|
|
108
|
+
IN_PROGRESS: "IN_PROGRESS",
|
|
109
|
+
/** Support considers it solved. Reopen it if it isn't. */
|
|
110
|
+
RESOLVED: "RESOLVED",
|
|
111
|
+
/** Finished. Reopen it to continue the conversation. */
|
|
112
|
+
CLOSED: "CLOSED",
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../src/v1beta1/case.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,iDAAiD;AAEjD,OAAO,EAIL,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACrB;;;OAGG;IACM,OAAO,CAAU;IAE1B,qEAAqE;IACrE,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,OAAqB;QAC1D,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY,EAAE,EAAE;YACtB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;YAC/B,UAAU,EAAE,IAAI;S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|
|
4
|
+
*
|
|
5
|
+
* A case's messages: its conversation between the organization and
|
|
6
|
+
* support, oldest first. A message is never changed or removed once added.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CaseMessageClient {
|
|
9
|
+
/**
|
|
10
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
11
|
+
* operations its methods answer with.
|
|
12
|
+
*/
|
|
13
|
+
readonly service: Service;
|
|
14
|
+
/** A client of CaseMessageService that sends its calls through `client`. */
|
|
15
|
+
constructor(client: Client);
|
|
16
|
+
/**
|
|
17
|
+
* Returns one message of a case. Needs `admin.support_case.get` on the
|
|
18
|
+
* organization.
|
|
19
|
+
*/
|
|
20
|
+
getCaseMessage(request: GetCaseMessageRequest, options?: CallOptions): Promise<CaseMessage>;
|
|
21
|
+
/**
|
|
22
|
+
* Lists a case's messages, oldest first. Needs `admin.support_case.get`
|
|
23
|
+
* on the organization.
|
|
24
|
+
*/
|
|
25
|
+
listCaseMessages(request: ListCaseMessagesRequest, options?: CallOptions): Promise<ListCaseMessagesResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Iterates over everything listCaseMessages lists from the request's page on,
|
|
28
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
29
|
+
* the iteration with its error.
|
|
30
|
+
*/
|
|
31
|
+
allCaseMessages(request: ListCaseMessagesRequest, options?: CallOptions): AsyncGenerator<CaseMessage, void, undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Adds a message to a case's conversation. The case's contact email is
|
|
34
|
+
* notified unless the message's author opened the case, so nobody is
|
|
35
|
+
* emailed their own messages. Needs `admin.support_case.create` on the
|
|
36
|
+
* organization.
|
|
37
|
+
*/
|
|
38
|
+
createCaseMessage(request: CreateCaseMessageRequest, options?: CallOptions): Promise<CaseMessage>;
|
|
39
|
+
}
|
|
40
|
+
/** One message of a case's conversation. */
|
|
41
|
+
export interface CaseMessage {
|
|
42
|
+
/**
|
|
43
|
+
* The message's resource name,
|
|
44
|
+
* `organizations/{organization}/cases/{case}/messages/{message}`.
|
|
45
|
+
*/
|
|
46
|
+
name?: string;
|
|
47
|
+
/** The message's text. Not empty. */
|
|
48
|
+
body?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The principal that wrote the message, such as `user:<id>` or
|
|
51
|
+
* `service_account:<id>`.
|
|
52
|
+
*/
|
|
53
|
+
author?: string;
|
|
54
|
+
/** When the message was added. */
|
|
55
|
+
createTime?: string;
|
|
56
|
+
}
|
|
57
|
+
/** The request for GetCaseMessage. */
|
|
58
|
+
export interface GetCaseMessageRequest {
|
|
59
|
+
/** The message to return. */
|
|
60
|
+
name?: string;
|
|
61
|
+
}
|
|
62
|
+
/** The request for ListCaseMessages. */
|
|
63
|
+
export interface ListCaseMessagesRequest {
|
|
64
|
+
/**
|
|
65
|
+
* The case whose messages to list,
|
|
66
|
+
* `organizations/{organization}/cases/{case}`.
|
|
67
|
+
*/
|
|
68
|
+
parent?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The most messages to return; the server clamps it, and 0 means its
|
|
71
|
+
* default.
|
|
72
|
+
*/
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
75
|
+
pageToken?: string;
|
|
76
|
+
}
|
|
77
|
+
/** The response for ListCaseMessages. */
|
|
78
|
+
export interface ListCaseMessagesResponse {
|
|
79
|
+
/** The messages on this page. */
|
|
80
|
+
caseMessages?: CaseMessage[];
|
|
81
|
+
/** The token for the next page; empty on the last one. */
|
|
82
|
+
nextPageToken?: string;
|
|
83
|
+
}
|
|
84
|
+
/** The request for CreateCaseMessage. */
|
|
85
|
+
export interface CreateCaseMessageRequest {
|
|
86
|
+
/**
|
|
87
|
+
* The case to add the message to,
|
|
88
|
+
* `organizations/{organization}/cases/{case}`.
|
|
89
|
+
*/
|
|
90
|
+
parent?: string;
|
|
91
|
+
/** The message to add: its `body`. */
|
|
92
|
+
caseMessage?: CaseMessage;
|
|
93
|
+
/**
|
|
94
|
+
* A UUID; a repeat with the same id returns the message the first
|
|
95
|
+
* request added instead of adding a second one.
|
|
96
|
+
*/
|
|
97
|
+
requestId?: string;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=case_message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case_message.d.ts","sourceRoot":"","sources":["../../src/v1beta1/case_message.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,OAAO,EAIb,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,4EAA4E;gBAChE,MAAM,EAAE,MAAM;IAI1B;;;OAGG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAajG;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAalH;;;;OAIG;IACI,eAAe,CAAC,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC;IAS7H;;;;;OAKG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAcxG;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,sCAAsC;AACtC,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wCAAwC;AACxC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/support/v1beta1/case_message.proto
|
|
3
|
+
import { newRequestId, pathValue, query, } from "@origincloud/core";
|
|
4
|
+
/**
|
|
5
|
+
* Calls CaseMessageService.
|
|
6
|
+
*
|
|
7
|
+
* A case's messages: its conversation between the organization and
|
|
8
|
+
* support, oldest first. A message is never changed or removed once added.
|
|
9
|
+
*/
|
|
10
|
+
export class CaseMessageClient {
|
|
11
|
+
/**
|
|
12
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
13
|
+
* operations its methods answer with.
|
|
14
|
+
*/
|
|
15
|
+
service;
|
|
16
|
+
/** A client of CaseMessageService that sends its calls through `client`. */
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.service = client.service("support", false);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns one message of a case. Needs `admin.support_case.get` on the
|
|
22
|
+
* organization.
|
|
23
|
+
*/
|
|
24
|
+
async getCaseMessage(request, options) {
|
|
25
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*/messages/*");
|
|
26
|
+
return this.service.call({
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: `/v1beta1/${p0}`,
|
|
29
|
+
query: query(request, ["name"]),
|
|
30
|
+
idempotent: true,
|
|
31
|
+
}, options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Lists a case's messages, oldest first. Needs `admin.support_case.get`
|
|
35
|
+
* on the organization.
|
|
36
|
+
*/
|
|
37
|
+
async listCaseMessages(request, options) {
|
|
38
|
+
const p0 = pathValue("parent", request.parent, "organizations/*/cases/*");
|
|
39
|
+
return this.service.call({
|
|
40
|
+
method: "GET",
|
|
41
|
+
path: `/v1beta1/${p0}/messages`,
|
|
42
|
+
query: query(request, ["parent"]),
|
|
43
|
+
idempotent: true,
|
|
44
|
+
}, options);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Iterates over everything listCaseMessages lists from the request's page on,
|
|
48
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
49
|
+
* the iteration with its error.
|
|
50
|
+
*/
|
|
51
|
+
async *allCaseMessages(request, options) {
|
|
52
|
+
for (let page = request;;) {
|
|
53
|
+
const response = await this.listCaseMessages(page, options);
|
|
54
|
+
yield* response.caseMessages ?? [];
|
|
55
|
+
if (!response.nextPageToken)
|
|
56
|
+
return;
|
|
57
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Adds a message to a case's conversation. The case's contact email is
|
|
62
|
+
* notified unless the message's author opened the case, so nobody is
|
|
63
|
+
* emailed their own messages. Needs `admin.support_case.create` on the
|
|
64
|
+
* organization.
|
|
65
|
+
*/
|
|
66
|
+
async createCaseMessage(request, options) {
|
|
67
|
+
if (!request.requestId)
|
|
68
|
+
request = { ...request, requestId: newRequestId() };
|
|
69
|
+
const p0 = pathValue("parent", request.parent, "organizations/*/cases/*");
|
|
70
|
+
return this.service.call({
|
|
71
|
+
method: "POST",
|
|
72
|
+
path: `/v1beta1/${p0}/messages`,
|
|
73
|
+
body: request.caseMessage,
|
|
74
|
+
query: query(request, ["parent", "caseMessage"]),
|
|
75
|
+
idempotent: true,
|
|
76
|
+
}, options);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=case_message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case_message.js","sourceRoot":"","sources":["../../src/v1beta1/case_message.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yDAAyD;AAEzD,OAAO,EAIL,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;OAGG;IACM,OAAO,CAAU;IAE1B,4EAA4E;IAC5E,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CAAC,OAA8B,EAAE,OAAqB;QACxE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,oCAAoC,CAAC,CAAC;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY,EAAE,EAAE;YACtB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;YAC/B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAgC,EAAE,OAAqB;QAC5E,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,yBAAyB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AC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origincloud/support",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "Origin Cloud's support service: support cases, each a conversation between an organization and Origin Cloud support about a question or a problem.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://github.com/origincloudhq/sdk-typescript#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/origincloudhq/sdk-typescript.git",
|
|
10
|
+
"directory": "packages/support"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/origincloudhq/sdk-typescript/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"origincloud",
|
|
15
|
+
"origin-cloud",
|
|
16
|
+
"sdk",
|
|
17
|
+
"support"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
"./*": {
|
|
26
|
+
"types": "./dist/*/index.d.ts",
|
|
27
|
+
"default": "./dist/*/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src",
|
|
34
|
+
"!dist/**/*.tsbuildinfo"
|
|
35
|
+
],
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@origincloud/core": "^0.13.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@origincloud/core": "^0.13.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/support/v1beta1/case.proto
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type CallOptions,
|
|
6
|
+
type Client,
|
|
7
|
+
type Service,
|
|
8
|
+
newRequestId,
|
|
9
|
+
pathValue,
|
|
10
|
+
query,
|
|
11
|
+
} from "@origincloud/core";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Calls CaseService.
|
|
15
|
+
*
|
|
16
|
+
* Support cases: an organization's questions and problems, and where each
|
|
17
|
+
* one stands.
|
|
18
|
+
*/
|
|
19
|
+
export class CaseClient {
|
|
20
|
+
/**
|
|
21
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
22
|
+
* operations its methods answer with.
|
|
23
|
+
*/
|
|
24
|
+
readonly service: Service;
|
|
25
|
+
|
|
26
|
+
/** A client of CaseService that sends its calls through `client`. */
|
|
27
|
+
constructor(client: Client) {
|
|
28
|
+
this.service = client.service("support", false);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Returns a case. Needs `admin.support_case.get` on the organization. */
|
|
32
|
+
async getCase(request: GetCaseRequest, options?: CallOptions): Promise<Case> {
|
|
33
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*");
|
|
34
|
+
return this.service.call<Case>(
|
|
35
|
+
{
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/v1beta1/${p0}`,
|
|
38
|
+
query: query(request, ["name"]),
|
|
39
|
+
idempotent: true,
|
|
40
|
+
},
|
|
41
|
+
options,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Lists an organization's cases, newest first. Needs
|
|
47
|
+
* `admin.support_case.list` on the organization.
|
|
48
|
+
*/
|
|
49
|
+
async listCases(request: ListCasesRequest, options?: CallOptions): Promise<ListCasesResponse> {
|
|
50
|
+
const p0 = pathValue("parent", request.parent, "organizations/*");
|
|
51
|
+
return this.service.call<ListCasesResponse>(
|
|
52
|
+
{
|
|
53
|
+
method: "GET",
|
|
54
|
+
path: `/v1beta1/${p0}/cases`,
|
|
55
|
+
query: query(request, ["parent"]),
|
|
56
|
+
idempotent: true,
|
|
57
|
+
},
|
|
58
|
+
options,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Iterates over everything listCases lists from the request's page on,
|
|
64
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
65
|
+
* the iteration with its error.
|
|
66
|
+
*/
|
|
67
|
+
async *allCases(request: ListCasesRequest, options?: CallOptions): AsyncGenerator<Case, void, undefined> {
|
|
68
|
+
for (let page = request; ; ) {
|
|
69
|
+
const response = await this.listCases(page, options);
|
|
70
|
+
yield* response.cases ?? [];
|
|
71
|
+
if (!response.nextPageToken) return;
|
|
72
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Opens a case, `OPEN`. Needs `admin.support_case.create` on the
|
|
78
|
+
* organization.
|
|
79
|
+
*/
|
|
80
|
+
async createCase(request: CreateCaseRequest, options?: CallOptions): Promise<Case> {
|
|
81
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
82
|
+
const p0 = pathValue("parent", request.parent, "organizations/*");
|
|
83
|
+
return this.service.call<Case>(
|
|
84
|
+
{
|
|
85
|
+
method: "POST",
|
|
86
|
+
path: `/v1beta1/${p0}/cases`,
|
|
87
|
+
body: request.case,
|
|
88
|
+
query: query(request, ["parent", "case"]),
|
|
89
|
+
idempotent: true,
|
|
90
|
+
},
|
|
91
|
+
options,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Closes a case: its `state` becomes `CLOSED`, and its contact email is
|
|
97
|
+
* notified. Closing a closed case succeeds and changes nothing. Needs
|
|
98
|
+
* `admin.support_case.update` on the organization.
|
|
99
|
+
*/
|
|
100
|
+
async closeCase(request: CloseCaseRequest, options?: CallOptions): Promise<Case> {
|
|
101
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*");
|
|
102
|
+
return this.service.call<Case>(
|
|
103
|
+
{
|
|
104
|
+
method: "POST",
|
|
105
|
+
path: `/v1beta1/${p0}:close`,
|
|
106
|
+
body: request,
|
|
107
|
+
},
|
|
108
|
+
options,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Opens a resolved or closed case again: its `state` becomes `OPEN`, and
|
|
114
|
+
* its contact email is notified. Reopening a case that is `OPEN` or
|
|
115
|
+
* `IN_PROGRESS` succeeds and changes nothing. Needs
|
|
116
|
+
* `admin.support_case.update` on the organization.
|
|
117
|
+
*/
|
|
118
|
+
async reopenCase(request: ReopenCaseRequest, options?: CallOptions): Promise<Case> {
|
|
119
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*");
|
|
120
|
+
return this.service.call<Case>(
|
|
121
|
+
{
|
|
122
|
+
method: "POST",
|
|
123
|
+
path: `/v1beta1/${p0}:reopen`,
|
|
124
|
+
body: request,
|
|
125
|
+
},
|
|
126
|
+
options,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** A support case: one question or problem, and the conversation about it. */
|
|
132
|
+
export interface Case {
|
|
133
|
+
/** The case's resource name, `organizations/{organization}/cases/{case}`. */
|
|
134
|
+
name?: string;
|
|
135
|
+
/** The case's URN, the identifier access policies and the audit log use. */
|
|
136
|
+
urn?: string;
|
|
137
|
+
/**
|
|
138
|
+
* The project the case is about, `projects/{project}`, one of the
|
|
139
|
+
* organization's. Empty for a case about the organization as a whole.
|
|
140
|
+
*/
|
|
141
|
+
project?: string;
|
|
142
|
+
/** A one-line summary. Not empty. */
|
|
143
|
+
subject?: string;
|
|
144
|
+
/** What the case is about, in full. Not empty. */
|
|
145
|
+
description?: string;
|
|
146
|
+
/**
|
|
147
|
+
* The email address every notification about the case is sent to, for
|
|
148
|
+
* as long as the case exists: when support replies, and when its state
|
|
149
|
+
* changes.
|
|
150
|
+
*/
|
|
151
|
+
contactEmail?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Where the case stands. Changed by support, and by `CloseCase` and
|
|
154
|
+
* `ReopenCase`.
|
|
155
|
+
*/
|
|
156
|
+
state?: Case_State;
|
|
157
|
+
/**
|
|
158
|
+
* The principal that opened the case, such as `user:<id>` or
|
|
159
|
+
* `service_account:<id>`.
|
|
160
|
+
*/
|
|
161
|
+
creator?: string;
|
|
162
|
+
/** When the case was opened. */
|
|
163
|
+
createTime?: string;
|
|
164
|
+
/** When the case last changed: a message added, or its state changed. */
|
|
165
|
+
updateTime?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Where the case stands. */
|
|
169
|
+
export const Case_State = {
|
|
170
|
+
/** Not set. */
|
|
171
|
+
STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
|
|
172
|
+
/** Opened, or opened again, and waiting for support. */
|
|
173
|
+
OPEN: "OPEN",
|
|
174
|
+
/** Support is working on it. */
|
|
175
|
+
IN_PROGRESS: "IN_PROGRESS",
|
|
176
|
+
/** Support considers it solved. Reopen it if it isn't. */
|
|
177
|
+
RESOLVED: "RESOLVED",
|
|
178
|
+
/** Finished. Reopen it to continue the conversation. */
|
|
179
|
+
CLOSED: "CLOSED",
|
|
180
|
+
} as const;
|
|
181
|
+
|
|
182
|
+
/** Where the case stands. */
|
|
183
|
+
export type Case_State = (typeof Case_State)[keyof typeof Case_State];
|
|
184
|
+
|
|
185
|
+
/** The request for GetCase. */
|
|
186
|
+
export interface GetCaseRequest {
|
|
187
|
+
/** The case to return. */
|
|
188
|
+
name?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The request for ListCases. */
|
|
192
|
+
export interface ListCasesRequest {
|
|
193
|
+
/** The organization whose cases to list, `organizations/{organization}`. */
|
|
194
|
+
parent?: string;
|
|
195
|
+
/**
|
|
196
|
+
* The most cases to return; the server clamps it, and 0 means its
|
|
197
|
+
* default.
|
|
198
|
+
*/
|
|
199
|
+
pageSize?: number;
|
|
200
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
201
|
+
pageToken?: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** The response for ListCases. */
|
|
205
|
+
export interface ListCasesResponse {
|
|
206
|
+
/** The cases on this page. */
|
|
207
|
+
cases?: Case[];
|
|
208
|
+
/** The token for the next page; empty on the last one. */
|
|
209
|
+
nextPageToken?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** The request for CreateCase. */
|
|
213
|
+
export interface CreateCaseRequest {
|
|
214
|
+
/** The organization to open the case in, `organizations/{organization}`. */
|
|
215
|
+
parent?: string;
|
|
216
|
+
/**
|
|
217
|
+
* The case to open: its `subject`, `description` and `contactEmail`,
|
|
218
|
+
* and its `project` if it is about one.
|
|
219
|
+
*/
|
|
220
|
+
case?: Case;
|
|
221
|
+
/**
|
|
222
|
+
* A UUID; a repeat with the same id returns the case the first request
|
|
223
|
+
* opened instead of opening a second one.
|
|
224
|
+
*/
|
|
225
|
+
requestId?: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** The request for CloseCase. */
|
|
229
|
+
export interface CloseCaseRequest {
|
|
230
|
+
/** The case to close. */
|
|
231
|
+
name?: string;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** The request for ReopenCase. */
|
|
235
|
+
export interface ReopenCaseRequest {
|
|
236
|
+
/** The case to open again. */
|
|
237
|
+
name?: string;
|
|
238
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/support/v1beta1/case_message.proto
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type CallOptions,
|
|
6
|
+
type Client,
|
|
7
|
+
type Service,
|
|
8
|
+
newRequestId,
|
|
9
|
+
pathValue,
|
|
10
|
+
query,
|
|
11
|
+
} from "@origincloud/core";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Calls CaseMessageService.
|
|
15
|
+
*
|
|
16
|
+
* A case's messages: its conversation between the organization and
|
|
17
|
+
* support, oldest first. A message is never changed or removed once added.
|
|
18
|
+
*/
|
|
19
|
+
export class CaseMessageClient {
|
|
20
|
+
/**
|
|
21
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
22
|
+
* operations its methods answer with.
|
|
23
|
+
*/
|
|
24
|
+
readonly service: Service;
|
|
25
|
+
|
|
26
|
+
/** A client of CaseMessageService that sends its calls through `client`. */
|
|
27
|
+
constructor(client: Client) {
|
|
28
|
+
this.service = client.service("support", false);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns one message of a case. Needs `admin.support_case.get` on the
|
|
33
|
+
* organization.
|
|
34
|
+
*/
|
|
35
|
+
async getCaseMessage(request: GetCaseMessageRequest, options?: CallOptions): Promise<CaseMessage> {
|
|
36
|
+
const p0 = pathValue("name", request.name, "organizations/*/cases/*/messages/*");
|
|
37
|
+
return this.service.call<CaseMessage>(
|
|
38
|
+
{
|
|
39
|
+
method: "GET",
|
|
40
|
+
path: `/v1beta1/${p0}`,
|
|
41
|
+
query: query(request, ["name"]),
|
|
42
|
+
idempotent: true,
|
|
43
|
+
},
|
|
44
|
+
options,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Lists a case's messages, oldest first. Needs `admin.support_case.get`
|
|
50
|
+
* on the organization.
|
|
51
|
+
*/
|
|
52
|
+
async listCaseMessages(request: ListCaseMessagesRequest, options?: CallOptions): Promise<ListCaseMessagesResponse> {
|
|
53
|
+
const p0 = pathValue("parent", request.parent, "organizations/*/cases/*");
|
|
54
|
+
return this.service.call<ListCaseMessagesResponse>(
|
|
55
|
+
{
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: `/v1beta1/${p0}/messages`,
|
|
58
|
+
query: query(request, ["parent"]),
|
|
59
|
+
idempotent: true,
|
|
60
|
+
},
|
|
61
|
+
options,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Iterates over everything listCaseMessages lists from the request's page on,
|
|
67
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
68
|
+
* the iteration with its error.
|
|
69
|
+
*/
|
|
70
|
+
async *allCaseMessages(request: ListCaseMessagesRequest, options?: CallOptions): AsyncGenerator<CaseMessage, void, undefined> {
|
|
71
|
+
for (let page = request; ; ) {
|
|
72
|
+
const response = await this.listCaseMessages(page, options);
|
|
73
|
+
yield* response.caseMessages ?? [];
|
|
74
|
+
if (!response.nextPageToken) return;
|
|
75
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Adds a message to a case's conversation. The case's contact email is
|
|
81
|
+
* notified unless the message's author opened the case, so nobody is
|
|
82
|
+
* emailed their own messages. Needs `admin.support_case.create` on the
|
|
83
|
+
* organization.
|
|
84
|
+
*/
|
|
85
|
+
async createCaseMessage(request: CreateCaseMessageRequest, options?: CallOptions): Promise<CaseMessage> {
|
|
86
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
87
|
+
const p0 = pathValue("parent", request.parent, "organizations/*/cases/*");
|
|
88
|
+
return this.service.call<CaseMessage>(
|
|
89
|
+
{
|
|
90
|
+
method: "POST",
|
|
91
|
+
path: `/v1beta1/${p0}/messages`,
|
|
92
|
+
body: request.caseMessage,
|
|
93
|
+
query: query(request, ["parent", "caseMessage"]),
|
|
94
|
+
idempotent: true,
|
|
95
|
+
},
|
|
96
|
+
options,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** One message of a case's conversation. */
|
|
102
|
+
export interface CaseMessage {
|
|
103
|
+
/**
|
|
104
|
+
* The message's resource name,
|
|
105
|
+
* `organizations/{organization}/cases/{case}/messages/{message}`.
|
|
106
|
+
*/
|
|
107
|
+
name?: string;
|
|
108
|
+
/** The message's text. Not empty. */
|
|
109
|
+
body?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The principal that wrote the message, such as `user:<id>` or
|
|
112
|
+
* `service_account:<id>`.
|
|
113
|
+
*/
|
|
114
|
+
author?: string;
|
|
115
|
+
/** When the message was added. */
|
|
116
|
+
createTime?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The request for GetCaseMessage. */
|
|
120
|
+
export interface GetCaseMessageRequest {
|
|
121
|
+
/** The message to return. */
|
|
122
|
+
name?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The request for ListCaseMessages. */
|
|
126
|
+
export interface ListCaseMessagesRequest {
|
|
127
|
+
/**
|
|
128
|
+
* The case whose messages to list,
|
|
129
|
+
* `organizations/{organization}/cases/{case}`.
|
|
130
|
+
*/
|
|
131
|
+
parent?: string;
|
|
132
|
+
/**
|
|
133
|
+
* The most messages to return; the server clamps it, and 0 means its
|
|
134
|
+
* default.
|
|
135
|
+
*/
|
|
136
|
+
pageSize?: number;
|
|
137
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
138
|
+
pageToken?: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The response for ListCaseMessages. */
|
|
142
|
+
export interface ListCaseMessagesResponse {
|
|
143
|
+
/** The messages on this page. */
|
|
144
|
+
caseMessages?: CaseMessage[];
|
|
145
|
+
/** The token for the next page; empty on the last one. */
|
|
146
|
+
nextPageToken?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The request for CreateCaseMessage. */
|
|
150
|
+
export interface CreateCaseMessageRequest {
|
|
151
|
+
/**
|
|
152
|
+
* The case to add the message to,
|
|
153
|
+
* `organizations/{organization}/cases/{case}`.
|
|
154
|
+
*/
|
|
155
|
+
parent?: string;
|
|
156
|
+
/** The message to add: its `body`. */
|
|
157
|
+
caseMessage?: CaseMessage;
|
|
158
|
+
/**
|
|
159
|
+
* A UUID; a repeat with the same id returns the message the first
|
|
160
|
+
* request added instead of adding a second one.
|
|
161
|
+
*/
|
|
162
|
+
requestId?: string;
|
|
163
|
+
}
|