섹션의 스페이스 나열

이 가이드에서는 Google Chat API의 SectionItem 리소스에서 list 메서드를 사용하여 섹션에 항목 (예: 스페이스)을 나열하는 방법을 설명합니다.

스페이스만 섹션 항목이 될 수 있습니다. 자세한 내용은 Google Chat에서 섹션 만들기 및 정리하기를 참고하세요.

기본 요건

Python

섹션의 스페이스 나열

사용자 인증이 있는 섹션의 스페이스를 나열하려면 요청에 다음을 전달하세요.

  • chat.users.sections 또는 chat.users.sections.readonly 승인 범위를 지정합니다.
  • ListSectionItems 메서드를 호출합니다.
  • parent을 섹션의 리소스 이름으로 설정합니다.

다음 예에서는 섹션의 스페이스를 나열합니다.

Python

from google.cloud import chat_v1

def list_section_items():
    # Create a client
    client = chat_v1.ChatServiceClient()

    # Initialize request
    request = chat_v1.ListSectionItemsRequest(
        parent="SECTION_NAME"
    )

    # Make the request
    page_result = client.list_section_items(request=request)

    # Handle the response
    for item in page_result:
        print(item)

이 샘플을 실행하려면 다음을 바꾸세요.

  • SECTION_NAME: 섹션의 리소스 이름입니다. ListSections 메서드를 호출하여 리소스 이름을 가져올 수 있습니다.

Chat API는 SectionItem 리소스 목록을 반환합니다.