Skip to content

Commit d559fd1

Browse files
author
Kristel
committed
release v2.2025.02.03.0
1 parent fbf1c1c commit d559fd1

File tree

2 files changed

+242
-3
lines changed

2 files changed

+242
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package tadoclient.apis
2+
3+
import org.junit.jupiter.api.DisplayName
4+
import org.junit.jupiter.api.MethodOrderer
5+
import org.junit.jupiter.api.Order
6+
import org.junit.jupiter.api.TestMethodOrder
7+
import org.junit.jupiter.api.condition.EnabledIf
8+
import org.springframework.beans.factory.annotation.Autowired
9+
import org.springframework.beans.factory.annotation.Qualifier
10+
import org.springframework.boot.test.context.SpringBootTest
11+
import org.springframework.web.client.RestClient
12+
import tadoclient.Application
13+
import tadoclient.TadoConfig
14+
import tadoclient.verify.assertCorrectResponse
15+
import tadoclient.verify.verifyUser
16+
import kotlin.test.Test
17+
import kotlin.test.assertNotEquals
18+
19+
@SpringBootTest(classes = arrayOf( Application::class))
20+
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
21+
@DisplayName("tado API - user")
22+
class UserApi_IT (
23+
// rest client to use when not testing an API method
24+
@Qualifier("tadoRestClient")
25+
val tadoRestClient: RestClient,
26+
27+
// rest client to use when testing an API method,
28+
// this one is strict as it throws an exception when it receives an unknown JSON property
29+
@Qualifier("tadoStrictRestClient")
30+
val tadoStrictRestClient: RestClient,
31+
32+
@Autowired
33+
tadoConfig: TadoConfig
34+
) : BaseTest(tadoConfig) {
35+
val tadoStrictUserAPI = UserApi(tadoStrictRestClient)
36+
37+
@Test
38+
@DisplayName("GET /me")
39+
@Order(10)
40+
fun getMe() {
41+
val endpoint = "GET /me"
42+
val user = assertCorrectResponse { tadoStrictUserAPI.getMe() }
43+
verifyUser(user, endpoint)
44+
}
45+
46+
@Test
47+
@DisplayName("GET /homes/{homeId}/users")
48+
@Order(20)
49+
@EnabledIf(value = "isHomeConfigured", disabledReason = "no home specified in tado set-up")
50+
fun getUsers() {
51+
val endpoint = "GET /homes/{homeId}/users"
52+
val users = assertCorrectResponse { tadoStrictUserAPI.getUsers(tadoConfig.home!!.id) }
53+
54+
// check users
55+
assertNotEquals(0, users.size)
56+
users.forEachIndexed{i, elem -> verifyUser(elem, endpoint, "response[$i]")}
57+
}
58+
}

tado-openapispec-v2.yaml

