pennsieve

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BaseURLV1           = "https://api.pennsieve.io"
	BaseURLV2           = "https://api2.pennsieve.io"
	DefaultUploadBucket = "pennsieve-prod-uploads-v2-use1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APICredentials

type APICredentials struct {
	ApiKey    string
	ApiSecret string
}

type APISession

type APISession struct {
	Token        string
	IdToken      string
	Expiration   time.Time
	RefreshToken string
	IsRefreshed  bool
}

type Administrators

type Administrators struct {
	UpdatedAt               time.Time               `json:"updatedAt"`
	Email                   string                  `json:"email"`
	Degree                  Degree                  `json:"degree"`
	Role                    Role                    `json:"role"`
	URL                     string                  `json:"url"`
	IsSuperAdmin            bool                    `json:"isSuperAdmin"`
	IsPublisher             bool                    `json:"isPublisher"`
	IntID                   int                     `json:"intId"`
	Color                   string                  `json:"color"`
	PennsieveTermsOfService PennsieveTermsOfService `json:"pennsieveTermsOfService"`
	LastName                string                  `json:"lastName"`
	IsOwner                 bool                    `json:"isOwner"`
	FirstName               string                  `json:"firstName"`
	ID                      string                  `json:"id"`
	AuthyID                 int                     `json:"authyId"`
	CustomTermsOfService    []CustomTermsOfService  `json:"customTermsOfService"`
	MiddleInitial           string                  `json:"middleInitial"`
	PreferredOrganization   string                  `json:"preferredOrganization"`
	CreatedAt               time.Time               `json:"createdAt"`
	Storage                 int                     `json:"storage"`
	Credential              string                  `json:"credential"`
	Orcid                   Orcid                   `json:"orcid"`
}

type AuthenticationService

type AuthenticationService struct {
	BaseUrl string // BaseUrl is exposed in Auth service as we need to update to check new auth when switching profiles
	// contains filtered or unexported fields
}

func (*AuthenticationService) Authenticate

func (s *AuthenticationService) Authenticate(apiKey string, apiSecret string) (*APISession, error)

func (*AuthenticationService) GetAWSCredsForUser

func (s *AuthenticationService) GetAWSCredsForUser() *cognitoidentity.Credentials

GetAWSCredsForUser returns set of AWS credentials to allow user to upload data to upload bucket

func (*AuthenticationService) ReAuthenticate added in v0.1.1

func (s *AuthenticationService) ReAuthenticate() (*APISession, error)

ReAuthenticate updates authentication JWT and stores in local DB.

type Children

type Children struct {
	Content    ChildrenContent     `json:"content"`
	Properties []PropsWithCategory `json:"properties"`
	Children   []interface{}       `json:"children"`
	Storage    int                 `json:"storage"`
	Extension  string              `json:"extension,omitempty"`
}

type ChildrenContent

