From f72319e256284d517ffdf179ce03c0a06087f507 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 29 May 2015 15:37:44 +0100 Subject: [PATCH] Add profile API. Add error definition to definitions folder. The tool used for validating swagger 2.0 schemata does not currently support deep-nested definitions from other files. Until it does, keep the definitions in a separate file each in a definitions folder. This will be replaced with a definitions.yaml in the future. --- api/client-server/v1/content-repo.yaml | 2 +- api/client-server/v1/definitions/error.yaml | 7 ++ api/client-server/v1/directory.yaml | 2 +- api/client-server/v1/profile.yaml | 110 ++++++++++++++++++++ 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 api/client-server/v1/definitions/error.yaml create mode 100644 api/client-server/v1/profile.yaml diff --git a/api/client-server/v1/content-repo.yaml b/api/client-server/v1/content-repo.yaml index 4088a73ca..fe3d1dc37 100644 --- a/api/client-server/v1/content-repo.yaml +++ b/api/client-server/v1/content-repo.yaml @@ -2,7 +2,7 @@ swagger: '2.0' info: title: "Matrix Client-Server v1 Content Repository API" version: "1.0.0" -host: matrix.org +host: localhost:8008 schemes: - https basePath: /_matrix/media/v1 diff --git a/api/client-server/v1/definitions/error.yaml b/api/client-server/v1/definitions/error.yaml new file mode 100644 index 000000000..5a5587aba --- /dev/null +++ b/api/client-server/v1/definitions/error.yaml @@ -0,0 +1,7 @@ +type: object +properties: + errcode: + type: string + error: + type: string +required: ["errcode"] \ No newline at end of file diff --git a/api/client-server/v1/directory.yaml b/api/client-server/v1/directory.yaml index e23b45864..c70b9f6ba 100644 --- a/api/client-server/v1/directory.yaml +++ b/api/client-server/v1/directory.yaml @@ -2,7 +2,7 @@ swagger: '2.0' info: title: "Matrix Client-Server v1 Directory API" version: "1.0.0" -host: matrix.org +host: localhost:8008 schemes: - https - http diff --git a/api/client-server/v1/profile.yaml b/api/client-server/v1/profile.yaml new file mode 100644 index 000000000..d0343a2c7 --- /dev/null +++ b/api/client-server/v1/profile.yaml @@ -0,0 +1,110 @@ +swagger: '2.0' +info: + title: "Matrix Client-Server v1 Profile API" + version: "1.0.0" +host: localhost:8008 +schemes: + - https + - http +basePath: /_matrix/client/api/v1/profile +consumes: + - application/json +produces: + - application/json +securityDefinitions: + accessToken: + type: apiKey + description: The user_id or application service access_token + name: access_token + in: query +paths: + "/{userId}/displayname": + put: + summary: Set the user's display name. + security: + - accessToken: [] + parameters: + - in: path + type: string + name: userId + description: The user whose display name to set. + required: true + - in: body + name: displayName + description: The display name info. + required: true + schema: + type: object + properties: + displayname: + type: string + description: The new display name for this user. + responses: + 200: + description: The display name was set. + schema: + type: object # empty json object + get: + summary: Get the user's display name. + parameters: + - in: path + type: string + name: userId + description: The user whose display name to get. + required: true + responses: + 200: + description: The display name for this user. + schema: + type: object + properties: + displayname: + type: string + description: The user's display name if they have set one. + 404: + description: There is no display name for this user or this user does not exist. + "/{userId}/avatar_url": + put: + summary: Set the user's avatar URL. + security: + - accessToken: [] + parameters: + - in: path + type: string + name: userId + description: The user whose avatar URL to set. + required: true + - in: body + name: avatar_url + description: The avatar url info. + required: true + schema: + type: object + properties: + avatar_url: + type: string + description: The new avatar URL for this user. + responses: + 200: + description: The avatar URL was set. + schema: + type: object # empty json object + get: + summary: Get the user's avatar URL. + parameters: + - in: path + type: string + name: userId + description: The user whose avatar URL to get. + required: true + responses: + 200: + description: The avatar URL for this user. + schema: + type: object + properties: + avatar_url: + type: string + description: The user's avatar URL if they have set one. + 404: + description: There is no avatar URL for this user or this user does not exist. \ No newline at end of file