Newer
Older
CosmosSwaggerYAML / userAPI.yaml
swagger: "2.0"
info:
  description: "これはユーザ情報に関するAPIです。"
  version: "1.0.0"
  title: "user API"
host: "nitta-lab-www.is.konan-u.ac.jp"
basePath: "/cosmos"
schemes:
- "https"
- "http"
paths:
  /users:
    post:
      summary: "ユーザーの新規作成"
      description: "新しいユーザーを登録します。"
      consumes:
      - "multipart/form-data"
      parameters:
      - name: "uid"
        in: "formData"
        description: "ユーザーID"
        required: true
        type: "string"
      - name: "name"
        in: "formData"
        description: "ユーザーの名前"
        required: true
        type: "string"
      - name: "pass"
        in: "formData"
        description: "ユーザーのpass"
        required: true
        type: "string"
      - name: "icon-image"
        in: "formData"
        description: "アイコンイメージ"
        required: true
        type: "string"
        # [$ref: "#/definitions/Parametars"]
      responses:
        201:
          description: "Userdate created"
      
          
  /users/createWithArray:
    post:
      summary: "Creates list of users with given input array"
      description: ""
      consumes:
      - "multipart/form-data"
      parameters:
      - name: "uid"
        in: "formData"
        description: "ユーザーID"
        required: true
        type: "string"
      - name: "name"
        in: "formData"
        description: "ユーザーの名前"
        required: true
        type: "string"
      - name: "pass"
        in: "formData"
        description: "ユーザーのpass"
        required: true
        type: "string"
      - name: "icon-image"
        in: "formData"
        description: "アイコンイメージ"
        required: true
        type: "string"
        # [$ref: "#/definitions/Parametars"]
      responses:
        default:
          description: "処理が成功しました。"
          
  /users/login:
    get:
      summary: "Logs user into the system."
      description: ""
      parameters:
      - name: "userId"
        in: "query"
        description: "ログインのためのユーザ名"
        required: true
        type: "string"
      - name: "password"
        in: "query"
        description: "ログインのためのパスワード"
        required: true
        type: "string"
      responses:
        200:
          description: "処理に成功"
        400:
          description: "ユーザ名もしくはパスワードが間違っています。"
          
  /users/logout:
    get:
      summary: "Logs out current logged in user session."
      description: ""
      parameters: []
      responses:
        default: 
          description: "ログアウトしました。"
  
  /users/{userId}:
    get:
      summary: "ユーザー情報を取得"
      description: "userIdを指定してユーザーの情報を取得します。"
      parameters:
      - name: "userId"
        in: "path"
        required: true
        type: "string"
      responses:
        200:
          description: "succesful operation."
          schema:
            $ref: "#/definitions/User"
        400:
          description: "無効なユーザー名が指定されました。"
        404:
          description: "ユーザーが見つかりませんでした。"
    # put:
    #   summary: "Updated user."
    #   description: "ログインしているユーザのみが行えます。"
    #   consumes:  
    #   - "multipart/form-data"
    #   parameters:
    #   - name: "userId"
    #     in: "path"
    #     description: "ユーザ名の更新"
    #     required: true
    #     type: "string"
    #   - name: "newName"
    #     in: "formData"
    #     description: "ユーザーの名前"
    #     required: true
    #     type: "string"
    #   responses:
    #     400:
    #       description: "無効なユーザが指定されました。"
    #     404:
    #       description: "ユーザが見つかりませんでした。"
    delete:
      summary: "ユーザー情報を削除"
      description: "userIdを指定してユーザーの情報を削除します。"
      parameters:
      - name: "userId"
        in: "path"
        description: "削除したいユーザーのuserId"
        required: true
        type: "string"
      responses:
        400:
          description: "無効なユーザが指定されました。"
        404:
          description: "ユーザが見つかりませんでした。"
          
  /users/{userId}/uId:
    get:
      summary: "uIdの取得"
      description: "userIdで指定したユーザーのuIdを取得します。"
      parameters:
      - name: "userId"
        in: "path"
        required: true
        type: "integer"
        format: "int64"
      responses:
        default:
          description: "取得に成功しました。"
          schema:
            type: "object"
            properties:
              uId:
                type: "integer"
                format: "int64"
    put:
      summary: "uIdの更新"
      description: "userIdで指定したユーザーのuIdを更新します。"
      consumes:  
      - "multipart/form-data"
      parameters:
      - name: "userId"
        in: "path"
        required: true
        type: "string"
      - name: "newName"
        in: "formData"
        description: "ユーザーの名前"
        required: true
        type: "string"
      responses:
        default:
          description: "uIdを更新しました。"
          schema:
            type: "object"
            properties:
              uId:
                type: "integer"
                format: "int64"
                example: "123"
                
  /users/{userId}/name:
    get:
      summary: "nameの取得"
      description: "userIdで指定したユーザーのnameを取得します。"
      parameters:
      - name: "userId"
        in: "path"
        required: true
        type: "string"
      responses:
        default:
          description: "取得に成功しました。"
          schema:
            type: "object"
            properties:
              name:
                type: "string"
    put:
      summary: "nameの更新"
      description: "userIdで指定したユーザーのnameを更新します。"
      parameters:
      - name: "userId"
        in: "path"
        required: true
        type: "string"
      responses:
        default:
          description: "nameを更新しました。"
          schema:
            type: "object"
            properties:
              name:
                type: "string"
                example: "123"
                
  /users/{userId}/pass:
    put:
      summary: "passの更新"
      description: "userIdで指定したユーザーのpassを更新します。"
      parameters:
      - name: "userId"
        in: "path"
        required: true
        type: "string"
      responses:
        default:
          description: "passを更新しました。"
          schema:
            type: "object"
            properties:
              name:
                type: "string"
                example: "123"
definitions:
  # Parametars:
  #   - name: "uid"
  #     in: "formData"
  #     description: "ユーザーID"
  #     required: true.
  #     type: "string"
  #   - name: "name"
  #     in: "formData"
  #     description: "ユーザーの名前"
  #     required: true
  #     type: "string"
  #   - name: "pass"
  #     in: "formData"
  #     description: "ユーザーのpass"
  #     required: true
  #     type: "string"
  #   - name: "icon-image"
  #     in: "formData"
  #     description: "アイコンイメージ"
  #     required: true
  #     type: "string"
  User:
    type: "object"
    properties:
      uId:
        type: "integer"
        format: "int64"
      name:
        type: "string"
      pass:
        type: "string"
      icon-image: 
        type: "string"