envoapi

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 11 Imported by: 0

README

EnvoAPI for Go

Call EnvoAPI from your Go app to look up profiles, companies, posts, jobs, and more.

Requires Go 1.25+.

Install

Run this in your Go project:

go get github.com/envoapi-official/envoapi-sdks/go

For a new project, run go mod init example.com/myapp first.

Set your API key

Get a free API key with 100 credits.

Pass your key directly with envoapi.NewClient(envoapi.WithAPIKey("your-api-key")). The ENVOAPI_API_KEY environment variable is optional. An explicitly supplied key takes precedence.

Alternatively, set the environment variable and omit WithAPIKey:

# macOS / Linux
export ENVOAPI_API_KEY="your-api-key"
# Windows PowerShell
$env:ENVOAPI_API_KEY="your-api-key"

If you use the environment variable, run your app from the same terminal. envoapi.NewClient() reads it automatically. Keep your key out of source control.

Make a request

Save as main.go:

package main

import (
    "context"
    "fmt"
    "log"

    envoapi "github.com/envoapi-official/envoapi-sdks/go"
)

func main() {
    client, err := envoapi.NewClient(envoapi.WithAPIKey("your-api-key"))
    if err != nil {
        log.Fatal(err)
    }

    response, err := client.Profiles.GetPosts(context.Background(), envoapi.GetProfilePostsParams{
        Username: "satyanadella",
    })
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(response.Body.Data.Posts)
    fmt.Println(response.Body.Meta.CreditCost)
}

Run it:

go run .

Replace satyanadella with the profile username you want to look up. In an HTTP handler, pass r.Context() so the request can be cancelled when the caller disconnects.

Client options

You can also pass a key from your app's configuration. An explicit key overrides ENVOAPI_API_KEY.

// Add "time" to your imports. Use this inside your function.
client, err := envoapi.NewClient(
    envoapi.WithAPIKey("your-api-key"),
    envoapi.WithTimeout(30*time.Second),
)
if err != nil {
    log.Fatal(err)
}

The default timeout is 60 seconds. Use WithBaseURL to change the default https://api.envoapi.com, or WithHTTPClient to provide a custom HTTP client.

Handle errors

Replace the request and its error check with this block. Add "errors" to your imports.

response, err := client.Profiles.GetPosts(context.Background(), envoapi.GetProfilePostsParams{
    Username: "satyanadella",
})
if err != nil {
    var apiErr *envoapi.APIError
    if errors.As(err, &apiErr) {
        log.Printf("status=%d code=%s message=%s request_id=%s",
            apiErr.Status, apiErr.Code, apiErr.Message, apiErr.RequestID)
    } else {
        log.Print(err)
    }
    return
}
fmt.Println(response.Body.Data.Posts)

APIError means the API returned an error. TransportError means the request failed, and DecodeError means the response could not be read in the expected format.

Responses and more methods

  • response.Body.Data: the result.
  • response.Body.Meta: request metadata, including CreditCost.
  • response.Status and response.Headers: HTTP status and headers.

The SDK does not retry requests or fetch additional pages automatically. For paginated methods, pass the returned continuation cursor to the next call with the same search parameters. Requests use your EnvoAPI credits.

See the method reference or Go API documentation for more calls. Models and enums are in the github.com/envoapi-official/envoapi-sdks/go/api package.

GitHub · Issues · MIT license

Documentation

Overview

Package envoapi provides typed clients for EnvoAPI's public API.

Code generated by scripts/generate.mjs. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status    int
	Code      string
	Message   string
	Retryable bool
	RequestID string
	Headers   http.Header
	Body      []byte
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	Profiles  *ProfilesService
	Companies *CompaniesService
	Schools   *SchoolsService
	Search    *SearchService
	Jobs      *JobsService
	Posts     *PostsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options ...Option) (*Client, error)

NewClient reads ENVOAPI_API_KEY unless WithAPIKey is supplied.

type CompaniesService

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

func (*CompaniesService) GetDetailsById

func (*CompaniesService) GetDetailsBySlug

func (*CompaniesService) GetDetailsByUrl

func (*CompaniesService) GetJobs

func (*CompaniesService) GetPeople

func (*CompaniesService) GetPosts

func (*CompaniesService) GetSimilarBySlug

func (*CompaniesService) GetSimilarByUrl

func (*CompaniesService) SearchByDomain

func (*CompaniesService) SearchByKeyword

