Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitae35620

Browse files
authored
chore: update API routes to use /api/v0 (#222)
1 parentc38df0b commitae35620

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

‎coder-sdk/devurl.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type delDevURLRequest struct {
2323

2424
// DeleteDevURL deletes the specified devurl.
2525
func (cClient)DeleteDevURL(ctx context.Context,envID,urlIDstring)error {
26-
reqURL:=fmt.Sprintf("/api/private/environments/%s/devurls/%s",envID,urlID)
26+
reqURL:=fmt.Sprintf("/api/v0/environments/%s/devurls/%s",envID,urlID)
2727

2828
returnc.requestBody(ctx,http.MethodDelete,reqURL,delDevURLRequest{
2929
EnvID:envID,
@@ -42,13 +42,13 @@ type CreateDevURLReq struct {
4242

4343
// CreateDevURL inserts a new devurl for the authenticated user.
4444
func (cClient)CreateDevURL(ctx context.Context,envIDstring,reqCreateDevURLReq)error {
45-
returnc.requestBody(ctx,http.MethodPost,"/api/private/environments/"+envID+"/devurls",req,nil)
45+
returnc.requestBody(ctx,http.MethodPost,"/api/v0/environments/"+envID+"/devurls",req,nil)
4646
}
4747

4848
// DevURLs fetches the Dev URLs for a given environment.
4949
func (cClient)DevURLs(ctx context.Context,envIDstring) ([]DevURL,error) {
5050
vardevurls []DevURL
51-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/environments/"+envID+"/devurls",nil,&devurls);err!=nil {
51+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/environments/"+envID+"/devurls",nil,&devurls);err!=nil {
5252
returnnil,err
5353
}
5454
returndevurls,nil
@@ -59,5 +59,5 @@ type PutDevURLReq CreateDevURLReq
5959

6060
// PutDevURL updates an existing devurl for the authenticated user.
6161
func (cClient)PutDevURL(ctx context.Context,envID,urlIDstring,reqPutDevURLReq)error {
62-
returnc.requestBody(ctx,http.MethodPut,"/api/private/environments/"+envID+"/devurls/"+urlID,req,nil)
62+
returnc.requestBody(ctx,http.MethodPut,"/api/v0/environments/"+envID+"/devurls/"+urlID,req,nil)
6363
}

‎coder-sdk/env.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (c Client) CreateEnvironment(ctx context.Context, req CreateEnvironmentRequ
9898
// TODO: add the filter options, explore performance issue.
9999
func (cClient)Environments(ctx context.Context) ([]Environment,error) {
100100
varenvs []Environment
101-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/environments",nil,&envs);err!=nil {
101+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/environments",nil,&envs);err!=nil {
102102
returnnil,err
103103
}
104104
returnenvs,nil
@@ -122,12 +122,12 @@ func (c Client) UserEnvironmentsByOrganization(ctx context.Context, userID, orgI
122122

123123
// DeleteEnvironment deletes the environment.
124124
func (cClient)DeleteEnvironment(ctx context.Context,envIDstring)error {
125-
returnc.requestBody(ctx,http.MethodDelete,"/api/private/environments/"+envID,nil,nil)
125+
returnc.requestBody(ctx,http.MethodDelete,"/api/v0/environments/"+envID,nil,nil)
126126
}
127127

128128
// StopEnvironment stops the stops.
129129
func (cClient)StopEnvironment(ctx context.Context,envIDstring)error {
130-
returnc.requestBody(ctx,http.MethodPut,"/api/private/environments/"+envID+"/stop",nil,nil)
130+
returnc.requestBody(ctx,http.MethodPut,"/api/v0/environments/"+envID+"/stop",nil,nil)
131131
}
132132

133133
// UpdateEnvironmentReq defines the update operation, only setting
@@ -145,12 +145,12 @@ type UpdateEnvironmentReq struct {
145145

146146
// RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification.
147147
func (cClient)RebuildEnvironment(ctx context.Context,envIDstring)error {
148-
returnc.requestBody(ctx,http.MethodPatch,"/api/private/environments/"+envID,UpdateEnvironmentReq{},nil)
148+
returnc.requestBody(ctx,http.MethodPatch,"/api/v0/environments/"+envID,UpdateEnvironmentReq{},nil)
149149
}
150150

151151
// EditEnvironment modifies the environment specification and initiates a rebuild.
152152
func (cClient)EditEnvironment(ctx context.Context,envIDstring,reqUpdateEnvironmentReq)error {
153-
returnc.requestBody(ctx,http.MethodPatch,"/api/private/environments/"+envID,req,nil)
153+
returnc.requestBody(ctx,http.MethodPatch,"/api/v0/environments/"+envID,req,nil)
154154
}
155155

156156
// DialWsep dials an environments command execution interface

‎coder-sdk/org.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (c Client) OrganizationByID(ctx context.Context, orgID string) (*Organizati
5858
// OrganizationMembers get all members of the given organization.
5959
func (cClient)OrganizationMembers(ctx context.Context,orgIDstring) ([]OrganizationUser,error) {
6060
varmembers []OrganizationUser
61-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/orgs/"+orgID+"/members",nil,&members);err!=nil {
61+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/orgs/"+orgID+"/members",nil,&members);err!=nil {
6262
returnnil,err
6363
}
6464
returnmembers,nil
@@ -76,7 +76,7 @@ type UpdateOrganizationReq struct {
7676

7777
// UpdateOrganization applys a partial update of an Organization resource.
7878
func (cClient)UpdateOrganization(ctx context.Context,orgIDstring,reqUpdateOrganizationReq)error {
79-
returnc.requestBody(ctx,http.MethodPatch,"/api/private/orgs/"+orgID,req,nil)
79+
returnc.requestBody(ctx,http.MethodPatch,"/api/v0/orgs/"+orgID,req,nil)
8080
}
8181

8282
// CreateOrganizationReq describes the request parameters to create a new Organization.
@@ -92,10 +92,10 @@ type CreateOrganizationReq struct {
9292

9393
// CreateOrganization creates a new Organization in Coder Enterprise.
9494
func (cClient)CreateOrganization(ctx context.Context,reqCreateOrganizationReq)error {
95-
returnc.requestBody(ctx,http.MethodPost,"/api/private/orgs",req,nil)
95+
returnc.requestBody(ctx,http.MethodPost,"/api/v0/orgs",req,nil)
9696
}
9797

9898
// DeleteOrganization deletes an organization.
9999
func (cClient)DeleteOrganization(ctx context.Context,orgIDstring)error {
100-
returnc.requestBody(ctx,http.MethodDelete,"/api/private/orgs/"+orgID,nil,nil)
100+
returnc.requestBody(ctx,http.MethodDelete,"/api/v0/orgs/"+orgID,nil,nil)
101101
}

‎coder-sdk/tags.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ type CreateImageTagReq struct {
4242
// CreateImageTag creates a new image tag resource.
4343
func (cClient)CreateImageTag(ctx context.Context,imageIDstring,reqCreateImageTagReq) (*ImageTag,error) {
4444
vartagImageTag
45-
iferr:=c.requestBody(ctx,http.MethodPost,"/api/private/images/"+imageID+"/tags",req,tag);err!=nil {
45+
iferr:=c.requestBody(ctx,http.MethodPost,"/api/v0/images/"+imageID+"/tags",req,tag);err!=nil {
4646
returnnil,err
4747
}
4848
return&tag,nil
4949
}
5050

5151
// DeleteImageTag deletes an image tag resource.
5252
func (cClient)DeleteImageTag(ctx context.Context,imageID,tagstring)error {
53-
returnc.requestBody(ctx,http.MethodDelete,"/api/private/images/"+imageID+"/tags/"+tag,nil,nil)
53+
returnc.requestBody(ctx,http.MethodDelete,"/api/v0/images/"+imageID+"/tags/"+tag,nil,nil)
5454
}
5555

5656
// ImageTags fetch all image tags.
5757
func (cClient)ImageTags(ctx context.Context,imageIDstring) ([]ImageTag,error) {
5858
vartags []ImageTag
59-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/images/"+imageID+"/tags",nil,&tags);err!=nil {
59+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/images/"+imageID+"/tags",nil,&tags);err!=nil {
6060
returnnil,err
6161
}
6262
returntags,nil
@@ -65,7 +65,7 @@ func (c Client) ImageTags(ctx context.Context, imageID string) ([]ImageTag, erro
6565
// ImageTagByID fetch an image tag by ID.
6666
func (cClient)ImageTagByID(ctx context.Context,imageID,tagIDstring) (*ImageTag,error) {
6767
vartagImageTag
68-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/images/"+imageID+"/tags/"+tagID,nil,&tag);err!=nil {
68+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/images/"+imageID+"/tags/"+tagID,nil,&tag);err!=nil {
6969
returnnil,err
7070
}
7171
return&tag,nil

‎coder-sdk/tokens.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type createAPITokenResp struct {
2727
// CreateAPIToken creates a new APIToken for making authenticated requests to Coder Enterprise.
2828
func (cClient)CreateAPIToken(ctx context.Context,userIDstring,reqCreateAPITokenReq) (tokenstring,_error) {
2929
varrespcreateAPITokenResp
30-
err:=c.requestBody(ctx,http.MethodPost,"/api/private/api-keys/"+userID,req,&resp)
30+
err:=c.requestBody(ctx,http.MethodPost,"/api/v0/api-keys/"+userID,req,&resp)
3131
iferr!=nil {
3232
return"",err
3333
}
@@ -37,7 +37,7 @@ func (c Client) CreateAPIToken(ctx context.Context, userID string, req CreateAPI
3737
// APITokens fetches all APITokens owned by the given user.
3838
func (cClient)APITokens(ctx context.Context,userIDstring) ([]APIToken,error) {
3939
vartokens []APIToken
40-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/api-keys/"+userID,nil,&tokens);err!=nil {
40+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/api-keys/"+userID,nil,&tokens);err!=nil {
4141
returnnil,err
4242
}
4343
returntokens,nil
@@ -46,21 +46,21 @@ func (c Client) APITokens(ctx context.Context, userID string) ([]APIToken, error
4646
// APITokenByID fetches the metadata for a given APIToken.
4747
func (cClient)APITokenByID(ctx context.Context,userID,tokenIDstring) (*APIToken,error) {
4848
vartokenAPIToken
49-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/api-keys/"+userID+"/"+tokenID,nil,&token);err!=nil {
49+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/api-keys/"+userID+"/"+tokenID,nil,&token);err!=nil {
5050
returnnil,err
5151
}
5252
return&token,nil
5353
}
5454

5555
// DeleteAPIToken deletes an APIToken.
5656
func (cClient)DeleteAPIToken(ctx context.Context,userID,tokenIDstring)error {
57-
returnc.requestBody(ctx,http.MethodDelete,"/api/private/api-keys/"+userID+"/"+tokenID,nil,nil)
57+
returnc.requestBody(ctx,http.MethodDelete,"/api/v0/api-keys/"+userID+"/"+tokenID,nil,nil)
5858
}
5959

6060
// RegenerateAPIToken regenerates the given APIToken and returns the new value.
6161
func (cClient)RegenerateAPIToken(ctx context.Context,userID,tokenIDstring) (tokenstring,_error) {
6262
varrespcreateAPITokenResp
63-
iferr:=c.requestBody(ctx,http.MethodPost,"/api/private/api-keys/"+userID+"/"+tokenID+"/regen",nil,&resp);err!=nil {
63+
iferr:=c.requestBody(ctx,http.MethodPost,"/api/v0/api-keys/"+userID+"/"+tokenID+"/regen",nil,&resp);err!=nil {
6464
return"",err
6565
}
6666
returnresp.Key,nil

‎coder-sdk/users.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type SSHKey struct {
6464
// SSHKey gets the current SSH kepair of the authenticated user.
6565
func (cClient)SSHKey(ctx context.Context) (*SSHKey,error) {
6666
varkeySSHKey
67-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/users/me/sshkey",nil,&key);err!=nil {
67+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/users/me/sshkey",nil,&key);err!=nil {
6868
returnnil,err
6969
}
7070
return&key,nil
@@ -73,7 +73,7 @@ func (c Client) SSHKey(ctx context.Context) (*SSHKey, error) {
7373
// Users gets the list of user accounts.
7474
func (cClient)Users(ctx context.Context) ([]User,error) {
7575
varu []User
76-
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/users",nil,&u);err!=nil {
76+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/v0/users",nil,&u);err!=nil {
7777
returnnil,err
7878
}
7979
returnu,nil
@@ -111,7 +111,7 @@ type UpdateUserReq struct {
111111

112112
// UpdateUser applyes the partial update to the given user.
113113
func (cClient)UpdateUser(ctx context.Context,userIDstring,reqUpdateUserReq)error {
114-
returnc.requestBody(ctx,http.MethodPatch,"/api/private/users/"+userID,req,nil)
114+
returnc.requestBody(ctx,http.MethodPatch,"/api/v0/users/"+userID,req,nil)
115115
}
116116

117117
// UpdateUXState applies a partial update of the user's UX State.
@@ -135,10 +135,10 @@ type CreateUserReq struct {
135135

136136
// CreateUser creates a new user account.
137137
func (cClient)CreateUser(ctx context.Context,reqCreateUserReq)error {
138-
returnc.requestBody(ctx,http.MethodPost,"/api/private/users",req,nil)
138+
returnc.requestBody(ctx,http.MethodPost,"/api/v0/users",req,nil)
139139
}
140140

141141
// DeleteUser deletes a user account.
142142
func (cClient)DeleteUser(ctx context.Context,userIDstring)error {
143-
returnc.requestBody(ctx,http.MethodDelete,"/api/private/users/"+userID,nil,nil)
143+
returnc.requestBody(ctx,http.MethodDelete,"/api/v0/users/"+userID,nil,nil)
144144
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp