섹션 나열

이 가이드에서는 Google Chat API의 Section 리소스에서 list 메서드를 사용하여 Google Chat에서 인증된 사용자가 사용할 수 있는 섹션을 나열하는 방법을 설명합니다.

자세한 내용은 Google Chat에서 섹션 만들기 및 정리를 참고하세요.

기본 요건

Python

섹션 나열

사용자 인증으로 섹션을 나열하려면 요청에 다음을 전달합니다.

  • chat.users.sections 또는 chat.users.sections.readonly 승인 범위를 지정합니다.
  • ListSections 메서드를 호출합니다.
  • parentusers/me로 설정합니다.

다음 예에서는 섹션을 나열합니다.

Python

from google.cloud import chat_v1

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

    # Initialize request
    request = chat_v1.ListSectionsRequest(
        parent="users/me"
    )

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

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

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