Google Classroom API . courses . aliases

Instance Methods

create(courseId, body, x__xgafv=None)

Creates an alias for a course.

delete(courseId, alias, x__xgafv=None)

Deletes an alias of a course.

list(courseId, pageSize=None, x__xgafv=None, pageToken=None)

Returns a list of aliases for a course.

list_next(previous_request, previous_response)

Retrieves the next page of results.

Method Details

create(courseId, body, x__xgafv=None)
Creates an alias for a course.

This method returns the following error codes:

* `PERMISSION_DENIED` if the requesting user is not permitted to create the
alias or for access errors.
* `NOT_FOUND` if the course does not exist.
* `ALREADY_EXISTS` if the alias already exists.
* `FAILED_PRECONDITION` if the alias requested does not make sense for the
  requesting user or course (for example, if a user not in a domain
  attempts to access a domain-scoped alias).

Args:
  courseId: string, Identifier of the course to alias.
This identifier can be either the Classroom-assigned identifier or an
alias. (required)
  body: object, The request body. (required)
    The object takes the form of:

{ # Alternative identifier for a course.
      # 
      # An alias uniquely identifies a course. It must be unique within one of the
      # following scopes:
      # 
      # * domain: A domain-scoped alias is visible to all users within the alias
      # creator's domain and can be created only by a domain admin. A domain-scoped
      # alias is often used when a course has an identifier external to Classroom.
      # 
      # * project: A project-scoped alias is visible to any request from an
      # application using the Developer Console project ID that created the alias
      # and can be created by any project. A project-scoped alias is often used when
      # an application has alternative identifiers. A random value can also be used
      # to avoid duplicate courses in the event of transmission failures, as retrying
      # a request will return `ALREADY_EXISTS` if a previous one has succeeded.
    "alias": "A String", # Alias string. The format of the string indicates the desired alias scoping.
        # 
        # * `d:` indicates a domain-scoped alias.
        #   Example: `d:math_101`
        # * `p:` indicates a project-scoped alias.
        #   Example: `p:abc123`
        # 
        # This field has a maximum length of 256 characters.
  }

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Alternative identifier for a course.
        #
        # An alias uniquely identifies a course. It must be unique within one of the
        # following scopes:
        #
        # * domain: A domain-scoped alias is visible to all users within the alias
        # creator's domain and can be created only by a domain admin. A domain-scoped
        # alias is often used when a course has an identifier external to Classroom.
        #
        # * project: A project-scoped alias is visible to any request from an
        # application using the Developer Console project ID that created the alias
        # and can be created by any project. A project-scoped alias is often used when
        # an application has alternative identifiers. A random value can also be used
        # to avoid duplicate courses in the event of transmission failures, as retrying
        # a request will return `ALREADY_EXISTS` if a previous one has succeeded.
      "alias": "A String", # Alias string. The format of the string indicates the desired alias scoping.
          #
          # * `d:` indicates a domain-scoped alias.
          #   Example: `d:math_101`
          # * `p:` indicates a project-scoped alias.
          #   Example: `p:abc123`
          #
          # This field has a maximum length of 256 characters.
    }
delete(courseId, alias, x__xgafv=None)
Deletes an alias of a course.

This method returns the following error codes:

* `PERMISSION_DENIED` if the requesting user is not permitted to remove the
alias or for access errors.
* `NOT_FOUND` if the alias does not exist.
* `FAILED_PRECONDITION` if the alias requested does not make sense for the
  requesting user or course (for example, if a user not in a domain
  attempts to delete a domain-scoped alias).

Args:
  courseId: string, Identifier of the course whose alias should be deleted.
This identifier can be either the Classroom-assigned identifier or an
alias. (required)
  alias: string, Alias to delete.
This may not be the Classroom-assigned identifier. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A generic empty message that you can re-use to avoid defining duplicated
      # empty messages in your APIs. A typical example is to use it as the request
      # or the response type of an API method. For instance:
      #
      #     service Foo {
      #       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
      #     }
      #
      # The JSON representation for `Empty` is empty JSON object `{}`.
  }
list(courseId, pageSize=None, x__xgafv=None, pageToken=None)
Returns a list of aliases for a course.

This method returns the following error codes:

* `PERMISSION_DENIED` if the requesting user is not permitted to access the
course or for access errors.
* `NOT_FOUND` if the course does not exist.

Args:
  courseId: string, The identifier of the course.
This identifier can be either the Classroom-assigned identifier or an
alias. (required)
  pageSize: integer, Maximum number of items to return. Zero or unspecified indicates that the
server may assign a maximum.

The server may return fewer than the specified number of results.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format
  pageToken: string, nextPageToken
value returned from a previous
list call,
indicating that the subsequent page of results should be returned.

The list request
must be otherwise identical to the one that resulted in this token.

Returns:
  An object of the form:

    { # Response when listing course aliases.
    "nextPageToken": "A String", # Token identifying the next page of results to return. If empty, no further
        # results are available.
    "aliases": [ # The course aliases.
      { # Alternative identifier for a course.
            #
            # An alias uniquely identifies a course. It must be unique within one of the
            # following scopes:
            #
            # * domain: A domain-scoped alias is visible to all users within the alias
            # creator's domain and can be created only by a domain admin. A domain-scoped
            # alias is often used when a course has an identifier external to Classroom.
            #
            # * project: A project-scoped alias is visible to any request from an
            # application using the Developer Console project ID that created the alias
            # and can be created by any project. A project-scoped alias is often used when
            # an application has alternative identifiers. A random value can also be used
            # to avoid duplicate courses in the event of transmission failures, as retrying
            # a request will return `ALREADY_EXISTS` if a previous one has succeeded.
          "alias": "A String", # Alias string. The format of the string indicates the desired alias scoping.
              #
              # * `d:` indicates a domain-scoped alias.
              #   Example: `d:math_101`
              # * `p:` indicates a project-scoped alias.
              #   Example: `p:abc123`
              #
              # This field has a maximum length of 256 characters.
        },
    ],
  }
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.