diff --git a/userAPI_2.yaml b/userAPI_2.yaml new file mode 100644 index 0000000..992757d --- /dev/null +++ b/userAPI_2.yaml @@ -0,0 +1,211 @@ +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: "アイコンイメージ" + required: false + type: "string" + - name: "token" + in: "formData" + description: "トークンの新規作成" + required: true + 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: false + type: "string" + - name: "pw" + in: "formData" + description: "パスワードの更新" + required: false + type: "string" + - name: "icon-image" + in: "formData" + description: "アイコンイメージの更新" + required: false + type: "string" + responses: + 200: + description: "更新しました" + + 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: "削除しました" + 400: + description: "無効なユーザが指定されました。" + 404: + description: "ユーザが見つかりませんでした。" + + /users/{uId}/login: + put: + 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: + 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" + responses: + 200: + description: "ログアウトしました" + 404: + description: "ログアウトに失敗しました" + +definitions: + User: + type: "object" + properties: + uId: + type: "string" + example: "12345@6789.com" + 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