projects

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package projects provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Package projects provides a client for the Snyk Projects API.

Projects represent monitored code repositories or packages in Snyk.

Index

Constants

View Source
const (
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func NewDeleteProjectRequest

func NewDeleteProjectRequest(server string, orgId openapi_types.UUID, projectId openapi_types.UUID) (*http.Request, error)

NewDeleteProjectRequest generates requests for DeleteProject

func NewGetProjectRequest

func NewGetProjectRequest(server string, orgId openapi_types.UUID, projectId openapi_types.UUID) (*http.Request, error)

NewGetProjectRequest generates requests for GetProject

func NewListProjectsRequest

func NewListProjectsRequest(server string, orgId openapi_types.UUID, params *ListProjectsParams) (*http.Request, error)

NewListProjectsRequest generates requests for ListProjects

func NewUpdateProjectRequestWithApplicationVndAPIPlusJSONBody

func NewUpdateProjectRequestWithApplicationVndAPIPlusJSONBody(server string, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody) (*http.Request, error)

NewUpdateProjectRequestWithApplicationVndAPIPlusJSONBody calls the generic UpdateProject builder with application/vnd.api+json body

func NewUpdateProjectRequestWithBody

func NewUpdateProjectRequestWithBody(server string, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error)

NewUpdateProjectRequestWithBody generates requests for UpdateProject with any type of body

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateProjectWithApplicationVndAPIPlusJSONBody

func (c *Client) UpdateProjectWithApplicationVndAPIPlusJSONBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateProjectWithBody

func (c *Client) UpdateProjectWithBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// ListProjects request
	ListProjects(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteProject request
	DeleteProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetProject request
	GetProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpdateProjectWithBody request with any body
	UpdateProjectWithBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpdateProjectWithApplicationVndAPIPlusJSONBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) DeleteProjectWithResponse

func (c *ClientWithResponses) DeleteProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteProjectResponse, error)

DeleteProjectWithResponse request returning *DeleteProjectResponse

func (*ClientWithResponses) GetProjectWithResponse

func (c *ClientWithResponses) GetProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetProjectResponse, error)

GetProjectWithResponse request returning *GetProjectResponse

func (*ClientWithResponses) ListProjectsWithResponse

func (c *ClientWithResponses) ListProjectsWithResponse(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)

ListProjectsWithResponse request returning *ListProjectsResponse

func (*ClientWithResponses) UpdateProjectWithApplicationVndAPIPlusJSONBodyWithResponse

func (c *ClientWithResponses) UpdateProjectWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)

func (*ClientWithResponses) UpdateProjectWithBodyWithResponse

func (c *ClientWithResponses) UpdateProjectWithBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)

UpdateProjectWithBodyWithResponse request with arbitrary body returning *UpdateProjectResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListProjectsWithResponse request
	ListProjectsWithResponse(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)

	// DeleteProjectWithResponse request
	DeleteProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteProjectResponse, error)

	// GetProjectWithResponse request
	GetProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetProjectResponse, error)

	// UpdateProjectWithBodyWithResponse request with any body
	UpdateProjectWithBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)

	UpdateProjectWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type DeleteProjectResponse

type DeleteProjectResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseDeleteProjectResponse

func ParseDeleteProjectResponse(rsp *http.Response) (*DeleteProjectResponse, error)

ParseDeleteProjectResponse parses an HTTP response from a DeleteProjectWithResponse call

func (DeleteProjectResponse) Status

func (r DeleteProjectResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteProjectResponse) StatusCode