type DecodeError

type DecodeError struct {
	Status  int
	Headers http.Header
	Err     error
}

func (*DecodeError) Error

func (e *DecodeError) Error() string

func (*DecodeError) Unwrap

func (e *DecodeError) Unwrap() error

type GetCompanyDetailsByIdParams

type GetCompanyDetailsByIdParams = api.GetCompanyDetailsByIdParams

type GetCompanyDetailsBySlugParams

type GetCompanyDetailsBySlugParams = api.GetCompanyDetailsBySlugParams

type GetCompanyDetailsByUrlParams

type GetCompanyDetailsByUrlParams = api.GetCompanyDetailsByUrlParams

type GetCompanyJobsParams

type GetCompanyJobsParams = api.GetCompanyJobsParams

type GetCompanyPeopleParams

type GetCompanyPeopleParams = api.GetCompanyPeopleParams

type GetCompanyPostsParams

type GetCompanyPostsParams = api.GetCompanyPostsParams

type GetCompanyProductsParams

type GetCompanyProductsParams = api.GetCompanyProductsParams

type GetJobDetailsParams

type GetJobDetailsParams = api.GetJobDetailsParams

type GetPostBySlugParams

type GetPostBySlugParams = api.GetPostBySlugParams

type GetPostByUrlParams

type GetPostByUrlParams = api.GetPostByUrlParams

type GetPostCommentsBySlugParams

type GetPostCommentsBySlugParams = api.GetPostCommentsBySlugParams

type GetPostCommentsByUrlParams

type GetPostCommentsByUrlParams = api.GetPostCommentsByUrlParams

type GetPostReactionsBySlugParams

type GetPostReactionsBySlugParams = api.GetPostReactionsBySlugParams

type GetPostReactionsByUrlParams

type GetPostReactionsByUrlParams = api.GetPostReactionsByUrlParams

type GetProfileCertificationsByUrlParams

type GetProfileCertificationsByUrlParams = api.GetProfileCertificationsByUrlParams

type GetProfileCertificationsByUsernameParams

type GetProfileCertificationsByUsernameParams = api.GetProfileCertificationsByUsernameParams

type GetProfileCommentsParams

type GetProfileCommentsParams = api.GetProfileCommentsParams

type GetProfileCompanyInterestsByIdParams

type GetProfileCompanyInterestsByIdParams = api.GetProfileCompanyInterestsByIdParams

type GetProfileCompanyInterestsByUrlParams

type GetProfileCompanyInterestsByUrlParams = api.GetProfileCompanyInterestsByUrlParams

type GetProfileCompanyInterestsByUsernameParams

type GetProfileCompanyInterestsByUsernameParams = api.GetProfileCompanyInterestsByUsernameParams

type GetProfileContactByUrlParams

type GetProfileContactByUrlParams = api.GetProfileContactByUrlParams

type GetProfileContactByUsernameParams

type GetProfileContactByUsernameParams = api.GetProfileContactByUsernameParams

type GetProfileCoursesByUrlParams

type GetProfileCoursesByUrlParams = api.GetProfileCoursesByUrlParams

type GetProfileCoursesByUsernameParams

type GetProfileCoursesByUsernameParams = api.GetProfileCoursesByUsernameParams

type GetProfileDetailsByIdParams

type GetProfileDetailsByIdParams = api.GetProfileDetailsByIdParams

type GetProfileDetailsByUrlParams

type GetProfileDetailsByUrlParams = api.GetProfileDetailsByUrlParams

type GetProfileDetailsByUsernameParams

type GetProfileDetailsByUsernameParams = api.GetProfileDetailsByUsernameParams

type GetProfileEducationByUrlParams

type GetProfileEducationByUrlParams = api.GetProfileEducationByUrlParams

type GetProfileEducationByUsernameParams

type GetProfileEducationByUsernameParams = api.GetProfileEducationByUsernameParams

type GetProfileFullExperienceByUrlParams

type GetProfileFullExperienceByUrlParams = api.GetProfileFullExperienceByUrlParams

type GetProfileFullExperienceByUsernameParams

type GetProfileFullExperienceByUsernameParams = api.GetProfileFullExperienceByUsernameParams

type GetProfilePostsParams

type GetProfilePostsParams = api.GetProfilePostsParams

type GetProfileReactionsParams

type GetProfileReactionsParams = api.GetProfileReactionsParams

type GetProfileSkillsByUrlParams

