Skip to content

Commit 0528c45

Browse files
committed
brk: Rework the account/settings endpoint
This is a proposal for how the new endpoints will look. Please review and comment here so I can implement.
1 parent aae4890 commit 0528c45

File tree

3 files changed

+70
-52
lines changed

3 files changed

+70
-52
lines changed

src/data/endpoints/account.yaml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,26 @@ description: >
55
Account endpoints provide a means of manipulating your account, including users,
66
OAuth Clients and Tokens, and Events.
77
endpoints:
8-
/account/settings:
9-
group: Settings
8+
/account:
109
type: resource
1110
description: >
12-
Manage your account settings.
11+
Managed account contact and billing information.
1312
methods:
1413
GET:
1514
response: account
1615
description: >
1716
Returns your account settings.
1817
examples:
1918
curl: |
20-
curl https://$api_root/$version/account/settings
21-
python: |
22-
my_settings = client.account.get_settings()
19+
curl -h "Authorization: Bearer $TOKEN" \
20+
https://$api_root/$version/account
2321
PUT:
2422
description: >
2523
Edits your account settings.
2624
examples:
2725
curl: |
28-
curl -H "Content-Type: application/json" \
29-
-H "Authorization: Bearer $TOKEN" \
26+
curl -h "content-type: application/json" \
27+
-h "authorization: bearer $token" \
3028
-X PUT -d '{
3129
"address_1": "123 Main St.",
3230
"address_2": "Suite 101",
@@ -36,23 +34,39 @@ endpoints:
3634
"email": "[email protected]",
3735
"first_name": "John",
3836
"last_name": "Smith",
39-
"network_helper": true,
4037
"phone": "555-555-1212",
4138
"state": "PA",
4239
"zip": 19102,
40+
}
41+
}' \
42+
https://$api_root/$version/account
43+
/account/settings:
44+
group: Settings
45+
type: resource
46+
description: >
47+
Manage default settings for your account.
48+
methods:
49+
GET:
50+
response: account_settings
51+
description: >
52+
Returns your current defaults.
53+
examples:
54+
curl: |
55+
curl -h "Authorization: Bearer $TOKEN" \
56+
https://$api_root/$version/account/settings
57+
PUT:
58+
description: >
59+
Edits your account's defaults.
60+
examples:
61+
curl: |
62+
curl -h "Content-Type: application/json" \
63+
-h "Authorization: Bearer $TOKEn" \
64+
-X PUT -d '{
65+
"network_helper": true,
4366
"longview_subscription": "longview-10"
4467
}
4568
}' \
4669
https://$api_root/$version/account/settings
47-
python: |
48-
my_settings = client.account.get_settings()
49-
my_settings.address_1 = '123 Main St.'
50-
my_settings.address_2 = 'Suite 101'
51-
my_settings.city = 'Philadelphia'
52-
my_settings.company = 'My Company, LLC'
53-
my_settings.country = 'US'
54-
my_settings.email = '[email protected]'
55-
my_settings.save()
5670
/account/oauth-clients:
5771
group: OAuth Clients
5872
authenticated: true

src/data/objects/account.yaml

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
# vim: set et ts=2 sw=2 tw=80 :
21
name: Account
3-
prefix: account/settings
2+
prefix: account
43
description: >
5-
A representation of account settings.
4+
Your account contact and billing information.
65
schema:
6+
first_name:
7+
type: String
8+
description: This account holder's first name.
9+
value: John
10+
last_name:
11+
type: String
12+
description: This account holder's last name.
13+
value: Smith
14+
company:
15+
type: String
16+
description: This account's company name.
17+
value: My Company LLC
718
address_1:
819
type: String
920
description: First line of this account's billing address.
@@ -16,10 +27,14 @@ schema:
1627
type: String
1728
description: City portion of this account's billing address.
1829
value: Philadelphia
19-
company:
30+
state:
2031
type: String
21-
description: This account's company name.
22-
value: My Company LLC
32+
description: State (or province) portion of this account's billing address.
33+
value: PA
34+
zip:
35+
type: String
36+
description: Zip Code portion of this account's billing address.
37+
value: 19102
2338
country:
2439
type: String
2540
description: Country portion of this account's billing address.
@@ -28,41 +43,17 @@ schema:
2843
type: String
2944
description: Email address associated with the account.
3045
31-
first_name:
32-
type: String
33-
description: This account holder's first name.
34-
value: John
35-
last_name:
36-
type: String
37-
description: This account holder's last name.
38-
value: Smith
39-
network_helper:
40-
type: Boolean
41-
description: Enables network helper by default across all users.
42-
value: true
4346
phone:
4447
type: String
4548
description: Phone number associated with the account. Required format is 123-456-7890.
4649
value: 555-555-1212
47-
state:
48-
type: String
49-
description: State (or province) portion of this account's billing address.
50-
value: PA
51-
zip:
52-
type: String
53-
description: Zip Code portion of this account's billing address.
54-
value: 19102
55-
balance:
56-
type: Float
57-
description: This account's balance (in US Dollars).
58-
value: 0.00
59-
longview_subscription:
60-
type: String
61-
description: The Longview Pro tier you are currently subscribed to.
62-
value: null
6350
vat_number:
6451
type: String
6552
value: null
6653
description: >
6754
Your VAT identification number, for tax calculations in some countries. If
6855
you do not live in a country that collects VAT, this should be null.
56+
balance:
57+
type: Float
58+
description: This account's balance (in US Dollars).
59+
value: 0.00
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Account
2+
prefix: account/settings
3+
description: >
4+
A representation of account settings.
5+
schema:
6+
network_helper:
7+
type: Boolean
8+
description: Enables network helper by default across all users.
9+
value: true
10+
longview_subscription:
11+
type: String
12+
description: The Longview Pro tier you are currently subscribed to.
13+
value: null

0 commit comments

Comments
 (0)