instagram

package
v0.0.0-...-69a499a Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "instagram"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [4]string{"register-url", "attach-to-account", "detach-from-account", "receive"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeInternalServerError

func MakeInternalServerError(err error) *goa.ServiceError

MakeInternalServerError builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func NewAttachToAccountEndpoint

func NewAttachToAccountEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewAttachToAccountEndpoint returns an endpoint function that calls the method "attach-to-account" of service "instagram".

func NewDetachFromAccountEndpoint

func NewDetachFromAccountEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewDetachFromAccountEndpoint returns an endpoint function that calls the method "detach-from-account" of service "instagram".

func NewReceiveEndpoint

func NewReceiveEndpoint(s Service) goa.Endpoint

NewReceiveEndpoint returns an endpoint function that calls the method "receive" of service "instagram".

func NewRegisterURLEndpoint

func NewRegisterURLEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewRegisterURLEndpoint returns an endpoint function that calls the method "register-url" of service "instagram".

func NewViewedUserMedia

func NewViewedUserMedia(res *UserMedia, view string) *instagramviews.UserMedia

NewViewedUserMedia initializes viewed result type UserMedia from result type UserMedia using the given view.

Types

type AttachToAccountPayload

type AttachToAccountPayload struct {
	Authorization *string
	XSession      *string
	APIKey        *string
	RedirectURL   *string
}

AttachToAccountPayload is the payload type of the instagram service attach-to-account method.

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	RegisterURLEndpoint       goa.Endpoint
	AttachToAccountEndpoint   goa.Endpoint
	DetachFromAccountEndpoint goa.Endpoint
	ReceiveEndpoint           goa.Endpoint
}

Client is the "instagram" service client.

func NewClient

func NewClient(registerURL, attachToAccount, detachFromAccount, receive goa.Endpoint) *Client

NewClient initializes a "instagram" service client given the endpoints.

func (*Client) AttachToAccount

func (c *Client) AttachToAccount(ctx context.Context, p *AttachToAccountPayload) (res string, err error)

AttachToAccount calls the "attach-to-account" endpoint of the "instagram" service. AttachToAccount may return the following errors:

  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) DetachFromAccount

func (c *Client) DetachFromAccount(ctx context.Context, p *DetachFromAccountPayload) (err error)

DetachFromAccount calls the "detach-from-account" endpoint of the "instagram" service. DetachFromAccount may return the following errors:

  • "NotFound" (type *goa.ServiceError)
  • "Forbidden" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) Receive

func (c *Client) Receive(ctx context.Context, p *ReceivePayload) (res *UserMedia, err error)

Receive calls the "receive" endpoint of the "instagram" service. Receive may return the following errors:

  • "Unauthorized" (type *goa.ServiceError)
  • "BadRequest" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) RegisterURL

func (c *Client) RegisterURL(ctx context.Context, p *RegisterURLPayload) (res string, err error)

RegisterURL calls the "register-url" endpoint of the "instagram" service. RegisterURL may return the following errors:

  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

type DetachFromAccountPayload

type DetachFromAccountPayload struct {
	Authorization *string
	XSession      *string
	APIKey        *string
}

DetachFromAccountPayload is the payload type of the instagram service detach-from-account method.

type Endpoints

type Endpoints struct {
	RegisterURL       goa.Endpoint
	AttachToAccount   goa.Endpoint
	DetachFromAccount goa.Endpoint
	Receive           goa.Endpoint
}

Endpoints wraps the "instagram" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "instagram" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "instagram" service endpoints.

type ReceivePayload

type ReceivePayload struct {
	Code          *string
	State         *string
	Authorization *string
	XSession      *string
	APIKey        *string
	RedirectURL   *string
}

ReceivePayload is the payload type of the instagram service receive method.

type RegisterURLPayload

type RegisterURLPayload struct {
	APIKey      *string
	RedirectURL *string
}

RegisterURLPayload is the payload type of the instagram service register-url method.

type Service

type Service interface {
	// Gets the URL the front-end should redirect the browser to in order to be
	// authenticated with Instagram, and then register
	RegisterURL(context.Context, *RegisterURLPayload) (res string, err error)
	// Attaches a Instagram account to an existing user account, returns the URL
	// the browser should be redirected to
	AttachToAccount(context.Context, *AttachToAccountPayload) (res string, err error)
	// Detaches a Instagram account from an existing user account.
	DetachFromAccount(context.Context, *DetachFromAccountPayload) (err error)
	// The endpoint that Instagram redirects the browser to after the user has
	// authenticated
	Receive(context.Context, *ReceivePayload) (res *UserMedia, err error)
}

Service is the instagram service interface.

type UserMedia

type UserMedia struct {
	// Unique unchanging user ID
	ID string
	// Given name for the user
	FirstName string
	// Family name for the user
	LastName string
	// Email attached to the account of the user
	Email string
	// Phone Number Of the user
	Phone string
	// When the user attempts to change their email, this is what they will change
	// it to after they verify that it belongs to them
	ChangingEmail *string
	// Whether the user has verified their email
	VerifiedEmail bool
	// Whether the user is an administrator on the site
	IsAdmin          *bool
	UpdatedAt        *string
	IsActive         *bool
	CreatedAt        *string
	CountryPhoneCode *string
	Authorization    string
	XSession         string
}

UserMedia is the result type of the instagram service receive method.

func NewUserMedia

func NewUserMedia(vres *instagramviews.UserMedia) *UserMedia

NewUserMedia initializes result type UserMedia from viewed result type UserMedia.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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