type GetProfileSkillsByUrlParams = api.GetProfileSkillsByUrlParams

type GetProfileSkillsByUsernameParams

type GetProfileSkillsByUsernameParams = api.GetProfileSkillsByUsernameParams

type GetProfileVolunteerExperienceByUrlParams

type GetProfileVolunteerExperienceByUrlParams = api.GetProfileVolunteerExperienceByUrlParams

type GetSearchTypeaheadParams

type GetSearchTypeaheadParams = api.GetSearchTypeaheadParams

type GetSimilarCompaniesBySlugParams

type GetSimilarCompaniesBySlugParams = api.GetSimilarCompaniesBySlugParams

type GetSimilarCompaniesByUrlParams

type GetSimilarCompaniesByUrlParams = api.GetSimilarCompaniesByUrlParams

type GetSimilarProfilesParams

type GetSimilarProfilesParams = api.GetSimilarProfilesParams

type JobsService

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

func (*JobsService) GetDetails

func (*JobsService) Search

type Option

type Option func(*config)

func WithAPIKey

func WithAPIKey(key string) Option

func WithBaseURL

func WithBaseURL(baseURL string) Option

func WithHTTPClient

func WithHTTPClient(client api.HttpRequestDoer) Option

WithHTTPClient replaces the transport. Callers control any retries made by this client.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the whole-request timeout. The caller's earlier context deadline wins.

type PostsService

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

func (*PostsService) GetBySlug

func (*PostsService) GetByUrl

func (*PostsService) GetCommentsBySlug

func (*PostsService) GetCommentsByUrl

type ProfilesService

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

func (*ProfilesService) GetComments

func (*ProfilesService) GetContactByUrl

func (*ProfilesService) GetContactByUsername

func (*ProfilesService) GetCoursesByUrl

func (*ProfilesService) GetCoursesByUsername

func (*ProfilesService) GetDetailsById

func (*ProfilesService) GetDetailsByUrl

func (*ProfilesService) GetDetailsByUsername

func (*ProfilesService) GetEducationByUrl

func (*ProfilesService) GetEducationByUsername

func (*ProfilesService) GetFullExperienceByUrl

func (*ProfilesService) GetPosts

func (*ProfilesService) GetReactions

func (*ProfilesService) GetSimilar

func (*ProfilesService) GetSkillsByUrl

func (*ProfilesService) GetSkillsByUsername

func (*ProfilesService) SearchByKeyword

type Response

type Response[T any] struct {
	Body    T
	Status  int
	Headers http.Header
}

Response preserves the API envelope and HTTP metadata.

type SchoolsService

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

type SearchAllResultsByKeywordParams

type SearchAllResultsByKeywordParams = api.SearchAllResultsByKeywordParams

type SearchCompaniesByDomainParams

type SearchCompaniesByDomainParams = api.SearchCompaniesByDomainParams

type SearchCompaniesByKeywordParams

type SearchCompaniesByKeywordParams = api.SearchCompaniesByKeywordParams

type SearchIndustriesByKeywordParams

type SearchIndustriesByKeywordParams = api.SearchIndustriesByKeywordParams

type SearchJobsParams

type SearchJobsParams = api.SearchJobsParams

type SearchLocationsByKeywordParams

type SearchLocationsByKeywordParams = api.SearchLocationsByKeywordParams

type SearchPeopleByKeywordParams

type SearchPeopleByKeywordParams = api.SearchPeopleByKeywordParams

type SearchPostsByHashtagParams

type SearchPostsByHashtagParams = api.SearchPostsByHashtagParams

type SearchPostsByKeywordParams

type SearchPostsByKeywordParams = api.SearchPostsByKeywordParams

type SearchSchoolsByKeywordParams

type SearchSchoolsByKeywordParams = api.SearchSchoolsByKeywordParams

type SearchService

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

func (*SearchService) SearchAllResultsByKeyword

func (s *SearchService) SearchAllResultsByKeyword(ctx context.Context, params SearchAllResultsByKeywordParams) (*Response[api.KeywordSearchSuccess], error)

func (*SearchService) SearchIndustriesByKeyword

func (*SearchService) SearchPostsByHashtag

func (*SearchService) SearchPostsByKeyword

type SearchServiceCategoriesParams

type SearchServiceCategoriesParams = api.SearchServiceCategoriesParams

type TransportError

type TransportError struct{ Err error }

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

Directories

Path Synopsis
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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