"Fossies" - the Fresh Open Source Software Archive

Member "cri-o-1.25.1/vendor/github.com/google/go-github/v42/github/activity.go" (7 Oct 2022, 2960 Bytes) of package /linux/misc/cri-o-1.25.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Copyright 2013 The go-github AUTHORS. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file.
    5 
    6 package github
    7 
    8 import "context"
    9 
   10 // ActivityService handles communication with the activity related
   11 // methods of the GitHub API.
   12 //
   13 // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/
   14 type ActivityService service
   15 
   16 // FeedLink represents a link to a related resource.
   17 type FeedLink struct {
   18     HRef *string `json:"href,omitempty"`
   19     Type *string `json:"type,omitempty"`
   20 }
   21 
   22 // Feeds represents timeline resources in Atom format.
   23 type Feeds struct {
   24     TimelineURL                 *string    `json:"timeline_url,omitempty"`
   25     UserURL                     *string    `json:"user_url,omitempty"`
   26     CurrentUserPublicURL        *string    `json:"current_user_public_url,omitempty"`
   27     CurrentUserURL              *string    `json:"current_user_url,omitempty"`
   28     CurrentUserActorURL         *string    `json:"current_user_actor_url,omitempty"`
   29     CurrentUserOrganizationURL  *string    `json:"current_user_organization_url,omitempty"`
   30     CurrentUserOrganizationURLs []string   `json:"current_user_organization_urls,omitempty"`
   31     Links                       *FeedLinks `json:"_links,omitempty"`
   32 }
   33 
   34 // FeedLinks represents the links in a Feed.
   35 type FeedLinks struct {
   36     Timeline                 *FeedLink   `json:"timeline,omitempty"`
   37     User                     *FeedLink   `json:"user,omitempty"`
   38     CurrentUserPublic        *FeedLink   `json:"current_user_public,omitempty"`
   39     CurrentUser              *FeedLink   `json:"current_user,omitempty"`
   40     CurrentUserActor         *FeedLink   `json:"current_user_actor,omitempty"`
   41     CurrentUserOrganization  *FeedLink   `json:"current_user_organization,omitempty"`
   42     CurrentUserOrganizations []*FeedLink `json:"current_user_organizations,omitempty"`
   43 }
   44 
   45 // ListFeeds lists all the feeds available to the authenticated user.
   46 //
   47 // GitHub provides several timeline resources in Atom format:
   48 //     Timeline: The GitHub global public timeline
   49 //     User: The public timeline for any user, using URI template
   50 //     Current user public: The public timeline for the authenticated user
   51 //     Current user: The private timeline for the authenticated user
   52 //     Current user actor: The private timeline for activity created by the
   53 //         authenticated user
   54 //     Current user organizations: The private timeline for the organizations
   55 //         the authenticated user is a member of.
   56 //
   57 // Note: Private feeds are only returned when authenticating via Basic Auth
   58 // since current feed URIs use the older, non revocable auth tokens.
   59 func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error) {
   60     req, err := s.client.NewRequest("GET", "feeds", nil)
   61     if err != nil {
   62         return nil, nil, err
   63     }
   64 
   65     f := &Feeds{}
   66     resp, err := s.client.Do(ctx, req, f)
   67     if err != nil {
   68         return nil, resp, err
   69     }
   70 
   71     return f, resp, nil
   72 }