golinkedin

package module
v0.0.0-...-4dc9429 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 7 Imported by: 0

README

Contributors Forks Stargazers Issues MIT License LinkedIn


GoLinkedin

Go Linkedin API with Using Fiber Framework!

Getting Started

You can import API to your project with that's code.

go get github.com/knetic0/golinkedin

Usage

License

Distributed under the MIT License. See LICENSE.txt for more information.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Base URL for LinkedIn's OAuth authentication endpoint.
	AuthenticationBaseURL = "https://www.linkedin.com/oauth/v2/authorization?"

	// Base URL for requesting the access token after obtaining the authorization code.
	AccessTokenBaseURL = "https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code"
)
View Source
var (
	PostURL = "https://api.linkedin.com/v2/ugcPosts?oauth2_access_token="
)
View Source
var (
	ProfileURL = "https://api.linkedin.com/v2/me"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// The response type, set to 'code' by default, which is the standard for authorization flows.
	ResponseType string

	// Your LinkedIn app's ClientID, which is obtained after creating a LinkedIn app.
	ClientID string

	// Your LinkedIn app's ClientSecret, obtained after creating the LinkedIn app.
	ClientSecret string

	// The callback URL you define when setting up your LinkedIn app. It will be used for redirecting users.
	RedirectURI string

	// The requested permissions (scopes). Set to 'r_liteprofile', 'r_emailaddress', 'w_member_social', and 'w_share' by default.
	Scopes []string
}

type JobPosting

type JobPosting struct {
	IntegrationContext      string   `json:"integrationContext"`
	CompanyApplyUrl         string   `json:"companyApplyUrl"`
	Description             string   `json:"description"`
	EmploymentStatus        string   `json:"employmentStatus"`
	ExternalJobPostingId    string   `json:"externalJobPostingId"`
	ListedAt                int      `json:"listedAt"`
	JobPostingOperationType string   `json:"jobPostingOperationType"`
	Title                   string   `json:"title"`
	Location                string   `json:"location"`
	WorkplaceTypes          []string `json:"workplaceTypes"`
}

type JobValue

type JobValue struct {
	JobPosting []JobPosting `json:"elements"`
}

type Linkedin

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

func New

func New(config ...Config) (*Linkedin, error)

New creates a new LinkedIn API client with the given configuration. This requires the Client ID, Redirect URL, and Client Secret, which can be found on the LinkedIn Developer portal. Optionally, permissions (scopes) can be provided. If no config is provided, an error is returned.

func (*Linkedin) GetAuthenticationUrl

func (ln *Linkedin) GetAuthenticationUrl() string

GetAuthenticationUrl returns the LinkedIn authorization URL, allowing the client to authenticate users and receive an authorization code.

func (*Linkedin) Profile

func (ln *Linkedin) Profile(token string) (*ProfileInformation, error)

After than Callback, you take Profile information with this function. Create route for this.

func (*Linkedin) RetrieveAccessToken

func (ln *Linkedin) RetrieveAccessToken(code string) (string, error)

RetrieveAccessToken exchanges the authorization code for an access token by making an HTTP request to LinkedIn's OAuth API. The access token is required for accessing LinkedIn's API.

func (*Linkedin) SharePost

func (ln *Linkedin) SharePost(token, id, text string) error

Have ProfileID, Share any post what you want.

type Post

type Post struct {
	// Author URN for this content
	Author string `json:"author"`

	// The state of this content. PUBLISHED is the only accepted field during creation.
	LifeCycleState string `json:"lifecycleState"`

	// The content of post. For now you can just define text.
	SpecificContent SpecificContent `json:"specificContent"`

	// Visibility restrictions on content.
	Visibility Visibility `json:"visibility"`
}

type ProfileInformation

type ProfileInformation struct {
	// ProfileID represents the ID every linkedin profile has.
	Id string `json:"id"`

	// User's FirstName
	FirstName string `json:"localizedFirstName"`

	// User's LastName
	LastName string `json:"localizedLastName"`
}

type ShareCommentary

type ShareCommentary struct {
	Text string `json:"text"`
}

type ShareContent

type ShareContent struct {
	ShareCommentary    ShareCommentary `json:"shareCommentary"`
	ShareMediaCategory string          `json:"shareMediaCategory"`
}

type SpecificContent

type SpecificContent struct {
	ShareContent ShareContent `json:"com.linkedin.ugc.ShareContent"`
}

type Visibility

type Visibility struct {
	Code string `json:"com.linkedin.ugc.MemberNetworkVisibility"`
}

Jump to

Keyboard shortcuts

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