+184-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ info:
3131
[https://github.com/kritsel/tado-openapispec-v2](https://github.com/kritsel/tado-openapispec-v2)
3232
* Wiki for this GitHub repo with additional information:
3333
[https://github.com/kritsel/tado-openapispec-v2/wiki](https://github.com/kritsel/tado-openapispec-v2/wiki/)
34-
version: 2.2025.02.02.1
34+
version: 2.2025.02.03.0
3535
servers:
3636
- url: https://my.tado.com/api/v2/
3737
security:
@@ -2767,6 +2767,121 @@ paths:
27672767
'404':
27682768
$ref: '#/components/responses/NotFound404'
27692769

2770+
####################################################################################################################
2771+
# invitation paths
2772+
/homes/{homeId}/invitations:
2773+
get:
2774+
summary: Get all pending invitations.
2775+
operationId: getInvitations # hint for client code generators
2776+
tags:
2777+
- invitation
2778+
parameters:
2779+
- in: path
2780+
name: homeId
2781+
schema:
2782+
$ref: '#/components/schemas/HomeId'
2783+
required: true
2784+
description: unique ID of a home the authenticated user has access to
2785+
responses:
2786+
'200':
2787+
description: successful response
2788+
content:
2789+
application/json:
2790+
schema:
2791+
type: array
2792+
items:
2793+
$ref: '#/components/schemas/Invitation'
2794+
'401':
2795+
$ref: '#/components/responses/Unauthorized401'
2796+
'403':
2797+
$ref: '#/components/responses/AccessDenied403'
2798+
post:
2799+
summary: Send an invitation
2800+
operationId: sendInvitation # hint for client code generators
2801+
tags:
2802+
- invitation
2803+
parameters:
2804+
- in: path
2805+
name: homeId
2806+
schema:
2807+
$ref: '#/components/schemas/HomeId'
2808+
required: true
2809+
description: unique ID of a home the authenticated user has access to
2810+
requestBody:
2811+
required: true
2812+
content:
2813+
application/json:
2814+
schema:
2815+
$ref: '#/components/schemas/InvitationRequest'
2816+
responses:
2817+
'200':
2818+
description: successful response
2819+
content:
2820+
application/json:
2821+
schema:
2822+
$ref: '#/components/schemas/Invitation'
2823+
'401':
2824+
$ref: '#/components/responses/Unauthorized401'
2825+
'403':
2826+
$ref: '#/components/responses/AccessDenied403'
2827+
2828+
/homes/{homeId}/invitations/{invitationToken}:
2829+
delete:
2830+
summary: Revoke an invitation
2831+
operationId: revokeInvitation # hint for client code generators
2832+
tags:
2833+
- invitation
2834+
parameters:
2835+
- in: path
2836+
name: homeId
2837+
schema:
2838+
$ref: '#/components/schemas/HomeId'
2839+
required: true
2840+
description: unique ID of a home the authenticated user has access to
2841+
- in: path
2842+
name: invitationToken
2843+
schema:
2844+
$ref: '#/components/schemas/InvitationToken'
2845+
required: true
2846+
description: unique token of the invitation
2847+
responses:
2848+
'204':
2849+
description: successful response
2850+
'401':
2851+
$ref: '#/components/responses/Unauthorized401'
2852+
'403':
2853+
$ref: '#/components/responses/AccessDenied403'
2854+
'404':
2855+
$ref: '#/components/responses/NotFound404'
2856+
2857+
/homes/{homeId}/invitations/{invitationToken}/resend:
2858+
post:
2859+
summary: Resend an invitation
2860+
operationId: resendInvitation # hint for client code generators
2861+
tags:
2862+
- invitation
2863+
parameters:
2864+
- in: path
2865+
name: homeId
2866+
schema:
2867+
$ref: '#/components/schemas/HomeId'
2868+
required: true
2869+
description: unique ID of a home the authenticated user has access to
2870+
- in: path
2871+
name: invitationToken
2872+
schema:
2873+
$ref: '#/components/schemas/InvitationToken'
2874+
required: true
2875+
description: unique token of the invitation to resend
2876+
responses:
2877+
'204':
2878+
description: successful response
2879+
'401':
2880+
$ref: '#/components/responses/Unauthorized401'
2881+
'403':
2882+
$ref: '#/components/responses/AccessDenied403'
2883+
'404':
2884+
$ref: '#/components/responses/NotFound404'
27702885

27712886
components:
27722887
securitySchemes:
@@ -2941,6 +3056,7 @@ components:
29413056
awayRadiusInMeters:
29423057
type: number
29433058
format: float
3059+
example: 400
29443060

29453061
# BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
29463062
BatteryState:
@@ -3607,7 +3723,8 @@ components:
36073723
type: boolean
36083724
example: true
36093725
awayRadiusInMeters:
3610-
type: integer
3726+
type: number
3727+
format: float
36113728
example: 400
36123729
installationCompleted:
36133730
type: boolean
@@ -3901,6 +4018,67 @@ components:
39014018
example: 0
39024019
description: ID of an (AC) installation (unique only within the home it belongs to)
39034020

4021+
Invitation:
4022+
type: object
4023+
properties:
4024+
token:
4025+
$ref: '#/components/schemas/InvitationToken'
4026+
email:
4027+
type: string
4028+
format: email
4029+
4030+
firstSent:
4031+
type: string
4032+
format: date
4033+
example: "2025-02-03T18:44:14.658Z"
4034+
lastSent:
4035+
type: string
4036+
format: date
4037+
example: "2025-02-03T18:44:14.658Z"
4038+
inviter:
4039+
type: object
4040+
properties:
4041+
name:
4042+
type: string
4043+
example: "Jane Doe"
4044+
email:
4045+
type: string
4046+
format: email
4047+
example: "[email protected]"
4048+
username:
4049+
type: string
4050+
enabled:
4051+
type: boolean
4052+
example: true
4053+
id:
4054+
type: string
4055+
format: uuid
4056+
example: "a7c7fc08-e362-4700-e9a1-45a5bded5c124"
4057+
description: "globally unique user ID"
4058+
homeId:
4059+
$ref: '#/components/schemas/HomeId'
4060+
locale:
4061+
type: string
4062+
example: en
4063+
type:
4064+
type: string
4065+
example: "WEB_USER"
4066+
home:
4067+
$ref: '#/components/schemas/Home'
4068+
4069+
InvitationToken:
4070+
type: string
4071+
example: "adc17324216348e287318e8ae1f390fd"
4072+
description: "hexadecimal unique invitation identifier"
4073+
4074+
InvitationRequest:
4075+
type: object
4076+
description: input for POST /homes/{homeId}/invitations
4077+
properties:
4078+
email:
4079+
type: string
4080+
format: email
4081+
39044082
# LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
39054083
Light:
39064084
type: string
@@ -5041,4 +5219,7 @@ tags:
50415219
which have the tado app installed to control a home. **[ ✓ tado X]**
50425220
- name: report
50435221
description:
5044-
Data reports. **[ ✓ tado X]**
5222+
Data reports. **[ ✓ tado X]**
5223+
- name: invitation
5224+
description:
5225+
Manage invitations. **[ ✓ tado X]**

0 commit comments

Comments
 (0)