# Google Cloud Pub/Sub API . projects . topics

## Instance Methods

Returns the subscriptions Resource.

Creates the given topic with the given name.

Deletes the topic with the given name. All subscriptions to this topic are detached from the topic. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions.

Gets the configuration of a topic.

Lists matching topics.

Retrieves the next page of results.

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

### Method Details

`create(name, body)`

    Creates the given topic with the given name.

    Args:
      name: string, A parameter (required)
      body: object, The request body. (required)
        The object takes the form of:

    {
        "name": "A String",
      }

    Returns:
      An object of the form:

        {
          "name": "A String",
        }

`delete(topic)`

    Deletes the topic with the given name. All subscriptions to this topic are detached from the topic. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions.

    Args:
      topic: string, A parameter (required)

    Returns:
      An object of the form:

        {
      }

`get(topic)`

    Gets the configuration of a topic.

    Args:
      topic: string, A parameter (required)

    Returns:
      An object of the form:

        {
          "name": "A String",
        }

`list(project, pageSize=None, pageToken=None)`

    Lists matching topics.

    Args:
      project: string, A parameter (required)
      pageSize: integer, A parameter
      pageToken: string, A parameter

    Returns:
      An object of the form:

        {
        "nextPageToken": "A String",
        "topics": [
          {
              "name": "A String",
            },
        ],
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`publish(topic, body)`

    Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

    Args:
      topic: string, A parameter (required)
      body: object, The request body. (required)
        The object takes the form of:

    {
        "messages": [
          {
            "attributes": {
              "a_key": "A String",
            },
            "data": "A String",
            "messageId": "A String",
          },
        ],
      }

    Returns:
      An object of the form:

        {
        "messageIds": [
          "A String",
        ],
      }