diff --git a/userAPI.yaml b/userAPI.yaml index 2e17790..d89d5be 100644 --- a/userAPI.yaml +++ b/userAPI.yaml @@ -1,292 +1,232 @@ -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: +swagger: "2.0" +info: + description: "これはCosmosのuserAPIです。" + version: "1.0.0" + title: "User API" + termsOfService: "http://swagger.io/terms/" +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: "pw" + in: "formData" + description: "ユーザーのパスワード" + required: true + type: "string" + - name: "icon-image" + in: "formData" + description: "アイコンイメージ(base64)" + required: false + type: "string" + responses: + 201: + description: "成功時のレスポンス" + schema: + $ref: "#/definitions/User" + + + /users/{uId}: + get: + summary: "ユーザー情報を取得" + description: "userIdを指定してユーザーの情報を取得します。" + consumes: + - "multipart/form-data" + parameters: + - name: "uId" + in: "path" + description: "検索したいユーザーID" + required: true + type: "string" + - name: "token" + in: "formData" + description: "端末が所持するトークン" + required: true + type: "string" + responses: + 200: + description: "成功時のレスポンス" + schema: + type: "object" + properties: + name: + type: "string" + example: "甲南 太郎" + icon-uri: + type: "string" + 400: + description: "無効なユーザー名が指定されました。" + 404: + description: "ユーザーが見つかりませんでした。" + put: + summary: "ユーザー情報を更新" + description: "ログインしているユーザのみが行えます。" + consumes: + - "multipart/form-data" + parameters: + - name: "uId" + in: "path" + description: "ユーザーIDの取得" + required: true + type: "string" + - name: "token" + in: "formData" + description: "ユーザー情報を更新したいユーザーのトークン" + required: true + type: "string" + - name: "name" + in: "formData" + description: "ユーザー名の更新" + required: true + type: "string" + - name: "pw" + in: "formData" + description: "パスワードの更新" + required: true + type: "string" + - name: "icon-image" + in: "formData" + description: "アイコンイメージの更新(base64)" + required: false + type: "string" + responses: + 200: + description: "更新しました" + schema: + type: "object" + properties: + uId: + type: "string" + example: "1234" + uri: + type: "string" + example: "http://nitta-lab-www.is.konan-u.ac.jp/cosmos/users/{uId}" + delete: + summary: "ユーザー情報を削除" + description: "userIdを指定してユーザーの情報を削除します。" + consumes: + - "multipart/form-data" + parameters: + - name: "uId" + in: "path" + description: "削除したいユーザーのユーザーID" + required: true + type: "string" + - name: "token" + in: "formData" + description: "削除したいユーザーのトークン" + required: true + type: "string" + responses: + 200: + description: "成功時のレスポンス" + schema: + type: "object" + properties: + massage: + type: "string" + example: "Already Deleted" + 400: + description: "無効なユーザが指定されました。" + schema: + type: "object" + properties: + massage: + type: "string" + example: "Invalid User" + 404: + description: "ユーザが見つかりませんでした。" + schema: + type: "object" + properties: + massage: + type: "string" + example: "User Not Found" + + /users/{uId}/login: + post: + summary: "ログイン" + description: "" + parameters: + - name: "uId" + in: "path" + description: "ログインのためのユーザーID" + required: true + type: "string" + - name: "pw" + in: "query" + description: "ログインのためのパスワード" + required: true + type: "string" + responses: + 200: + description: "ログインしました" + schema: + $ref: "#/definitions/Token" + 400: + description: "ユーザIDもしくはパスワードが間違っています。" + + /users/{uId}/logout: + delete: + summary: "ログアウト" + description: "" + consumes: + - "multipart/form-data" + parameters: + - name: "uId" + in: "path" + description: "ログアウトのためのユーザーID" + required: true + type: "string" + - name: "token" + in: "formData" + description: "ログアウトのためのトークン" + required: true + type: "string" + responses: + 200: + description: "ログアウトしました" + 404: + description: "ログアウトに失敗しました" + +definitions: + User: + type: "object" + properties: + uId: + type: "string" + example: "12345" + name: + type: "string" + example: "甲南 太郎" + uri: + type: "string" + example: "http://nitta-lab-www.is.konan-u.ac.jp/cosmos/users/{uId}" + token: + type: "string" + icon-uri: + type: "string" + + Token: + type: "object" + properties: + token: type: "string" \ No newline at end of file