type ChildrenContent struct {
	ID            string    `json:"id"`
	NodeID        string    `json:"nodeId"`
	Name          string    `json:"name"`
	PackageType   string    `json:"packageType"`
	DatasetID     string    `json:"datasetId"`
	DatasetNodeID string    `json:"datasetNodeId"`
	OwnerID       int       `json:"ownerId"`
	State         string    `json:"state"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
	IntID         int       `json:"intId"`
	DatasetIntID  int       `json:"datasetIntId"`
}

type Client

type Client struct {
	APISession     APISession
	APICredentials APICredentials
	AWSCredentials *cognitoidentity.Credentials
	HTTPClient     *http.Client

	OrganizationNodeId string
	OrganizationId     int
	UploadBucket       string

	Organization   *OrganizationService
	Authentication *AuthenticationService
	User           *UserService
	Dataset        *DatasetService
	Manifest       *ManifestService
}

func NewClient

func NewClient(baseUrlV1 string, baseUrlV2 string) *Client

NewClient creates a new Pennsieve HTTP client.

func (*Client) SetBasePathForServices added in v0.1.3

func (c *Client) SetBasePathForServices(baseUrlV1 string, baseUrlV2 string)

type CognitoConfig

type CognitoConfig struct {
	Region       string       `json:"region"`
	UserPool     UserPool     `json:"userPool"`
	TokenPool    TokenPool    `json:"tokenPool"`
	IdentityPool IdentityPool `json:"identityPool"`
}

type CollaboratorCounts

type CollaboratorCounts struct {
	Users         int `json:"users"`
	Organizations int `json:"organizations"`
	Teams         int `json:"teams"`
}

type CustomTermsOfService

type CustomTermsOfService struct {
	Version        string `json:"version"`
	OrganizationID string `json:"organizationId"`
}

type DatasetContent

type DatasetContent struct {
	ID                           string    `json:"id"`
	Name                         string    `json:"name"`
	Description                  string    `json:"description"`
	State                        string    `json:"state"`
	CreatedAt                    time.Time `json:"createdAt"`
	UpdatedAt                    time.Time `json:"updatedAt"`
	PackageType                  string    `json:"packageType"`
	DatasetType                  string    `json:"datasetType"`
	Status                       string    `json:"status"`
	AutomaticallyProcessPackages bool      `json:"automaticallyProcessPackages"`
	License                      string    `json:"license"`
	Tags                         []string  `json:"tags"`
	IntID                        int       `json:"intId"`
}

type DatasetService

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

func (*DatasetService) Get

Get returns a single dataset by id.

type Degree

type Degree struct {
	EntryName                          string `json:"entryName"`
	EnumeratumEnumEntryStableEntryName string `json:"enumeratum$EnumEntry$$stableEntryName"`
}

type GetDatasetResponse

type GetDatasetResponse struct {
	Content            DatasetContent     `json:"content"`
	Organization       string             `json:"organization"`
	Children           []Children         `json:"children"`
	Owner              string             `json:"owner"`
	CollaboratorCounts CollaboratorCounts `json:"collaboratorCounts"`
	Storage            int                `json:"storage"`
	Status             Status             `json:"status"`
	Publication        Publication        `json:"publication"`
	Properties         []interface{}      `json:"properties"`
	CanPublish         bool               `json:"canPublish"`
	Locked             bool               `json:"locked"`
	BannerPresignedURL string             `json:"bannerPresignedUrl"`
}

type GetOrganizationResponse

type GetOrganizationResponse struct {
	Organization Organization `json:"organization"`
}

type GetOrganizationsResponse

type GetOrganizationsResponse struct {
	Organizations []Organizations `json:"organizations"`
}

type IdentityPool added in v1.1.0

type IdentityPool struct {
	Region string `json:"region"`
	ID     string `json:"id"`
}

type ManifestService added in v0.1.3

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

func (*ManifestService) Create added in v0.1.3

func (d *ManifestService) Create(ctx context.Context, requestBody manifest.DTO) (*manifest.PostResponse, error)

Get returns a single dataset by id.

type Orcid

type Orcid struct {
	Name  string `json:"name"`
	Orcid string `json:"orcid"`
}

type Organization

type Organization struct {
	Name                 string               `json:"name"`
	EncryptionKeyID      string               `json:"encryptionKeyId"`
	Features             []string             `json:"features"`
	IntID                int                  `json:"intId"`
	Slug                 string               `json:"slug"`
	ID                   string               `json:"id"`
	CustomTermsOfService CustomTermsOfService `json:"customTermsOfService"`
	Storage              int                  `json:"storage"`
	SubscriptionState    SubscriptionState    `json:"subscriptionState"`
	Terms                string               `json:"terms"`
}

type OrganizationService

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

func (*OrganizationService) Get

Get returns a single organization by id.

func (*OrganizationService) List

List lists all the organizations that the user belongs to.

type Organizations

type Organizations struct {
	Organization   Organization     `json:"organization"`
	IsAdmin        bool             `json:"isAdmin"`
	Owners         []Owners         `json:"owners"`
	Administrators []Administrators `json:"administrators"`
	IsOwner        bool             `json:"isOwner"`
}

type Owners

type Owners struct {
	UpdatedAt               time.Time               `json:"updatedAt"`
	Email                   string                  `json:"email"`
	Degree                  Degree                  `json:"degree"`
	Role                    Role                    `json:"role"`
	URL                     string                  `json:"url"`
	IsSuperAdmin            bool                    `json:"isSuperAdmin"`
	IsPublisher             bool                    `json:"isPublisher"`
	IntID                   int                     `json:"intId"`
	Color                   string                  `json:"color"`
	PennsieveTermsOfService PennsieveTermsOfService `json:"pennsieveTermsOfService"`
	LastName                string                  `json:"lastName"`
	IsOwner                 bool                    `json:"isOwner"`
	FirstName               string                  `json:"firstName"`
	ID                      string                  `json:"id"`
	AuthyID                 int                     `json:"authyId"`
	CustomTermsOfService    []CustomTermsOfService  `json:"customTermsOfService"`
	MiddleInitial           string                  `json:"middleInitial"`
	PreferredOrganization   string                  `json:"preferredOrganization"`
	CreatedAt               time.Time               `json:"createdAt"`
	Storage                 int                     `json:"storage"`
	Credential              string                  `json:"credential"`
	Orcid                   Orcid                   `json:"orcid"`
}

type PennsieveTermsOfService

type PennsieveTermsOfService struct {
	Version string `json:"version"`
}

type Properties

type Properties struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	DataType string `json:"dataType"`
	Fixed    bool   `json:"fixed"`
	Hidden   bool   `json:"hidden"`
	Display  string `json:"display"`
}

type PropsWithCategory

type PropsWithCategory struct {
	Category   string       `json:"category"`
	Properties []Properties `json:"properties"`
}

type Publication

type Publication struct {
	Status string `json:"status"`
	Type   string `json:"type"`
}

type Role

type Role struct {
}

type Status

type Status struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Color       string `json:"color"`
	InUse       bool   `json:"inUse"`
}

type SubscriptionState

type SubscriptionState struct {
}

type TermsOfService

type TermsOfService struct {
	Version string `json:"version"`
}

type TokenPool

type TokenPool struct {
	Region      string `json:"region"`
	ID          string `json:"id"`
	AppClientID string `json:"appClientId"`
}

type User

type User struct {
	ID                      string         `json:"id"`
	Email                   string         `json:"email"`
	FirstName               string         `json:"firstName"`
	MiddleInitial           string         `json:"middleInitial"`
	LastName                string         `json:"lastName"`
	Degree                  string         `json:"degree"`
	Credential              string         `json:"credential"`
	Color                   string         `json:"color"`
	URL                     string         `json:"url"`
	AuthyID                 int            `json:"authyId"`
	IsSuperAdmin            bool           `json:"isSuperAdmin"`
	IsIntegrationUser       bool           `json:"isIntegrationUser"`
	CreatedAt               time.Time      `json:"createdAt"`
	UpdatedAt               time.Time      `json:"updatedAt"`
	PreferredOrganization   string         `json:"preferredOrganization"`
	Orcid                   Orcid          `json:"orcid"`
	PennsieveTermsOfService TermsOfService `json:"pennsieveTermsOfService"`
	CustomTermsOfService    []interface{}  `json:"customTermsOfService"`
	IntID                   int            `json:"intId"`
}

type UserOptions

type UserOptions struct{}

type UserPool

type UserPool struct {
	Region      string `json:"region"`
	ID          string `json:"id"`
	AppClientID string `json:"appClientId"`
}

type UserService

type UserService struct {
	BaseUrl string
	// contains filtered or unexported fields
}

func (*UserService) GetUser

func (c *UserService) GetUser(ctx context.Context, options *UserOptions) (*User, error)

Jump to

Keyboard shortcuts

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