fleek

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: GPL-3.0 Imports: 5 Imported by: 1

README

go-fleek

godoc license

Tiny Go library for the Fleek API.

Installation

go get -u github.com/mrusme/go-fleek

Getting Started

Querying Sites by Team ID
package main

import (
  "log"
  "github.com/mrusme/go-fleek"
)

func main() {
  f := fleek.New("apiKeyHere")

  sites, err := f.GetSitesByTeamId("my-team")
  if err != nil {
    log.Panic(err)
  }

  for _, site := range sites {
    log.Printf(
      "Site ID: %v\nName: %s\nPlatform: %s\n\n",
      site.Id,
      site.Name,
      site.Platform,
    )
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildSettings

type BuildSettings struct {
	BuildCommand         string                `json:"buildCommand"`
	BaseDirectoryPath    string                `json:"baseDirectoryPath"`
	PublishDirectoryPath string                `json:"publishDirectoryPath"`
	DockerImage          string                `json:"dockerImage"`
	EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"`
}

type DeploySettings

type DeploySettings struct {
	AutoPublishing   bool   `json:"autoPublishing"`
	PRDeployPreviews bool   `json:"prDeployPreviews"`
	DfinityUseProxy  bool   `json:"dfinityUseProxy"`
	Source           Source `json:"source"`
}

type EnvironmentVariable

type EnvironmentVariable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type FleekClient

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

func New

func New(token string) (*FleekClient, error)

Initializes new FleekClient

func (*FleekClient) GetSiteBySlug

func (f *FleekClient) GetSiteBySlug(slug string) (Site, error)

Gets a single site by its slug

func (*FleekClient) GetSitesByTeamId

func (f *FleekClient) GetSitesByTeamId(teamId string) ([]Site, error)

Gets all sites of a team, with the team ID being the *slug* (e.g. `my-team`)

type GraphqlSite

type GraphqlSite struct {
	Id          graphql.ID
	Name        graphql.String
	Slug        graphql.String
	Description graphql.String
	Platform    graphql.String

	Team struct {
		Id   graphql.ID
		Name graphql.String
	}

	BuildSettings struct {
		BuildCommand         graphql.String
		BaseDirectoryPath    graphql.String
		PublishDirectoryPath graphql.String
		DockerImage          graphql.String
		EnvironmentVariables []struct {
			Name  graphql.String
			Value graphql.String
		}
	}

	DeploySettings struct {
		AutoPublishing   graphql.Boolean
		PRDeployPreviews graphql.Boolean
		DfinityUseProxy  graphql.Boolean
		Source           struct {
			IPFSSource struct {
				CID graphql.String
			} `graphql:"... on IpfsSource"`
			Repository struct {
				Type   graphql.String
				URL    graphql.String
				Branch graphql.String
			} `graphql:"... on Repository"`
		}
	}

	PublishedDeploy struct {
		Id           graphql.ID
		Status       graphql.String
		IpfsHash     graphql.String
		PreviewImage graphql.String
		AutoPublish  graphql.Boolean
		Published    graphql.Boolean
		Log          graphql.String
		Repository   struct {
			Commit  graphql.String
			Branch  graphql.String
			Owner   graphql.String
			Name    graphql.String
			Message graphql.String
		}
		TotalTime   graphql.Int
		StartedAt   graphql.String
		CompletedAt graphql.String
	}

	CreatedBy graphql.ID
	CreatedAt graphql.String
	UpdatedAt graphql.String
}

type PublishedDeploy

type PublishedDeploy struct {
	Id           interface{} `json:"id"`
	Status       string      `json:"status"`
	IPFSHash     string      `json:"ipfsHash"`
	Log          string      `json:"log"`
	PreviewImage string      `json:"previewImage"`
	AutoPublish  bool        `json:"autoPublish"`
	Published    bool        `json:"published"`
	Repository   Repository  `json:"repository"`
	TotalTime    int         `json:"totalTime"`
	StartedAt    time.Time   `json:"startedAt"`
	CompletedAt  time.Time   `json:"completedAt"`
}

type Repository

type Repository struct {
	Commit  string `json:"commit"`
	Branch  string `json:"branch"`
	Owner   string `json:"owner"`
	Name    string `json:"name"`
	Message string `json:"message"`
}

type Site

type Site struct {
	Id          interface{} `json:"id"`
	Name        string      `json:"name"`
	Slug        string      `json:"slug"`
	Description string      `json:"description"`
	Platform    string      `json:"platform"`

	Team Team `json:"team"`

	BuildSettings   BuildSettings   `json:"buildSettings"`
	DeploySettings  DeploySettings  `json:"deploySettings"`
	PublishedDeploy PublishedDeploy `json:"publishedDeploy"`

	CreatedBy interface{} `json:"createdBy"`
	CreatedAt time.Time   `json:"createdAt"`
	UpdatedAt time.Time   `json:"updatedAt"`
}

type Source

type Source struct {
	// IPFS Source
	CID string `json:"cid,omitempty"`
	// Repository
	Type   string `json:"type,omitempty"`
	URL    string `json:"url,omitempty"`
	Branch string `json:"branch,omitempty"`
}

type Team

type Team struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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