{"openapi":"3.0.0","servers":[{"description":"Main production server","url":"https://api.9thplanet.ca"},{"description":"Dev server","url":"http://api.9thplanet.gleb.at"},{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/KlGleb/9thplanet/1.0.0"}],"info":{"description":"This is an api of 9th Planet project","version":"1.0.0","title":"9th Planet API","contact":{"email":"info@gleb.at"}},"tags":[{"name":"developers","description":"Operations available to regular developers"},{"name":"auth"},{"name":"documents"},{"name":"photos"},{"name":"dictionary"},{"name":"dream"},{"name":"user"},{"name":"payment"},{"name":"Новые","description":"Недавно добавленные методы"}],"paths":{"/auth":{"post":{"tags":["auth"],"summary":"Auth the user","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password"}},"required":["email","password"]}}}},"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Access"}}}}}},"delete":{"tags":["auth"],"security":[{"ApiKeyAuth":[]}],"summary":"Log out","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Completable"}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}}}}},"/auth/all":{"delete":{"security":[{"ApiKeyAuth":[]}],"tags":["auth"],"summary":"Delete all tokens for the user","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Completable"}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}}}}},"/auth/reg":{"post":{"tags":["auth"],"summary":"Register the user in the system and send email with confirmation link","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password"}},"required":["firstName","lastName","email","password"]}}}},"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Register"}}}}}}},"/auth/pass":{"get":{"tags":["auth"],"summary":"Send an email which contains a link that allows the user to reset the password.","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","format":"password"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Completable"}}}}}},"post":{"security":[{"ApiKeyAuth":[]}],"tags":["auth"],"summary":"Reset the password using the link (that contains the ‘code’) from email, OR  reset the password using ‘oldPassword’ -- for authorised users only","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"newPassword":{"type":"string","format":"password"},"code":{"type":"string","format":"password"},"oldPassword":{"type":"string","format":"password"}},"required":["newPassword"]}}}},"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Access"}}}}}}},"/auth/generate":{"get":{"tags":["developers","auth"],"summary":"Generate new user with confirmed email.","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"},"password":{"type":"string"},"email":{"type":"string","format":"email"}}}}}}}}},"/documents/upload":{"get":{"tags":["documents"],"security":[{"ApiKeyAuth":[]}],"summary":"Get the link for upload a document","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUpload"}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}}}}},"/documents/upload/{id}":{"get":{"security":[{"ApiKeyAuth":[]}],"tags":["documents"],"summary":"Finish to upload the document. Call this method after sending file to uploadUrl","parameters":[{"in":"path","name":"id","required":true,"description":"Document id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}}}}},"/photos/upload":{"get":{"tags":["photos"],"security":[{"ApiKeyAuth":[]}],"summary":"Preparing to upload photos -- get photo id","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}}}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}}}}},"/photos/{id}":{"put":{"tags":["photos"],"security":[{"ApiKeyAuth":[]}],"summary":"Upload a photo","requestBody":{"content":{"image/*":{"schema":{"format":"binary"}}}},"parameters":[{"in":"path","name":"id","required":true,"description":"Photo id (returned by /photos/upload method)","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Photo"}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}},"404":{"description":"Photo not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["photos"],"summary":"Get info about the photo","parameters":[{"in":"path","name":"id","required":true,"description":"Photo id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Photo"}}}},"404":{"description":"Photo not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dictionary":{"get":{"tags":["dictionary"],"summary":"Get all dictianories (languages, provinces, cities, categories)","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"object","properties":{"provinces":{"type":"array","items":{"$ref":"#/components/schemas/Province"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"cities":{"type":"array","items":{"$ref":"#/components/schemas/City"}},"languages":{"type":"array","items":{"$ref":"#/components/schemas/Language"}}}}}}}}}},"/dictionary/languages":{"get":{"tags":["dictionary"],"summary":"Get a list of available languages","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Language"}}}}}}}},"/dictionary/cities":{"get":{"tags":["dictionary"],"summary":"Get a list of available cities","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/City"}}}}}}}},"/dictionary/categories":{"get":{"tags":["dictionary"],"summary":"Get a list of available cities","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}}}}}},"/dictionary/provinces":{"get":{"tags":["dictionary"],"summary":"Get a list of available provincies","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Province"}}}}}}}},"/dreams":{"get":{"tags":["dream"],"summary":"Find dreams","parameters":[{"in":"query","name":"categories","description":"Filter by category, categories ids separated by comma","schema":{"type":"string"}},{"in":"query","name":"page","description":"Page number","schema":{"type":"integer"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Dream"}}}}}}},"post":{"security":[{"ApiKeyAuth":[]}],"tags":["dream"],"summary":"Create a dream","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"name":{"type":"string"},"infoAboutYourself":{"type":"string"},"infoAboutDream":{"type":"string"},"price":{"type":"integer","description":"Количество требуемых денег в сотых долях CAD"},"photos":{"type":"string","description":"photo ids separated by comma"},"city":{"type":"string","description":"City id"},"category":{"type":"string","description":"Category id"},"videos":{"type":"string","description":"YouTube video ids separated by comma (if you want only one then set one)"},"documents":{"type":"string","description":"document ids separated by comma"}},"required":["name","infoAboutYourself","infoAboutDream","price","city","category"]}}}},"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dream"}}}},"401":{"description":"Unauthorised","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/responses/Unauthorised"},{"$ref":"#/components/responses/TokenNotExist"}]}}}}}}},"/dreams/{id}":{"get":{"tags":["dream"],"summary":"Get a dream","parameters":[{"in":"path","name":"id","required":true,"description":"Dream id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dream"}}}},"404":{"description":"Dream not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dreams/generate":{"get":{"tags":["dream","developers"],"summary":"Generate random dream","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dream"}}}}}}},"/dreams/byIds":{"get":{"tags":["dream"],"summary":"Get dreams by their ids","parameters":[{"in":"query","name":"ids","description":"Dream ids separated by comma","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Dream"}}}}}}}},"/user/byIds":{"get":{"tags":["user","Новые"],"summary":"Get users by their ids","parameters":[{"in":"query","name":"ids","description":"Dream ids separated by comma","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}}}}},"/dreams/my":{"get":{"security":[{"ApiKeyAuth":[]}],"tags":["dream"],"summary":"Get current user's dreams","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Dream"}}}}}}}},"/dreams/{id}/donate":{"post":{"security":[{"ApiKeyAuth":[]}],"tags":["dream","Новые"],"summary":"Add donate to the dream","parameters":[{"in":"path","name":"id","required":true,"description":"Dream id","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"donate":{"type":"integer","description":"Размер доната в сотых долях CAD"}},"required":["donate"]}}}},"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dream"}}}}}}},"/dreams/{id}/like":{"put":{"security":[{"ApiKeyAuth":[]}],"tags":["dream","Новые"],"summary":"Add like to the dream","parameters":[{"in":"path","name":"id","required":true,"description":"Dream id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dream"}}}}}},"delete":{"security":[{"ApiKeyAuth":[]}],"tags":["dream","Новые"],"summary":"Remove like from the dream","parameters":[{"in":"path","name":"id","required":true,"description":"Dream id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dream"}}}}}}},"/user":{"get":{"security":[{"ApiKeyAuth":[]}],"tags":["user"],"summary":"Get current user","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}}},"/user/photo":{"put":{"security":[{"ApiKeyAuth":[]}],"tags":["user"],"summary":"Set user photo","parameters":[{"name":"photoId","in":"query","required":true,"schema":{"type":"string"},"description":"Photo id. Photo has to be uploaded using /photos methods"}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}},"delete":{"security":[{"ApiKeyAuth":[]}],"tags":["user"],"summary":"Remove user photo","responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}}},"/user/favorites/{id}":{"post":{"security":[{"ApiKeyAuth":[]}],"tags":["user"],"summary":"Add a dream to favorites","parameters":[{"in":"path","name":"id","required":true,"description":"Dream id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}},"delete":{"security":[{"ApiKeyAuth":[]}],"tags":["user"],"summary":"Remove a dream from favorites","parameters":[{"in":"path","name":"id","required":true,"description":"Dream id","schema":{"type":"string"}}],"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}}},"/payment/createPaymentIntent":{"post":{"security":[{"ApiKeyAuth":[]}],"tags":["payment","Новые"],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"donate":{"type":"integer","description":"Размер доната в сотых долях CAD"},"dreamId":{"type":"string","description":"id мечты"}},"required":["donate","dreamId"]}}}},"responses":{"200":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentIntent"}}}}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"accessToken"}},"responses":{"TokenNotExist":{"description":"Access token has expired or don't exist, errorCode=5","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"IncorrectPassword":{"description":"Incorrect password, errorCode=6","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorised":{"description":"You must provide 'accessToken' header, errorCode=8","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"User":{"type":"object","required":["id","firstName","lastName"],"properties":{"id":{"type":"string","example":"5eaef9ae44376b5063e3dea6"},"firstName":{"type":"string","example":"John"},"lastName":{"type":"string","example":"Anderson"},"photos":{"type":"array","items":{"$ref":"#/components/schemas/Photo"}},"favorites":{"type":"array","items":{"type":"string","description":"Dream id"}}}},"Access":{"type":"object","properties":{"accessToken":{"type":"string"},"expire":{"type":"integer","example":1588593127788,"description":"Unix time in milliseconds"}}},"Register":{"type":"object","properties":{"emailSent":{"type":"boolean","description":"Whether the letter was sent successfully or not."},"user":{"$ref":"#/components/schemas/User"},"access":{"$ref":"#/components/schemas/Access"}}},"Completable":{"type":"boolean"},"Error":{"type":"object","properties":{"errorCode":{"type":"integer"},"errorMessage":{"type":"string"},"debugData":{"type":"object","description":"Debug data, only for development"}},"required":["errorCode","errorMessage"]},"DocumentUpload":{"type":"object","properties":{"id":{"type":"string","description":"Identificator of the document that will be used for accessing to it"},"uploadUrl":{"type":"string","description":"url to which the file will need to be loaded using the PUT method"},"type":{"type":"string","description":"Document type","example":"pdf"}}},"Document":{"type":"object","properties":{"id":{"type":"string","description":"Identificator of the document"},"url":{"type":"string"},"type":{"type":"string","description":"Document type","example":"pdf"}}},"Photo":{"type":"object","properties":{"id":{"type":"string","description":"Identificator of the photo"},"sizes":{"$ref":"#/components/schemas/PhotoSizes"}}},"PhotoSizes":{"type":"object","properties":{"orig":{"type":"string","description":"url of photo in original size","example":"https://9thplanet.s3.ca-central-1.amazonaws.com/users/5eb19b7814c7595e39d24b12/photos/5eb5be345dffb828078c706f/orig.jpeg"},"medium":{"type":"string","description":"url of photo whose size is limited 700px","example":"https://9thplanet.s3.ca-central-1.amazonaws.com/users/5eb19b7814c7595e39d24b12/photos/5eb5be345dffb828078c706f/medium.jpeg"},"small":{"type":"string","description":"url of small photo, width is not more than 200px, height not more than 500px","example":"https://9thplanet.s3.ca-central-1.amazonaws.com/users/5eb19b7814c7595e39d24b12/photos/5eb5be345dffb828078c706f/small.jpeg"}}},"Language":{"type":"object","properties":{"codeIso":{"type":"string","example":"en-gb","description":"ISO 639-1 language code"},"fullName":{"type":"string","example":"English (United Kingdom)"},"shortName":{"type":"string","example":"English UK"},"flag":{"type":"string","example":"\uD83C\uDDEC\uD83C\uDDE7","description":"emoji flag code"},"svg":{"type":"string","description":"svg flag content"}}},"City":{"type":"object","properties":{"id":{"type":"string","example":"Calgary","description":"This is the city id. Don't show this to users."},"provinceId":{"type":"string","example":"ab","description":"Id of the province; you can get the list of provinces using /dictionaries/provinces"},"names":{"type":"object","properties":{"en-us":{"type":"string","description":"City name written in 'en-us' language","example":"Calgary"}}}}},"Province":{"type":"object","properties":{"id":{"type":"string","example":"ab","description":"ProvinceId"},"names":{"type":"object","properties":{"en-us":{"type":"string","description":"Province name 'en-us' language","example":"Alberta"}}}}},"Category":{"type":"object","properties":{"key":{"type":"string","example":"technology","description":"ProvinceId"},"details":{"type":"array","items":{"type":"object","properties":{"langIso":{"type":"string","example":"en-us"},"name":{"type":"string","example":"Technology"}}}}}},"PaymentIntent":{"type":"object","properties":{"secret":{"type":"string","example":"pi_1HQgVpHFUELd0t0A3Z7Dt2Bl_secret_blablaB","description":"client secret, который должен использоваться для платежа, см. https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret"},"fullPrice":{"type":"integer","description":"полная стоимость -- количество денег, которые будут списаны (в сотых долях CAD)"},"donate":{"type":"integer","description":"Количество денег в сотых долях CAD, которые будут начислены пользователю в мечту"}}},"Dream":{"type":"object","properties":{"name":{"type":"string","description":"Имя мечты"},"id":{"type":"string","example":"5ec9972b8f44d94daffb17c0"},"userId":{"type":"string","example":"5eb19b7814c7595e39d24b12"},"price":{"type":"integer","description":"Количество требуемых денег в сотых долях CAD","example":10000},"money":{"type":"integer","description":"Количество собранных денег в сотых долях CAD"},"langIso":{"type":"string","example":"en-us"},"created":{"type":"integer","example":1590269739950},"expirationTime":{"type":"integer","example":1591594539950},"infoAboutYourself":{"type":"string"},"infoAboutDream":{"type":"string"},"photos":{"type":"array","items":{"$ref":"#/components/schemas/Photo"}},"documents":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"videos":{"type":"array","items":{"type":"string","description":"id video on YouTube; see https://www.w3schools.com/html/html_youtube.asp"}},"categoryId":{"type":"string"},"city":{"$ref":"#/components/schemas/City"},"published":{"type":"boolean","description":"Is this dream in  public access or not"},"checked":{"type":"boolean","description":"Is this dream was checked by moderator or not"},"likesCount":{"type":"integer"},"likes":{"type":"array","description":"список лайкнувших пользователей","items":{"type":"string"}},"donatesCount":{"type":"integer","description":"количество донатов"},"isInFavorites":{"type":"boolean","description":"если передать accessToken, то данный флаг будет означать, добавлена ли мечта в избранное у текущего пользователя"},"dreamStatus":{"type":"string","enum":["ACTIVE","PROLONGED","EXPIRED"]}}}}}}