Repository: google/go-github
File: github/orgs_credential_authorizations.go (Go)

Code before:
)

// CredentialAuthorization represents a credential authorized through SAML SSO
type CredentialAuthorization struct {
	// User login that owns the underlying credential.
	Login *string `json:"login"`

	// Unique identifier for the credential.
	CredentialID *int64 `json:"credential_id"`

	// Human-readable description of the credential type.
	CredentialType *string `json:"credential_type"`

	// Last eight characters of the credential.
	// Only included in responses with credential_type of personal access token.
	TokenLastEight *string `json:"token_last_eight"`

	// Date when the credential was authorized for use.
	CredentialAuthorizedAt *Timestamp `json:"credential_authorized_at"`

	// Date when the credential was last accessed.
	// May be null if it was never accessed.
	CredentialAccessedAt *Timestamp `json:"credential_accessed_at"`

	// List of oauth scopes the token has been granted.
	Scopes []string `json:"scopes"`

	// Unique string to distinguish the credential.
	// Only included in responses with credential_type of SSH Key.
	Fingerprint *string `json:"fingerprint"`

	AuthorizedCredentialID *int64 `json:"authorized_credential_id"`

	// The title given to the ssh key.
	// This will only be present when the credential is an ssh key.
	AuthorizedCredentialTitle *string `json:"authorized_credential_title"`

	// The note given to the token.
	// This will only be present when the credential is a token.
	AuthorizedCredentialNote *string `json:"authorized_credential_note"`

	// The expiry for the token.
	// This will only be present when the credential is a token.
	AuthorizedCredentialExpiresAt *Timestamp `json:"authorized_credential_expires_at"`
}

// ListCredentialAuthorizations lists credentials authorized through SAML SSO
// for a given organization. Only available with GitHub Enterprise Cloud.
//
// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#list-saml-sso-authorizations-for-an-organization
func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *ListOptions) ([]*CredentialAuthorization, *Response, error) {

Review comment (suggestion):
Please add `,omitempty` to all fields in this struct, since they are all reference types.

```suggestion
	Scopes []string `json:"scopes,omitempty"`
```

Code after:

import (
	"context"
	"fmt"
	"net/http"
)

// CredentialAuthorization represents a credential authorized through SAML SSO.
type CredentialAuthorization struct {
	// User login that owns the underlying credential.
	Login *string `json:"login,omitempty"`

	// Unique identifier for the credential.
	CredentialID *int64 `json:"credential_id,omitempty"`

	// Human-readable description of the credential type.
	CredentialType *string `json:"credential_type,omitempty"`

	// Last eight characters of the credential.
	// Only included in responses with credential_type of personal access token.
	TokenLastEight *string `json:"token_last_eight,omitempty"`

	// Date when the credential was authorized for use.
	CredentialAuthorizedAt *Timestamp `json:"credential_authorized_at,omitempty"`

	// Date when the credential was last accessed.
	// May be null if it was never accessed.
	CredentialAccessedAt *Timestamp `json:"credential_accessed_at,omitempty"`

	// List of oauth scopes the token has been granted.
	Scopes []string `json:"scopes,omitempty"`

	// Unique string to distinguish the credential.
	// Only included in responses with credential_type of SSH Key.
	Fingerprint *string `json:"fingerprint,omitempty"`

	AuthorizedCredentialID *int64 `json:"authorized_credential_id,omitempty"`

	// The title given to the ssh key.
	// This will only be present when the credential is an ssh key.
	AuthorizedCredentialTitle *string `json:"authorized_credential_title,omitempty"`

	// The note given to the token.
	// This will only be present when the credential is a token.
	AuthorizedCredentialNote *string `json:"authorized_credential_note,omitempty"`

	// The expiry for the token.
	// This will only be present when the credential is a token.
	AuthorizedCredentialExpiresAt *Timestamp `json:"authorized_credential_expires_at,omitempty"`
}