@@ -150,8 +150,8 @@ func (s *CodespacesService) List(ctx context.Context, opts *ListCodespacesOption
150150 return codespaces , resp , nil
151151}
152152
153- // CreateCodespaceOptions represents options for the creation of a codespace in a repository.
154- type CreateCodespaceOptions struct {
153+ // CreateCodespaceRequest represents a request to create a codespace in a repository.
154+ type CreateCodespaceRequest struct {
155155 Ref * string `json:"ref,omitempty"`
156156 // Geo represents the geographic area for this codespace.
157157 // If not specified, the value is assigned by IP.
@@ -212,11 +212,11 @@ type CodespacePullRequestOptions struct {
212212 RepositoryID int64 `json:"repository_id"`
213213}
214214
215- // CodespaceCreateForUserOptions represents options for creating a codespace for the authenticated user.
216- type CodespaceCreateForUserOptions struct {
217- PullRequest * CodespacePullRequestOptions `json:"pull_request"`
215+ // CreateCodespaceForUserRequest represents a request to create a codespace for the authenticated user.
216+ type CreateCodespaceForUserRequest struct {
217+ PullRequest * CodespacePullRequestOptions `json:"pull_request,omitempty "`
218218 // RepositoryID represents the repository ID for this codespace.
219- RepositoryID int64 `json:"repository_id"`
219+ RepositoryID * int64 `json:"repository_id,omitempty "`
220220 Ref * string `json:"ref,omitempty"`
221221 Geo * string `json:"geo,omitempty"`
222222 ClientIP * string `json:"client_ip,omitempty"`
@@ -230,10 +230,12 @@ type CodespaceCreateForUserOptions struct {
230230 DisplayName * string `json:"display_name,omitempty"`
231231}
232232
233- // UpdateCodespaceOptions represents options for updating a codespace.
234- type UpdateCodespaceOptions struct {
233+ // UpdateCodespaceRequest represents a request to update a codespace.
234+ type UpdateCodespaceRequest struct {
235235 // Machine represents a valid machine to transition this codespace to.
236236 Machine * string `json:"machine,omitempty"`
237+ // DisplayName represents the display name for this codespace.
238+ DisplayName * string `json:"display_name,omitempty"`
237239 // RecentFolders represents the recently opened folders inside the codespace.
238240 // It is currently used by the clients to determine the folder path to load the codespace in.
239241 RecentFolders []string `json:"recent_folders,omitempty"`
@@ -251,8 +253,8 @@ type CodespaceExport struct {
251253 HTMLURL * string `json:"html_url,omitempty"`
252254}
253255
254- // PublishCodespaceOptions represents options for creating a repository from an unpublished codespace.
255- type PublishCodespaceOptions struct {
256+ // PublishCodespaceRequest represents a request to create a repository from an unpublished codespace.
257+ type PublishCodespaceRequest struct {
256258 // Name represents the name of the new repository.
257259 Name * string `json:"name,omitempty"`
258260 // Private represents whether the new repository is private. Defaults to false.
@@ -273,7 +275,7 @@ type CodespacePermissions struct {
273275// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-in-a-repository
274276//
275277//meta:operation POST /repos/{owner}/{repo}/codespaces
276- func (s * CodespacesService ) CreateInRepo (ctx context.Context , owner , repo string , body * CreateCodespaceOptions ) (* Codespace , * Response , error ) {
278+ func (s * CodespacesService ) CreateInRepo (ctx context.Context , owner , repo string , body CreateCodespaceRequest ) (* Codespace , * Response , error ) {
277279 u := fmt .Sprintf ("repos/%v/%v/codespaces" , owner , repo )
278280 req , err := s .client .NewRequest (ctx , "POST" , u , body )
279281 if err != nil {
@@ -444,7 +446,7 @@ func (s *CodespacesService) CheckPermissions(ctx context.Context, owner, repo, r
444446// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-from-a-pull-request
445447//
446448//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces
447- func (s * CodespacesService ) CreateFromPullRequest (ctx context.Context , owner , repo string , pullNumber int , body * CreateCodespaceOptions ) (* Codespace , * Response , error ) {
449+ func (s * CodespacesService ) CreateFromPullRequest (ctx context.Context , owner , repo string , pullNumber int , body CreateCodespaceRequest ) (* Codespace , * Response , error ) {
448450 u := fmt .Sprintf ("repos/%v/%v/pulls/%v/codespaces" , owner , repo , pullNumber )
449451 req , err := s .client .NewRequest (ctx , "POST" , u , body )
450452 if err != nil {
@@ -462,12 +464,12 @@ func (s *CodespacesService) CreateFromPullRequest(ctx context.Context, owner, re
462464
463465// Create creates a new codespace, owned by the authenticated user.
464466//
465- // This method requires either RepositoryId OR a PullRequest but not both.
467+ // This method requires either RepositoryID or PullRequest to be set, but not both.
466468//
467469// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-for-the-authenticated-user
468470//
469471//meta:operation POST /user/codespaces
470- func (s * CodespacesService ) Create (ctx context.Context , body * CodespaceCreateForUserOptions ) (* Codespace , * Response , error ) {
472+ func (s * CodespacesService ) Create (ctx context.Context , body CreateCodespaceForUserRequest ) (* Codespace , * Response , error ) {
471473 u := "user/codespaces"
472474 req , err := s .client .NewRequest (ctx , "POST" , u , body )
473475 if err != nil {
@@ -511,7 +513,7 @@ func (s *CodespacesService) Get(ctx context.Context, codespaceName string) (*Cod
511513// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#update-a-codespace-for-the-authenticated-user
512514//
513515//meta:operation PATCH /user/codespaces/{codespace_name}
514- func (s * CodespacesService ) Update (ctx context.Context , codespaceName string , body * UpdateCodespaceOptions ) (* Codespace , * Response , error ) {
516+ func (s * CodespacesService ) Update (ctx context.Context , codespaceName string , body UpdateCodespaceRequest ) (* Codespace , * Response , error ) {
515517 u := fmt .Sprintf ("user/codespaces/%v" , codespaceName )
516518 req , err := s .client .NewRequest (ctx , "PATCH" , u , body )
517519 if err != nil {
@@ -574,7 +576,7 @@ func (s *CodespacesService) GetLatestCodespaceExport(ctx context.Context, codesp
574576// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-repository-from-an-unpublished-codespace
575577//
576578//meta:operation POST /user/codespaces/{codespace_name}/publish
577- func (s * CodespacesService ) Publish (ctx context.Context , codespaceName string , body * PublishCodespaceOptions ) (* Codespace , * Response , error ) {
579+ func (s * CodespacesService ) Publish (ctx context.Context , codespaceName string , body PublishCodespaceRequest ) (* Codespace , * Response , error ) {
578580 u := fmt .Sprintf ("user/codespaces/%v/publish" , codespaceName )
579581 req , err := s .client .NewRequest (ctx , "POST" , u , body )
580582 if err != nil {
0 commit comments