- คำขอ HTTP
- พารามิเตอร์เส้นทาง
- เนื้อหาคำขอ
- เนื้อหาการตอบกลับ
- ขอบเขตการให้สิทธิ์
- SearchMessagesView
- SearchMessageResult
- ลองใช้งาน
To search across all spaces the user has access to, set parent to spaces/-. Using any other value for parent results in an INVALID_ARGUMENT error. The returned messages have their name field populated with the full resource name, which includes the specific space in which the message resides.
This API doesn't return all message types. The types of messages listed below aren't included in the response. Use messages.list to list all messages.
- Private Messages that are visible to the authenticated user.
- Messages posted by Chat apps in spaces or group chats.
- Messages in a Chat app DM.
- Messages from blocked users.
- Messages in spaces that the caller has muted.
Requires user authentication with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.messages.readonlyhttps://www.googleapis.com/auth/chat.messages
คำขอ HTTP
POST https://chat.googleapis.com/v1/{parent=spaces/*}/messages:search
URL ใช้ไวยากรณ์การแปลงรหัส gRPC
พารามิเตอร์เส้นทาง
| พารามิเตอร์ | |
|---|---|
parent |
ต้องระบุ ชื่อทรัพยากรของพื้นที่ทำงานที่จะค้นหา หากต้องการค้นหาในพื้นที่ทำงานทั้งหมดที่ผู้ใช้มีสิทธิ์เข้าถึง ให้ตั้งค่าช่องนี้เป็น หากต้องการจำกัดการค้นหาให้อยู่ในพื้นที่ทำงานอย่างน้อย 1 แห่ง ให้ใช้ |
เนื้อหาคำขอ
เนื้อหาของคำขอมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
| การแสดง JSON |
|---|
{
"filter": string,
"pageSize": integer,
"pageToken": string,
"orderBy": string,
"view": enum ( |
| ช่อง | |
|---|---|
filter |
ต้องระบุ คำค้นหา การค้นหาสามารถระบุคีย์เวิร์ดในการค้นหาอย่างน้อย 1 รายการ ซึ่งใช้เพื่อกรองผลลัพธ์ นอกจากนี้ คุณยังกรองผลลัพธ์โดยใช้ช่องข้อความต่อไปนี้ได้ด้วย
For advanced filtering, the following functions are also available:
Using the
Using the
Across different fields, only Among the same field:
Parentheses are required to disambiguate operator precedence when combining The following example queries are valid: The maximum query length is 1,000 characters. Invalid queries are rejected by the server with an |
pageSize |
ไม่บังคับ จำนวนผลลัพธ์สูงสุดที่จะแสดง บริการอาจแสดงผลลัพธ์น้อยกว่าค่านี้ หากไม่ได้ระบุไว้ ระบบจะแสดงผลลัพธ์ไม่เกิน 25 รายการ ค่าสูงสุดคือ 100 หากคุณใช้ค่ามากกว่า 100 ระบบจะเปลี่ยนเป็น 100 โดยอัตโนมัติ |
pageToken |
ไม่บังคับ โทเค็นที่ได้รับจากการเรียกใช้การค้นหาข้อความครั้งก่อน ระบุพารามิเตอร์นี้เพื่อดึงข้อมูลหน้าถัดไป เมื่อแบ่งหน้า พารามิเตอร์อื่นๆ ทั้งหมดที่ระบุควรตรงกับการเรียกใช้ที่ให้โทเค็นหน้า การส่งค่าอื่นไปยังพารามิเตอร์อื่นๆ อาจทำให้เกิดผลลัพธ์ที่ไม่คาดคิด |
orderBy |
ไม่บังคับ วิธีจัดเรียงรายการผลลัพธ์ แอตทริบิวต์ที่รองรับสำหรับการจัดเรียงมีดังนี้
การจัดเรียงเริ่มต้นคือ |
view |
ไม่บังคับ Specifies what kind of search results view to return. The default is |
เนื้อหาการตอบกลับ
Response message for searching messages.
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
| การแสดง JSON |
|---|
{
"results": [
{
object ( |
| ช่อง | |
|---|---|
results[] |
รายการผลการค้นหาที่ตรงกับคำค้นหา |
nextPageToken |
โทเค็นที่ใช้ดึงข้อมูลหน้าถัดไป หากช่องนี้ว่างเปล่า แสดงว่าไม่มีหน้าถัดไป |
ขอบเขตการให้สิทธิ์
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/chat.messageshttps://www.googleapis.com/auth/chat.messages.readonly
For more information, see the Authorization guide.
SearchMessagesView
The kinds of view that are supported for partial search results.
| Enum | |
|---|---|
SEARCH_MESSAGES_VIEW_UNSPECIFIED |
ค่าเริ่มต้น / ค่าที่ไม่ได้ตั้งค่า API จะตั้งค่าเริ่มต้นเป็นมุมมอง BASIC |
SEARCH_MESSAGES_VIEW_BASIC |
Includes only the matched messages in the results, but no additional metadata. นี่คือค่าเริ่มต้น |
SEARCH_MESSAGES_VIEW_FULL |
Includes everything in the results: the matched messages and additional metadata. |
SearchMessageResult
A single result item from a message search.
| การแสดง JSON |
|---|
{ "message": { object ( |
| ช่อง | |
|---|---|
message |
ข้อความที่ตรงกัน |
spaceMuteSetting |
การตั้งค่าปิดเสียงของผู้ใช้ที่เรียกใช้สำหรับพื้นที่ทำงานที่โพสต์ข้อความ แอปของผู้เรียกใช้สามารถใช้ข้อมูลนี้เพื่อตัดสินใจว่าจะประมวลผลข้อความอย่างไร โดยขึ้นอยู่กับว่าพื้นที่ทำงานปิดเสียงสำหรับผู้ใช้หรือไม่ จะแสดงผลก็ต่อเมื่อมุมมองคำขอเป็น
|
read |
Indicates if the matched message is read by the calling user. จะแสดงผลก็ต่อเมื่อมุมมองคำขอเป็น
|