func (r DeleteProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Error

type Error struct {
	Errors []struct {
		Detail string  `json:"detail"`
		Status string  `json:"status"`
		Title  *string `json:"title,omitempty"`
	} `json:"errors"`
}

Error defines model for Error.

type GetProjectResponse

type GetProjectResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *ProjectResponse
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseGetProjectResponse

func ParseGetProjectResponse(rsp *http.Response) (*GetProjectResponse, error)

ParseGetProjectResponse parses an HTTP response from a GetProjectWithResponse call

func (GetProjectResponse) Status

func (r GetProjectResponse) Status() string

Status returns HTTPResponse.Status

func (GetProjectResponse) StatusCode

func (r GetProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListProjectsParams

type ListProjectsParams struct {
	// Limit Number of results to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// StartingAfter Cursor for pagination
	StartingAfter *string `form:"starting_after,omitempty" json:"starting_after,omitempty"`

	// TargetId Filter by target ID
	TargetId *openapi_types.UUID `form:"target_id,omitempty" json:"target_id,omitempty"`

	// Origin Filter by origin (e.g., github, cli)
	Origin *string `form:"origin,omitempty" json:"origin,omitempty"`

	// Type Filter by project type (e.g., npm, maven)
	Type *string `form:"type,omitempty" json:"type,omitempty"`
}

ListProjectsParams defines parameters for ListProjects.

type ListProjectsResponse

type ListProjectsResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *ProjectList
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseListProjectsResponse

func ParseListProjectsResponse(rsp *http.Response) (*ListProjectsResponse, error)

ParseListProjectsResponse parses an HTTP response from a ListProjectsWithResponse call

func (ListProjectsResponse) Status

func (r ListProjectsResponse) Status() string

Status returns HTTPResponse.Status

func (ListProjectsResponse) StatusCode

func (r ListProjectsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Project

type Project struct {
	Attributes struct {
		// Created Project creation date
		Created time.Time `json:"created"`

		// Name Project name
		Name string `json:"name"`

		// Origin Source of the project (e.g., github, cli)
		Origin string `json:"origin"`

		// Status Project status
		Status *ProjectAttributesStatus `json:"status,omitempty"`
		Tags   *[]struct {
			Key   *string `json:"key,omitempty"`
			Value *string `json:"value,omitempty"`
		} `json:"tags,omitempty"`

		// TargetReference Branch or reference being monitored
		TargetReference *string `json:"target_reference,omitempty"`

		// Type Project type (e.g., npm, maven, pip)
		Type string `json:"type"`
	} `json:"attributes"`

	// Id Project ID
	Id            openapi_types.UUID `json:"id"`
	Relationships *struct {
		Organization *struct {
			Data *struct {
				Id   *openapi_types.UUID                       `json:"id,omitempty"`
				Type *ProjectRelationshipsOrganizationDataType `json:"type,omitempty"`
			} `json:"data,omitempty"`
		} `json:"organization,omitempty"`
		Target *struct {
			Data *struct {
				Id   *openapi_types.UUID                 `json:"id,omitempty"`
				Type *ProjectRelationshipsTargetDataType `json:"type,omitempty"`
			} `json:"data,omitempty"`
		} `json:"target,omitempty"`
	} `json:"relationships,omitempty"`
	Type ProjectType `json:"type"`
}

Project defines model for Project.

type ProjectAttributesStatus

type ProjectAttributesStatus string

ProjectAttributesStatus Project status

const (
	Active   ProjectAttributesStatus = "active"
	Inactive ProjectAttributesStatus = "inactive"
)

Defines values for ProjectAttributesStatus.

type ProjectList

type ProjectList struct {
	Data  []Project `json:"data"`
	Links *struct {
		Next *string `json:"next,omitempty"`
		Prev *string `json:"prev,omitempty"`
		Self *string `json:"self,omitempty"`
	} `json:"links,omitempty"`
	Meta *struct {
		// Count Total number of projects
		Count *int `json:"count,omitempty"`
	} `json:"meta,omitempty"`
}

ProjectList defines model for ProjectList.

type ProjectRelationshipsOrganizationDataType

type ProjectRelationshipsOrganizationDataType string

ProjectRelationshipsOrganizationDataType defines model for Project.Relationships.Organization.Data.Type.

const (
	Organization ProjectRelationshipsOrganizationDataType = "organization"
)

Defines values for ProjectRelationshipsOrganizationDataType.

type ProjectRelationshipsTargetDataType

type ProjectRelationshipsTargetDataType string

ProjectRelationshipsTargetDataType defines model for Project.Relationships.Target.Data.Type.

const (
	Target ProjectRelationshipsTargetDataType = "target"
)

Defines values for ProjectRelationshipsTargetDataType.

type ProjectResponse

type ProjectResponse struct {
	Data Project `json:"data"`
}

ProjectResponse defines model for ProjectResponse.

type ProjectType

type ProjectType string

ProjectType defines model for Project.Type.

const (
	ProjectTypeProject ProjectType = "project"
)

Defines values for ProjectType.

type ProjectsClient

type ProjectsClient struct {
	// contains filtered or unexported fields
}

ProjectsClient wraps the generated OpenAPI client for the Projects API.

func NewProjectsClient

func NewProjectsClient(baseClient *client.Client) *ProjectsClient

NewProjectsClient creates a new ProjectsClient.

func (*ProjectsClient) DeleteProject

func (c *ProjectsClient) DeleteProject(ctx context.Context, orgID, projectID string) error

DeleteProject deletes a project.

func (*ProjectsClient) GetProject

func (c *ProjectsClient) GetProject(ctx context.Context, orgID, projectID string) (*Project, error)

GetProject retrieves a single project by ID.

func (*ProjectsClient) ListProjects

func (c *ProjectsClient) ListProjects(ctx context.Context, orgID string, params *ListProjectsParams) (*ProjectList, error)

ListProjects lists all projects in an organization.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type UpdateProjectApplicationVndAPIPlusJSONBody

type UpdateProjectApplicationVndAPIPlusJSONBody struct {
	Data struct {
		Attributes struct {
			Tags *[]struct {
				Key   *string `json:"key,omitempty"`
				Value *string `json:"value,omitempty"`
			} `json:"tags,omitempty"`
		} `json:"attributes"`
		Id   openapi_types.UUID                                 `json:"id"`
		Type UpdateProjectApplicationVndAPIPlusJSONBodyDataType `json:"type"`
	} `json:"data"`
}

UpdateProjectApplicationVndAPIPlusJSONBody defines parameters for UpdateProject.

type UpdateProjectApplicationVndAPIPlusJSONBodyDataType

type UpdateProjectApplicationVndAPIPlusJSONBodyDataType string

UpdateProjectApplicationVndAPIPlusJSONBodyDataType defines parameters for UpdateProject.

const (
	UpdateProjectApplicationVndAPIPlusJSONBodyDataTypeProject UpdateProjectApplicationVndAPIPlusJSONBodyDataType = "project"
)

Defines values for UpdateProjectApplicationVndAPIPlusJSONBodyDataType.

type UpdateProjectApplicationVndAPIPlusJSONRequestBody

type UpdateProjectApplicationVndAPIPlusJSONRequestBody UpdateProjectApplicationVndAPIPlusJSONBody

UpdateProjectApplicationVndAPIPlusJSONRequestBody defines body for UpdateProject for application/vnd.api+json ContentType.

type UpdateProjectResponse

type UpdateProjectResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *ProjectResponse
	ApplicationvndApiJSON400 *Error
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseUpdateProjectResponse

func ParseUpdateProjectResponse(rsp *http.Response) (*UpdateProjectResponse, error)

ParseUpdateProjectResponse parses an HTTP response from a UpdateProjectWithResponse call

func (UpdateProjectResponse) Status

func (r UpdateProjectResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateProjectResponse) StatusCode

func (r UpdateProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL